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
pull/3/head
mmathias01 2011-11-24 10:59:09 +00:00
parent 213c6c95c3
commit 2c0b36bc45
2 changed files with 66 additions and 0 deletions

View File

@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES( include )
# directory, since that is probably what the user wanted to avoid. # directory, since that is probably what the user wanted to avoid.
IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) 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 ) SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin )
ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) 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 ) 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) 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 # Globally enbale Boost resp. the Boost workaround it is also needed by the
# tools which include the Assimp headers. # tools which include the Assimp headers.
SET ( ENABLE_BOOST_WORKAROUND OFF CACHE BOOL SET ( ENABLE_BOOST_WORKAROUND OFF CACHE BOOL

View File

@ -544,6 +544,65 @@ else (UNZIP_FOUND)
SET (unzip_compile_SRCS ${unzip_SRCS}) SET (unzip_compile_SRCS ${unzip_SRCS})
endif (UNZIP_FOUND) 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 ADD_LIBRARY( assimp SHARED
# Assimp Files # Assimp Files
${Core_SRCS} ${Core_SRCS}
@ -601,6 +660,7 @@ ADD_LIBRARY( assimp SHARED
${PUBLIC_HEADERS} ${PUBLIC_HEADERS}
${COMPILER_HEADERS} ${COMPILER_HEADERS}
) )
ENDIF ( BUILD_STATIC_LIB )
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES( assimp PROPERTIES SET_TARGET_PROPERTIES( assimp PROPERTIES