2015-04-20 22:36:47 +00:00
|
|
|
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
|
2015-01-03 00:09:33 +00:00
|
|
|
cmake_minimum_required( VERSION 2.8 )
|
2010-03-03 22:07:59 +00:00
|
|
|
PROJECT( Assimp )
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2015-04-12 16:16:49 +00:00
|
|
|
option(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
|
2015-04-07 06:20:27 +00:00
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
2015-05-19 03:44:54 +00:00
|
|
|
#set(CMAKE_EXE_LINKER_FLAGS "-static")
|
|
|
|
set(LINK_SEARCH_START_STATIC TRUE)
|
2015-04-07 06:20:27 +00:00
|
|
|
endif(NOT BUILD_SHARED_LIBS)
|
|
|
|
|
2011-05-09 19:34:21 +00:00
|
|
|
# Define here the needed parameters
|
2012-07-11 12:53:04 +00:00
|
|
|
set (ASSIMP_VERSION_MAJOR 3)
|
2015-11-03 18:47:37 +00:00
|
|
|
set (ASSIMP_VERSION_MINOR 2)
|
|
|
|
set (ASSIMP_VERSION_PATCH 0) # subversion revision?
|
2011-05-09 19:34:21 +00:00
|
|
|
set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
|
2012-07-11 12:53:04 +00:00
|
|
|
set (ASSIMP_SOVERSION 3)
|
2014-05-19 12:36:24 +00:00
|
|
|
set (PROJECT_VERSION "${ASSIMP_VERSION}")
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
set(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources")
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2015-06-23 19:28:13 +00:00
|
|
|
# Needed for openddl_parser config, no use of c++11 at this moment
|
2015-02-07 17:26:57 +00:00
|
|
|
add_definitions( -DOPENDDL_NO_USE_CPP11 )
|
2016-03-31 09:11:55 +00:00
|
|
|
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
|
2015-02-07 17:26:57 +00:00
|
|
|
|
2014-05-19 12:36:24 +00:00
|
|
|
# Get the current working branch
|
|
|
|
execute_process(
|
2015-05-19 03:44:54 +00:00
|
|
|
COMMAND git rev-parse --abbrev-ref HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-09-02 08:04:28 +00:00
|
|
|
ERROR_QUIET
|
2014-05-19 12:36:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Get the latest abbreviated commit hash of the working branch
|
|
|
|
execute_process(
|
2015-05-19 03:44:54 +00:00
|
|
|
COMMAND git log -1 --format=%h
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
2015-09-02 08:04:28 +00:00
|
|
|
ERROR_QUIET
|
2014-05-19 12:36:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT GIT_COMMIT_HASH)
|
2015-05-19 03:44:54 +00:00
|
|
|
set(GIT_COMMIT_HASH 0)
|
2014-05-19 12:36:24 +00:00
|
|
|
endif(NOT GIT_COMMIT_HASH)
|
|
|
|
|
|
|
|
configure_file(
|
2015-05-19 03:44:54 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
2014-05-19 12:36:24 +00:00
|
|
|
)
|
|
|
|
|
2014-06-17 09:50:29 +00:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2014-05-19 12:36:24 +00:00
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
option(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
|
2013-11-09 20:17:12 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
|
|
|
|
set(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" )
|
|
|
|
set(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev" )
|
2012-07-11 12:53:04 +00:00
|
|
|
set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
|
2013-03-18 12:11:49 +00:00
|
|
|
set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2014-10-07 14:23:56 +00:00
|
|
|
option(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF)
|
|
|
|
|
2015-01-02 14:34:23 +00:00
|
|
|
# Workaround to be able to deal with compiler bug "Too many sections" with mingw.
|
2015-01-23 18:10:36 +00:00
|
|
|
if( CMAKE_COMPILER_IS_MINGW )
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER )
|
2015-01-02 14:34:23 +00:00
|
|
|
endif()
|
|
|
|
|
2013-11-07 14:08:27 +00:00
|
|
|
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
|
2015-09-02 07:56:58 +00:00
|
|
|
if (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
endif()
|
2015-05-19 03:44:54 +00:00
|
|
|
# hide all not-exported symbols
|
2016-03-31 09:26:38 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" )
|
2013-04-21 13:03:16 +00:00
|
|
|
elseif(MSVC)
|
2015-05-19 03:44:54 +00:00
|
|
|
# enable multi-core compilation with MSVC
|
2016-03-14 22:14:31 +00:00
|
|
|
add_compile_options(/MP)
|
2016-03-31 09:26:38 +00:00
|
|
|
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
2016-04-20 22:02:28 +00:00
|
|
|
ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
|
|
|
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wno-long-long -pedantic -std=c++11" )
|
2015-01-02 11:38:06 +00:00
|
|
|
endif()
|
2009-04-18 00:10:16 +00:00
|
|
|
|
2011-05-30 14:13:33 +00:00
|
|
|
INCLUDE (FindPkgConfig)
|
2010-03-03 21:46:56 +00:00
|
|
|
INCLUDE_DIRECTORIES( include )
|
2009-04-18 00:10:16 +00:00
|
|
|
|
2013-04-20 21:15:59 +00:00
|
|
|
INCLUDE (PrecompiledHeader)
|
|
|
|
|
2010-03-03 22:55:02 +00:00
|
|
|
# If this is an in-source build (CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR),
|
|
|
|
# write the library/executable files to the respective directories in the
|
|
|
|
# source tree. During an out-of-source build, however, do not litter this
|
|
|
|
# directory, since that is probably what the user wanted to avoid.
|
|
|
|
IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
|
2015-05-19 03:44:54 +00:00
|
|
|
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" )
|
2010-03-03 22:55:02 +00:00
|
|
|
ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
|
2010-02-27 12:00:00 +00:00
|
|
|
|
2010-03-03 21:48:23 +00:00
|
|
|
# Cache these to allow the user to override them manually.
|
2012-07-17 22:56:15 +00:00
|
|
|
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE PATH
|
2015-05-19 03:44:54 +00:00
|
|
|
"Path the built library files are installed to." )
|
2012-07-17 22:56:15 +00:00
|
|
|
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH
|
2015-05-19 03:44:54 +00:00
|
|
|
"Path the header files are installed to." )
|
2012-07-17 22:56:15 +00:00
|
|
|
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
|
2015-05-19 03:44:54 +00:00
|
|
|
"Path the tool executables are installed to." )
|
2009-04-18 00:10:16 +00:00
|
|
|
|
2016-02-22 20:24:03 +00:00
|
|
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2015-08-08 15:30:15 +00:00
|
|
|
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Debug Postfix for lib, samples and tools")
|
2016-02-22 20:24:03 +00:00
|
|
|
ELSE()
|
|
|
|
SET(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Debug Postfix for lib, samples and tools")
|
2015-08-08 15:30:15 +00:00
|
|
|
ENDIF()
|
2012-07-17 22:56:15 +00:00
|
|
|
|
2013-11-26 18:43:17 +00:00
|
|
|
# Only generate this target if no higher-level project already has
|
|
|
|
IF (NOT TARGET uninstall)
|
2015-05-19 03:44:54 +00:00
|
|
|
# add make uninstall capability
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
|
|
|
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
2013-11-26 18:43:17 +00:00
|
|
|
ENDIF()
|
2012-06-05 19:30:45 +00:00
|
|
|
|
2010-08-25 16:46:21 +00:00
|
|
|
|
2010-08-23 11:43:15 +00:00
|
|
|
|
2014-04-23 12:12:10 +00:00
|
|
|
# cmake configuration files
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
2010-09-27 08:31:09 +00:00
|
|
|
|
2015-07-04 20:08:26 +00:00
|
|
|
FIND_PACKAGE( DirectX )
|
|
|
|
|
2014-08-17 21:10:06 +00:00
|
|
|
option ( ASSIMP_NO_EXPORT
|
2015-05-19 03:44:54 +00:00
|
|
|
"Disable Assimp's export functionality."
|
|
|
|
OFF
|
2011-04-03 11:21:34 +00:00
|
|
|
)
|
|
|
|
|
2014-10-15 05:28:14 +00:00
|
|
|
if( CMAKE_COMPILER_IS_GNUCXX )
|
|
|
|
set(LIBSTDC++_LIBRARIES -lstdc++)
|
|
|
|
endif( CMAKE_COMPILER_IS_GNUCXX )
|
|
|
|
|
2011-05-30 14:13:33 +00:00
|
|
|
# Search for external dependencies, and build them from source if not found
|
|
|
|
# Search for zlib
|
2011-05-09 19:34:21 +00:00
|
|
|
find_package(ZLIB)
|
|
|
|
if( NOT ZLIB_FOUND )
|
2015-05-19 03:44:54 +00:00
|
|
|
message(STATUS "compiling zlib from souces")
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
include(CheckTypeSize)
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
# compile from sources
|
|
|
|
add_subdirectory(contrib/zlib)
|
|
|
|
set(ZLIB_FOUND 1)
|
|
|
|
set(ZLIB_LIBRARIES zlibstatic)
|
|
|
|
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/zlib ${CMAKE_CURRENT_BINARY_DIR}/contrib/zlib)
|
2011-05-30 14:13:33 +00:00
|
|
|
else(NOT ZLIB_FOUND)
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
|
|
|
set(ZLIB_LIBRARIES_LINKED -lz)
|
2011-05-30 14:13:33 +00:00
|
|
|
endif(NOT ZLIB_FOUND)
|
2011-05-09 19:34:21 +00:00
|
|
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
|
|
|
|
2011-05-30 14:13:33 +00:00
|
|
|
# Search for unzip
|
|
|
|
if (PKG_CONFIG_FOUND)
|
2015-05-19 03:44:54 +00:00
|
|
|
PKG_CHECK_MODULES(UNZIP minizip)
|
2011-05-30 14:13:33 +00:00
|
|
|
endif (PKG_CONFIG_FOUND)
|
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
IF ( ASSIMP_NO_EXPORT )
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_EXPORT)
|
|
|
|
MESSAGE( STATUS "Build an import-only version of Assimp." )
|
2012-07-17 22:56:15 +00:00
|
|
|
ENDIF( ASSIMP_NO_EXPORT )
|
2011-08-22 20:22:51 +00:00
|
|
|
|
2015-01-23 18:10:36 +00:00
|
|
|
SET ( ASSIMP_BUILD_ARCHITECTURE "" CACHE STRING
|
2015-05-19 03:44:54 +00:00
|
|
|
"describe the current architecture."
|
2011-09-28 09:04:49 +00:00
|
|
|
)
|
|
|
|
IF ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "")
|
|
|
|
ELSE ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "")
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS ( -D'ASSIMP_BUILD_ARCHITECTURE="${ASSIMP_BUILD_ARCHITECTURE}"' )
|
2011-09-28 09:04:49 +00:00
|
|
|
ENDIF ( ASSIMP_BUILD_ARCHITECTURE STREQUAL "")
|
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
# ${CMAKE_GENERATOR}
|
2015-01-23 18:10:36 +00:00
|
|
|
SET ( ASSIMP_BUILD_COMPILER "" CACHE STRING
|
2015-05-19 03:44:54 +00:00
|
|
|
"describe the current compiler."
|
2011-09-28 09:04:49 +00:00
|
|
|
)
|
|
|
|
IF ( ASSIMP_BUILD_COMPILER STREQUAL "")
|
|
|
|
ELSE ( ASSIMP_BUILD_COMPILER STREQUAL "")
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS ( -D'ASSIMP_BUILD_COMPILER="${ASSIMP_BUILD_COMPILER}"' )
|
2011-09-28 09:04:49 +00:00
|
|
|
ENDIF ( ASSIMP_BUILD_COMPILER STREQUAL "")
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED ( ASSIMP_BUILD_ARCHITECTURE ASSIMP_BUILD_COMPILER )
|
|
|
|
|
2015-02-23 13:23:28 +00:00
|
|
|
|
|
|
|
SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
|
2016-04-06 08:29:41 +00:00
|
|
|
"Build the C4D importer, which relies on the non-free Melange SDK."
|
2015-02-23 13:23:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
2015-05-19 03:44:54 +00:00
|
|
|
IF ( MSVC )
|
|
|
|
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/includes")
|
|
|
|
|
|
|
|
# pick the correct prebuilt library
|
|
|
|
IF(MSVC11)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2012md")
|
|
|
|
ELSEIF(MSVC10)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2010md")
|
|
|
|
ELSEIF(MSVC90)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2008md")
|
|
|
|
ELSE()
|
2016-04-06 08:29:41 +00:00
|
|
|
MESSAGE( FATAL_ERROR
|
2015-05-19 03:44:54 +00:00
|
|
|
"C4D is currently only supported with MSVC 9, 10, 11"
|
|
|
|
)
|
|
|
|
ENDIF()
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2015-05-19 03:44:54 +00:00
|
|
|
IF(CMAKE_CL_64)
|
|
|
|
SET(C4D_LIB_ARCH_POSTFIX "_x64")
|
|
|
|
ELSE()
|
|
|
|
SET(C4D_LIB_ARCH_POSTFIX "")
|
|
|
|
ENDIF()
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2015-05-19 03:44:54 +00:00
|
|
|
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/lib/WIN")
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2015-05-19 03:44:54 +00:00
|
|
|
SET(C4D_DEBUG_LIBRARY "${C4D_LIB_BASE_PATH}/debug/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
|
|
|
|
SET(C4D_RELEASE_LIBRARY "${C4D_LIB_BASE_PATH}/release/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2015-05-19 03:44:54 +00:00
|
|
|
# winsock and winmm are necessary dependencies of melange (this is undocumented, but true.)
|
|
|
|
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
|
|
|
|
ELSE ()
|
2016-04-06 08:29:41 +00:00
|
|
|
MESSAGE( FATAL_ERROR
|
2015-05-19 03:44:54 +00:00
|
|
|
"C4D is currently only available on Windows with melange SDK installed in contrib/Melange"
|
|
|
|
)
|
|
|
|
ENDIF ( MSVC )
|
2015-02-23 13:23:28 +00:00
|
|
|
else (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
2015-02-23 13:23:28 +00:00
|
|
|
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-03 21:46:56 +00:00
|
|
|
ADD_SUBDIRECTORY( code/ )
|
2014-08-17 21:10:06 +00:00
|
|
|
option ( ASSIMP_BUILD_ASSIMP_TOOLS
|
2015-05-19 03:44:54 +00:00
|
|
|
"If the supplementary tools for Assimp are built in addition to the library."
|
|
|
|
ON
|
2010-09-27 08:31:09 +00:00
|
|
|
)
|
2012-07-17 22:56:15 +00:00
|
|
|
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
2015-07-04 20:08:26 +00:00
|
|
|
IF ( WIN32 AND DirectX_FOUND )
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
2015-07-04 20:08:26 +00:00
|
|
|
ENDIF ( WIN32 AND DirectX_FOUND )
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
2012-07-17 22:56:15 +00:00
|
|
|
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
2010-09-27 08:31:09 +00:00
|
|
|
|
2014-08-17 21:10:06 +00:00
|
|
|
option ( ASSIMP_BUILD_SAMPLES
|
2015-05-19 03:44:54 +00:00
|
|
|
"If the official samples are built as well (needs Glut)."
|
|
|
|
OFF
|
2012-03-21 02:19:18 +00:00
|
|
|
)
|
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
IF ( ASSIMP_BUILD_SAMPLES)
|
2015-05-19 03:44:54 +00:00
|
|
|
IF ( WIN32 )
|
|
|
|
ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
|
|
|
|
ENDIF ( WIN32 )
|
|
|
|
ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
|
2012-07-17 22:56:15 +00:00
|
|
|
ENDIF ( ASSIMP_BUILD_SAMPLES )
|
|
|
|
|
2014-08-17 22:34:45 +00:00
|
|
|
option ( ASSIMP_BUILD_TESTS
|
2015-05-19 03:44:54 +00:00
|
|
|
"If the test suite for Assimp is built in addition to the library."
|
|
|
|
ON
|
2014-08-17 22:34:45 +00:00
|
|
|
)
|
2015-01-23 18:10:36 +00:00
|
|
|
|
2014-08-17 22:34:45 +00:00
|
|
|
IF ( ASSIMP_BUILD_TESTS )
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_SUBDIRECTORY( test/ )
|
2014-08-17 22:34:45 +00:00
|
|
|
ENDIF ( ASSIMP_BUILD_TESTS )
|
2012-07-17 22:56:15 +00:00
|
|
|
|
|
|
|
IF(MSVC)
|
2015-05-19 03:44:54 +00:00
|
|
|
option ( ASSIMP_INSTALL_PDB
|
|
|
|
"Install MSVC debug files."
|
|
|
|
ON
|
|
|
|
)
|
2012-07-17 22:56:15 +00:00
|
|
|
ENDIF(MSVC)
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2014-10-15 05:28:14 +00:00
|
|
|
# Generate a pkg-config .pc for the Assimp library.
|
|
|
|
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
|
|
|
|
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
if(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
2015-05-19 03:44:54 +00:00
|
|
|
# Packing information
|
|
|
|
set(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}")
|
|
|
|
set(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
|
2016-04-05 14:30:56 +00:00
|
|
|
set(CPACK_PACKAGE_VENDOR "https://github.com/assimp")
|
2015-05-19 03:44:54 +00:00
|
|
|
set(CPACK_PACKAGE_DISPLAY_NAME "Assimp ${ASSIMP_VERSION}")
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Open Asset Import Library ${ASSIMP_VERSION}")
|
|
|
|
set(CPACK_PACKAGE_VERSION "${ASSIMP_VERSION}.${ASSIMP_PACKAGE_VERSION}" )
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "${ASSIMP_VERSION_MAJOR}")
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "${ASSIMP_VERSION_MINOR}")
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "${ASSIMP_VERSION_PATCH}")
|
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "assimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
|
|
|
|
string(TOUPPER ${LIBASSIMP_COMPONENT} "LIBASSIMP_COMPONENT_UPPER")
|
|
|
|
string(TOUPPER ${LIBASSIMP-DEV_COMPONENT} "LIBASSIMP-DEV_COMPONENT_UPPER")
|
|
|
|
|
|
|
|
set(CPACK_COMPONENT_ASSIMP-BIN_DISPLAY_NAME "tools")
|
|
|
|
set(CPACK_COMPONENT_ASSIMP-BIN_DEPENDS "${LIBASSIMP_COMPONENT}" )
|
|
|
|
set(CPACK_COMPONENT_${LIBASSIMP_COMPONENT_UPPER}_DISPLAY_NAME "libraries")
|
|
|
|
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs")
|
|
|
|
set(CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT_UPPER}_DEPENDS $ "{LIBASSIMP_COMPONENT}" )
|
|
|
|
set(CPACK_COMPONENT_ASSIMP-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBASSIMP-DEV_COMPONENT}_DISPLAY_NAME}" )
|
|
|
|
set(CPACK_COMPONENT_ASSIMP-DEV_DEPENDS "${LIBASSIMP-DEV_COMPONENT}" )
|
2016-04-06 08:29:41 +00:00
|
|
|
set(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config)
|
2015-05-19 03:44:54 +00:00
|
|
|
|
|
|
|
# debian
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
|
|
|
set(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_ASSIMP_SAMPLES:BOOL=${ASSIMP_BUILD_SAMPLES}")
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SUGGESTS)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_NAME "assimp")
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/cppunit-1.12.1 contrib/cppunit_note.txt contrib/zlib workspaces test doc obj samples packaging)
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
|
|
|
|
set(CPACK_DEBIAN_CHANGELOG)
|
|
|
|
execute_process(COMMAND lsb_release -is
|
|
|
|
OUTPUT_VARIABLE _lsb_distribution OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
RESULT_VARIABLE _lsb_release_failed)
|
|
|
|
set(CPACK_DEBIAN_DISTRIBUTION_NAME ${_lsb_distribution} CACHE STRING "Name of the distrubiton")
|
|
|
|
string(TOLOWER ${CPACK_DEBIAN_DISTRIBUTION_NAME} CPACK_DEBIAN_DISTRIBUTION_NAME)
|
|
|
|
if( ${CPACK_DEBIAN_DISTRIBUTION_NAME} STREQUAL "ubuntu" )
|
|
|
|
set(CPACK_DEBIAN_DISTRIBUTION_RELEASES lucid maverick natty oneiric precise CACHE STRING "Release code-names of the distrubiton release")
|
|
|
|
endif()
|
|
|
|
set(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources")
|
|
|
|
include(CPack)
|
|
|
|
include(DebSourcePPA)
|
2011-05-09 19:34:21 +00:00
|
|
|
endif()
|
2015-12-10 16:15:27 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
2015-12-11 09:33:47 +00:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
|
|
|
|
set(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
|
|
|
|
elseif()
|
|
|
|
set(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/")
|
|
|
|
set(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/")
|
|
|
|
endif()
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2015-12-11 09:33:47 +00:00
|
|
|
if(MSVC12)
|
|
|
|
set(ASSIMP_MSVC_VERSION "vc120")
|
2016-04-06 08:29:41 +00:00
|
|
|
elseif(MSVC14)
|
2015-12-11 09:33:47 +00:00
|
|
|
set(ASSIMP_MSVC_VERSION "vc140")
|
|
|
|
endif(MSVC12)
|
|
|
|
|
|
|
|
if(MSVC12 OR MSVC14)
|
2016-04-06 08:29:41 +00:00
|
|
|
add_custom_target(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)
|
2015-12-11 09:33:47 +00:00
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.dll VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.exp VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mt.lib VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${BIN_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.dll VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.exp ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.exp VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.ilk VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.lib ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.lib VERBATIM)
|
|
|
|
add_custom_command(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
|
|
|
endif(MSVC12 OR MSVC14)
|
2016-03-14 22:14:31 +00:00
|
|
|
endif (WIN32)
|