Skip to content

Commit

Permalink
Merge pull request #6 from escherstair/add_VS2013_VS2019
Browse files Browse the repository at this point in the history
Add AppVeyor build VS2019
  • Loading branch information
escherstair authored Oct 9, 2019
2 parents 03514a9 + c63f5b2 commit b64c4ff
Show file tree
Hide file tree
Showing 66 changed files with 1,901 additions and 3,819 deletions.
3 changes: 2 additions & 1 deletion .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#
function generate() {
OPTIONS="-DASSIMP_WERROR=ON"

OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=NO"

if [ "$DISABLE_EXPORTERS" = "YES" ] ; then
OPTIONS="$OPTIONS -DASSIMP_NO_EXPORT=YES"
else
Expand Down
26 changes: 26 additions & 0 deletions BUILDBINARIES_EXAMPLE.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:: This is an example file to generate binaries using Windows Operating System
:: This script is configured to be executed from the source directory

:: Compiled binaries will be placed in BINARIES_DIR\code\CONFIG

:: NOTE
:: The build process will generate a config.h file that is placed in BINARIES_DIR\include
:: This file must be merged with SOURCE_DIR\include
:: You should write yourself a script that copies the files where you want them.
:: Also see: https://github.com/assimp/assimp/pull/2646

SET SOURCE_DIR=.

:: For generators see "cmake --help"
SET GENERATOR=Visual Studio 15 2017

SET BINARIES_DIR="./BINARIES/Win32"
cmake CMakeLists.txt -G "%GENERATOR%" -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config release

SET BINARIES_DIR="./BINARIES/x64"
cmake CMakeLists.txt -G "%GENERATOR% Win64" -S %SOURCE_DIR% -B %BINARIES_DIR%
cmake --build %BINARIES_DIR% --config debug
cmake --build %BINARIES_DIR% --config release

PAUSE
28 changes: 21 additions & 7 deletions Build.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
# Build Instructions
## Install CMake

## Build on all platforms using vcpkg
You can download and install assimp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
```bash
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install assimp
```
The assimp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.

## Manual build instructions

### Install CMake
Asset-Importer-Lib can be build for a lot of different platforms. We are using cmake to generate the build environment for these via cmake. So you have to make sure that you have a working cmake-installation on your system. You can download it at https://cmake.org/ or for linux install it via
```bash
sudo apt-get install cmake
```

## Get the source
### Get the source
Make sure you have a working git-installation. Open a command prompt and clone the Asset-Importer-Lib via:
```bash
git clone https://github.com/assimp/assimp.git
```

## Build instructions for Windows with Visual-Studio
### Build instructions for Windows with Visual-Studio

First you have to install Visual-Studio on your windows-system. You can get the Community-Version for free here: https://visualstudio.microsoft.com/de/downloads/
To generate the build environment for your IDE open a command prompt, navigate to your repo and type:
Expand All @@ -20,10 +34,10 @@ cmake CMakeLists.txt
```
This will generate the project files for the visual studio. All dependencies used to build Asset-IMporter-Lib shall be part of the repo. If you want to use you own zlib.installation this is possible as well. Check the options for it.

## Build instructions for Windows with UWP
### Build instructions for Windows with UWP
See <https://stackoverflow.com/questions/40803170/cmake-uwp-using-cmake-to-build-universal-windows-app>

## Build instructions for Linux / Unix
### Build instructions for Linux / Unix
Open a terminal and got to your repository. You can generate the makefiles and build the library via:

```bash
Expand All @@ -34,7 +48,7 @@ The option -j descripes the number of parallel processes for the build. In this

If you want to use a IDE for linux you can try QTCreator for instance.

## Build instructions for MinGW
### Build instructions for MinGW
Older versions of MinGW's compiler (e.g. 5.1.0) do not support the -mbig_obj flag
required to compile some of assimp's files, especially for debug builds.
Version 7.3.0 of g++-mingw-w64 & gcc-mingw-w64 appears to work.
Expand All @@ -50,7 +64,7 @@ The following toolchain may or may not be helpful for building assimp using MinG

Besides the toolchain, compilation should be the same as for Linux / Unix.

## CMake build options
### CMake build options
The cmake-build-environment provides options to configure the build. The following options can be used:
- **BUILD_SHARED_LIBS ( default ON )**: Generation of shared libs ( dll for windows, so for Linux ). Set this to OFF to get a static lib.
- **BUILD_FRAMEWORK ( default OFF, MacOnly)**: Build package as Mac OS X Framework bundle
Expand Down
24 changes: 10 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,14 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW )
ENDIF()

IF ( IOS AND NOT HUNTER_ENABLED)

IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
# Experimental for pdb generation
ENDIF()

IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
# Experimental for pdb generation
ENDIF()
ENDIF( IOS AND NOT HUNTER_ENABLED)

IF (ASSIMP_COVERALLS)
Expand Down Expand Up @@ -559,17 +557,15 @@ ENDIF(NOT HUNTER_ENABLED)

ADD_SUBDIRECTORY( code/ )
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
# The viewer for windows only
IF ( WIN32 AND DirectX_D3DX9_LIBRARY )
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
ADD_SUBDIRECTORY( tools/assimp_view/ )
ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW )
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )

# Te command line tool
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
IF (NOT IOS)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ENDIF (NOT IOS)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )

IF ( ASSIMP_BUILD_SAMPLES)
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ __Exporters__:
- FBX ( experimental )

### Building ###
Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. Our build system is CMake, if you used CMake before there is a good chance you know what to do.
Take a look into the https://github.com/assimp/assimp/blob/master/Build.md file. We are available in vcpkg, and our build system is CMake; if you used CMake before there is a good chance you know what to do.

### Ports ###
* [Android](port/AndroidJNI/README.md)
Expand Down
9 changes: 7 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ matrix:
image:
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019
- MinGW

platform:
- Win32
Expand All @@ -26,10 +28,13 @@ configuration: Release
install:
- set PATH=C:\Ruby24-x64\bin;%PATH%
- set CMAKE_DEFINES -DASSIMP_WERROR=ON
- if [%COMPILER%]==[MinGW] set PATH=C:\MinGW\bin;%PATH%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set CMAKE_GENERATOR_NAME=Visual Studio 14 2015
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" set CMAKE_GENERATOR_NAME=Visual Studio 15 2017
- if "%platform%"=="x64" set CMAKE_GENERATOR_NAME=%CMAKE_GENERATOR_NAME% Win64
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" .
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" set CMAKE_GENERATOR_NAME=Visual Studio 16 2019
- cmake %CMAKE_DEFINES% -G "%CMAKE_GENERATOR_NAME%" -A %platform% .
# Rename sh.exe as sh.exe in PATH interferes with MinGW
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
- set PATH=%PATH%;"C:\\Program Files (x86)\\Inno Setup 5"
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\packaging\windows-innosetup\vc_redist.x64.exe
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/1/d/8/1d8137db-b5bb-4925-8c5d-927424a2e4de/vc_redist.x86.exe -OutFile .\packaging\windows-innosetup\vc_redist.x86.exe
Expand Down
2 changes: 2 additions & 0 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ ADD_ASSIMP_EXPORTER( X3D
)

ADD_ASSIMP_IMPORTER( GLTF
glTF/glTFCommon.h
glTF/glTFCommon.cpp
glTF/glTFAsset.h
glTF/glTFAsset.inl
glTF/glTFAssetWriter.h
Expand Down
7 changes: 4 additions & 3 deletions code/Collada/ColladaExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "ColladaExporter.h"
#include <assimp/Bitmap.h>
#include <assimp/MathFunctions.h>
#include <assimp/fast_atof.h>
#include <assimp/SceneCombiner.h>
#include <assimp/StringUtils.h>
Expand Down Expand Up @@ -155,7 +156,7 @@ void ColladaExporter::WriteFile() {
// ------------------------------------------------------------------------------------------------
// Writes the asset header
void ColladaExporter::WriteHeader() {
static const ai_real epsilon = ai_real( 0.00001 );
static const ai_real epsilon = Math::getEpsilon<ai_real>();
static const aiQuaternion x_rot(aiMatrix3x3(
0, -1, 0,
1, 0, 0,
Expand Down Expand Up @@ -317,7 +318,7 @@ void ColladaExporter::WriteTextures() {

std::string name = mFile + "_texture_" + (i < 1000 ? "0" : "") + (i < 100 ? "0" : "") + (i < 10 ? "0" : "") + str + "." + ((const char*) texture->achFormatHint);

std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + name, "wb"));
std::unique_ptr<IOStream> outfile(mIOSystem->Open(mPath + mIOSystem->getOsSeparator() + name, "wb"));
if(outfile == NULL) {
throw DeadlyExportError("could not open output texture file: " + mPath + name);
}
Expand Down Expand Up @@ -1671,4 +1672,4 @@ void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
}

#endif
#endif
#endif
2 changes: 1 addition & 1 deletion code/Common/BaseImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void BaseImporter::UpdateImporterScale( Importer* pImp )
double activeScale = importerScale * fileScale;

// Set active scaling
pImp->SetPropertyFloat( AI_CONFIG_APP_SCALE_KEY, activeScale);
pImp->SetPropertyFloat( AI_CONFIG_APP_SCALE_KEY, static_cast<float>( activeScale) );

ASSIMP_LOG_DEBUG_F("UpdateImporterScale scale set: %f", activeScale );
}
Expand Down
21 changes: 21 additions & 0 deletions code/Common/SceneCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ void SceneCombiner::Copy( aiAnimation** _dest, const aiAnimation* src ) {

// and reallocate all arrays
CopyPtrArray( dest->mChannels, src->mChannels, dest->mNumChannels );
CopyPtrArray( dest->mMorphMeshChannels, src->mMorphMeshChannels, dest->mNumMorphMeshChannels );
}

// ------------------------------------------------------------------------------------------------
Expand All @@ -1215,6 +1216,26 @@ void SceneCombiner::Copy(aiNodeAnim** _dest, const aiNodeAnim* src) {
GetArrayCopy( dest->mRotationKeys, dest->mNumRotationKeys );
}

void SceneCombiner::Copy(aiMeshMorphAnim** _dest, const aiMeshMorphAnim* src) {
if ( nullptr == _dest || nullptr == src ) {
return;
}

aiMeshMorphAnim* dest = *_dest = new aiMeshMorphAnim();

// get a flat copy
::memcpy(dest,src,sizeof(aiMeshMorphAnim));

// and reallocate all arrays
GetArrayCopy( dest->mKeys, dest->mNumKeys );
for (ai_uint i = 0; i < dest->mNumKeys;++i) {
dest->mKeys[i].mValues = new unsigned int[dest->mKeys[i].mNumValuesAndWeights];
dest->mKeys[i].mWeights = new double[dest->mKeys[i].mNumValuesAndWeights];
::memcpy(dest->mKeys[i].mValues, src->mKeys[i].mValues, dest->mKeys[i].mNumValuesAndWeights * sizeof(unsigned int));
::memcpy(dest->mKeys[i].mWeights, src->mKeys[i].mWeights, dest->mKeys[i].mNumValuesAndWeights * sizeof(double));
}
}

// ------------------------------------------------------------------------------------------------
void SceneCombiner::Copy( aiCamera** _dest,const aiCamera* src) {
if ( nullptr == _dest || nullptr == src ) {
Expand Down
22 changes: 19 additions & 3 deletions code/FBX/FBXConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImporter.h"

#include <assimp/StringComparison.h>
#include <assimp/MathFunctions.h>

#include <assimp/scene.h>

Expand Down Expand Up @@ -553,7 +554,7 @@ namespace Assimp {
return;
}

const float angle_epsilon = 1e-6f;
const float angle_epsilon = Math::getEpsilon<float>();

out = aiMatrix4x4();

Expand Down Expand Up @@ -694,7 +695,7 @@ namespace Assimp {
std::fill_n(chain, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4());

// generate transformation matrices for all the different transformation components
const float zero_epsilon = 1e-6f;
const float zero_epsilon = Math::getEpsilon<float>();
const aiVector3D all_ones(1.0f, 1.0f, 1.0f);

const aiVector3D& PreRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok);
Expand Down Expand Up @@ -2001,6 +2002,21 @@ namespace Assimp {
TrySetTextureProperties(out_mat, textures, "Maya|SpecularTexture", aiTextureType_SPECULAR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|FalloffTexture", aiTextureType_OPACITY, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|ReflectionMapTexture", aiTextureType_REFLECTION, mesh);

// Maya PBR
TrySetTextureProperties(out_mat, textures, "Maya|baseColor|file", aiTextureType_BASE_COLOR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|normalCamera|file", aiTextureType_NORMAL_CAMERA, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|emissionColor|file", aiTextureType_EMISSION_COLOR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|metalness|file", aiTextureType_METALNESS, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|diffuseRoughness|file", aiTextureType_DIFFUSE_ROUGHNESS, mesh);

// Maya stingray
TrySetTextureProperties(out_mat, textures, "Maya|TEX_color_map|file", aiTextureType_BASE_COLOR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_normal_map|file", aiTextureType_NORMAL_CAMERA, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_emissive_map|file", aiTextureType_EMISSION_COLOR, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_metallic_map|file", aiTextureType_METALNESS, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_roughness_map|file", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
TrySetTextureProperties(out_mat, textures, "Maya|TEX_ao_map|file", aiTextureType_AMBIENT_OCCLUSION, mesh);
}

void FBXConverter::SetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh)
Expand Down Expand Up @@ -2952,7 +2968,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
TransformationCompDefaultValue(comp)
);

const float epsilon = 1e-6f;
const float epsilon = Math::getEpsilon<float>();
return (dyn_val - static_val).SquareLength() < epsilon;
}

Expand Down
6 changes: 1 addition & 5 deletions code/FBX/FBXExportProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ namespace FBX {

FBXExportProperty::FBXExportProperty(bool v)
: type('C')
, data(1) {
data = {
uint8_t(v)
};
}
, data(1, uint8_t(v)) {}

FBXExportProperty::FBXExportProperty(int16_t v)
: type('Y')
Expand Down
2 changes: 1 addition & 1 deletion code/FBX/FBXExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ void FBXExporter::WriteObjects ()

for(unsigned int lr = 1; lr < m->GetNumUVChannels(); ++ lr)
{
FBX::Node layerExtra("Layer", int32_t(1));
FBX::Node layerExtra("Layer", int32_t(lr));
layerExtra.AddChild("Version", int32_t(100));
FBX::Node leExtra("LayerElement");
leExtra.AddChild("Type", "LayerElementUV");
Expand Down
7 changes: 3 additions & 4 deletions code/Importer/IFC/IFCCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,9 @@ class TrimmedCurve : public BoundedCurve {
public:
// --------------------------------------------------
TrimmedCurve(const Schema_2x3::IfcTrimmedCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv)
: BoundedCurve(entity,conv),
base(std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv)))
{
base = std::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));

typedef std::shared_ptr<const STEP::EXPRESS::DataType> Entry;

// for some reason, trimmed curves can either specify a parametric value
Expand Down Expand Up @@ -500,7 +499,7 @@ bool Curve::InRange(IfcFloat u) const {
if (IsClosed()) {
return true;
}
const IfcFloat epsilon = 1e-5;
const IfcFloat epsilon = Math::getEpsilon<float>();
return u - range.first > -epsilon && range.second - u > -epsilon;
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions code/Importer/IFC/IFCOpenings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ typedef std::vector<std::pair<
bool BoundingBoxesAdjacent(const BoundingBox& bb, const BoundingBox& ibb)
{
// TODO: I'm pretty sure there is a much more compact way to check this
const IfcFloat epsilon = 1e-5f;
const IfcFloat epsilon = Math::getEpsilon<float>();
return (std::fabs(bb.second.x - ibb.first.x) < epsilon && bb.first.y <= ibb.second.y && bb.second.y >= ibb.first.y) ||
(std::fabs(bb.first.x - ibb.second.x) < epsilon && ibb.first.y <= bb.second.y && ibb.second.y >= bb.first.y) ||
(std::fabs(bb.second.y - ibb.first.y) < epsilon && bb.first.x <= ibb.second.x && bb.second.x >= ibb.first.x) ||
Expand Down Expand Up @@ -681,7 +681,7 @@ bool IntersectingLineSegments(const IfcVector2& n0, const IfcVector2& n1,
// ------------------------------------------------------------------------------------------------
void FindAdjacentContours(ContourVector::iterator current, const ContourVector& contours)
{
const IfcFloat sqlen_epsilon = static_cast<IfcFloat>(1e-8);
const IfcFloat sqlen_epsilon = static_cast<IfcFloat>(Math::getEpsilon<float>());
const BoundingBox& bb = (*current).bb;

// What is to be done here is to populate the skip lists for the contour
Expand Down Expand Up @@ -758,7 +758,7 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector&
// ------------------------------------------------------------------------------------------------
AI_FORCE_INLINE bool LikelyBorder(const IfcVector2& vdelta)
{
const IfcFloat dot_point_epsilon = static_cast<IfcFloat>(1e-5);
const IfcFloat dot_point_epsilon = static_cast<IfcFloat>(Math::getEpsilon<float>());
return std::fabs(vdelta.x * vdelta.y) < dot_point_epsilon;
}

Expand Down
Loading

0 comments on commit b64c4ff

Please sign in to comment.