Pārlūkot izejas kodu

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
mmathias01 14 gadi atpakaļ
vecāks
revīzija
2c0b36bc45
2 mainītis faili ar 66 papildinājumiem un 0 dzēšanām
  1. 6 0
      CMakeLists.txt
  2. 60 0
      code/CMakeLists.txt

+ 6 - 0
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

+ 60 - 0
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