-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to link against system assimp/glbinding libraries instea…
…d of building as dependencies.
- Loading branch information
Showing
8 changed files
with
190 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
include (assimp-config) # from deps | ||
if (DE_USE_SYSTEM_ASSIMP) | ||
include (${DE_CMAKE_DIR}/assimp-system.cmake) | ||
else () | ||
include (assimp-config) # from deps | ||
endif () | ||
|
||
add_library (assimp INTERFACE) | ||
set (_cxxFlags ${ASSIMP_CXX_FLAGS}) | ||
separate_arguments (_cxxFlags) | ||
target_compile_options (assimp INTERFACE ${_cxxFlags}) | ||
target_include_directories (assimp INTERFACE ${ASSIMP_INCLUDE_DIRS}) | ||
target_link_libraries (assimp INTERFACE -L${ASSIMP_LIBRARY_DIRS} -l${ASSIMP_LIBRARIES}) | ||
if (DE_USE_SYSTEM_ASSIMP) | ||
target_link_libraries (assimp INTERFACE ${ASSIMP_LIBRARIES}) | ||
else () | ||
target_link_libraries (assimp INTERFACE -L${ASSIMP_LIBRARY_DIRS} -l${ASSIMP_LIBRARIES}) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(ASSIMP_ARCHITECTURE "64") | ||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
set(ASSIMP_ARCHITECTURE "32") | ||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
|
||
if(WIN32) | ||
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory") | ||
|
||
# Find path of each library | ||
find_path(ASSIMP_INCLUDE_DIR | ||
NAMES | ||
assimp/anim.h | ||
HINTS | ||
${ASSIMP_ROOT_DIR}/include | ||
) | ||
|
||
if(MSVC12) | ||
set(ASSIMP_MSVC_VERSION "vc120") | ||
elseif(MSVC14) | ||
set(ASSIMP_MSVC_VERSION "vc140") | ||
endif(MSVC12) | ||
|
||
if(MSVC12 OR MSVC14) | ||
|
||
find_path(ASSIMP_LIBRARY_DIR | ||
NAMES | ||
assimp-${ASSIMP_MSVC_VERSION}-mt.lib | ||
HINTS | ||
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE} | ||
) | ||
|
||
find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR}) | ||
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR}) | ||
|
||
set(ASSIMP_LIBRARY | ||
optimized ${ASSIMP_LIBRARY_RELEASE} | ||
debug ${ASSIMP_LIBRARY_DEBUG} | ||
) | ||
|
||
set(ASSIMP_LIBRARIES "ASSIMP_LIBRARY_RELEASE" "ASSIMP_LIBRARY_DEBUG") | ||
|
||
FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory) | ||
ADD_CUSTOM_TARGET(AssimpCopyBinaries | ||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll | ||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll | ||
COMMENT "Copying Assimp binaries to '${TargetDirectory}'" | ||
VERBATIM) | ||
ENDFUNCTION(ASSIMP_COPY_BINARIES) | ||
|
||
endif() | ||
|
||
elseif (DE_USE_SYSTEM_ASSIMP) | ||
|
||
find_path( | ||
ASSIMP_INCLUDE_DIR | ||
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h | ||
PATHS /usr/local/include | ||
PATHS /usr/include/ | ||
|
||
) | ||
|
||
find_library( | ||
ASSIMP_LIBRARIES | ||
NAMES assimp | ||
PATHS /usr/local/lib/ | ||
PATHS /usr/lib64/ | ||
PATHS /usr/lib/ | ||
) | ||
|
||
endif(WIN32 OR DE_USE_SYSTEM_ASSIMP) | ||
|
||
|
||
if (ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARIES) | ||
SET(assimp_FOUND TRUE) | ||
ENDIF (ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARIES) | ||
|
||
if (assimp_FOUND) | ||
if (NOT assimp_FIND_QUIETLY) | ||
message(STATUS "Found asset importer library: ${ASSIMP_LIBRARIES}") | ||
endif (NOT assimp_FIND_QUIETLY) | ||
else (assimp_FOUND) | ||
if (DE_USE_SYSTEM_ASSIMP OR assimp_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find asset importer library") | ||
endif (assimp_FIND_REQUIRED) | ||
endif (assimp_FOUND) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Find the glbinding headers and library in standard system paths | ||
|
||
find_path( | ||
glbinding_INCLUDE_DIR | ||
NAMES glbinding/glbinding-version.h | ||
PATHS /usr/local/include | ||
PATHS /usr/include/ | ||
) | ||
|
||
find_library( | ||
glbinding_LIBRARIES | ||
NAMES glbinding | ||
PATHS /usr/local/lib64/ | ||
PATHS /usr/local/lib/ | ||
PATHS /usr/lib64/ | ||
PATHS /usr/lib/ | ||
) | ||
|
||
if (glbinding_INCLUDE_DIR AND glbinding_LIBRARIES) | ||
SET(glbinding_FOUND TRUE) | ||
SET(glbinding::glbinding_FOUND TRUE) | ||
|
||
FILE(READ ${glbinding_INCLUDE_DIR}/glbinding/glbinding-version.h GLBINDING_VERSION_H) | ||
STRING(REGEX MATCH "define[ ]+GLBINDING_VERSION_MAJOR[ ]+\"[0-9]+" GLBINDING_MAJOR_VERSION_LINE "${GLBINDING_VERSION_H}") | ||
STRING(REGEX REPLACE "define[ ]+GLBINDING_VERSION_MAJOR[ ]+\"([0-9]+)" "\\1" glbinding_VERSION_MAJOR "${GLBINDING_MAJOR_VERSION_LINE}") | ||
|
||
STRING(REGEX MATCH "define[ ]+GLBINDING_VERSION_MINOR[ ]+\"[0-9]+" GLBINDING_MINOR_VERSION_LINE "${GLBINDING_VERSION_H}") | ||
STRING(REGEX REPLACE "define[ ]+GLBINDING_VERSION_MINOR[ ]+\"([0-9]+)" "\\1" glbinding_VERSION_MINOR "${GLBINDING_MINOR_VERSION_LINE}") | ||
|
||
message (STATUS "Using system glbinding library, version ${glbinding_VERSION_MAJOR}.${glbinding_VERSION_MINOR}") | ||
|
||
ENDIF (glbinding_INCLUDE_DIRS AND glbinding_LIBRARIES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters