From 2c0b36bc4582cb9964c637f6509603ca3e776df8 Mon Sep 17 00:00:00 2001 From: mmathias01 Date: Thu, 24 Nov 2011 10:59:09 +0000 Subject: [PATCH] Update CMake environment to accept BUILD_STATIC_LIB option to allow building of static library for platforms that require it (such as iOS). Sorry if I overstepped any bounds here; feel free to revert if required. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1088 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- CMakeLists.txt | 6 +++++ code/CMakeLists.txt | 60 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8495a0cb..4e0e4d379 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES( include ) # directory, since that is probably what the user wanted to avoid. IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) + SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin ) ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) @@ -45,6 +46,11 @@ SET( BIN_INSTALL_DIR "bin" CACHE PATH CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY ) INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ COMPONENT assimp-dev) +# Allow the user to build a static library +SET ( BUILD_STATIC_LIB OFF CACHE BOOL + "Build a static (.a) version of the library" +) + # Globally enbale Boost resp. the Boost workaround – it is also needed by the # tools which include the Assimp headers. SET ( ENABLE_BOOST_WORKAROUND OFF CACHE BOOL diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index d7c940e0c..92313e2bc 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -544,6 +544,65 @@ else (UNZIP_FOUND) SET (unzip_compile_SRCS ${unzip_SRCS}) endif (UNZIP_FOUND) +IF ( BUILD_STATIC_LIB ) +ADD_LIBRARY( assimp STATIC + # Assimp Files + ${Core_SRCS} + ${Common_SRCS} + ${Logging_SRCS} + ${Exporter_SRCS} + ${PostProcessing_SRCS} + + # Model Support + ${3DS_SRCS} + ${AC_SRCS} + ${ASE_SRCS} + ${B3D_SRCS} + ${BVH_SRCS} + ${Collada_SRCS} + ${DXF_SRCS} + ${CSM_SRCS} + ${HMP_SRCS} + ${Irr_SRCS} + ${LWO_SRCS} + ${LWS_SRCS} + ${M3_SRCS} + ${MD2_SRCS} + ${MD3_SRCS} + ${MD5_SRCS} + ${MDC_SRCS} + ${MDL_SRCS} + ${MaterialSystem_SRCS} + ${NFF_SRCS} + ${OFFFormat_SRCS} + ${Obj_SRCS} + ${Ogre_SRCS} + ${Ply_SRCS} + ${Q3D_SRCS} + ${Q3BSP_SRCS} + ${Raw_SRCS} + ${SMD_SRCS} + ${STL_SRCS} + ${Unreal_SRCS} + ${XFile_SRCS} + ${Extra_SRCS} + ${MS3D_SRCS} + ${COB_SRCS} + ${BLENDER_SRCS} + ${NDO_SRCS} + ${IFC_SRCS} + + # Third-party libraries + ${IrrXML_SRCS} + ${ConvertUTF_SRCS} + ${unzip_compile_SRCS} + # Necessary to show the headers in the project when using the VC++ generator: + ${Boost_SRCS} + + ${PUBLIC_HEADERS} + ${COMPILER_HEADERS} +) +ELSE ( BUILD_STATIC_LIB ) ADD_LIBRARY( assimp SHARED # Assimp Files ${Core_SRCS} @@ -601,6 +660,7 @@ ADD_LIBRARY( assimp SHARED ${PUBLIC_HEADERS} ${COMPILER_HEADERS} ) +ENDIF ( BUILD_STATIC_LIB ) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp PROPERTIES