2016-04-23 07:42:05 +00:00
|
|
|
# Open Asset Import Library (assimp)
|
|
|
|
# ----------------------------------------------------------------------
|
2024-02-23 21:30:05 +00:00
|
|
|
# Copyright (c) 2006-2024, assimp team
|
2019-06-10 21:26:00 +00:00
|
|
|
#
|
2016-04-23 07:42:05 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this software in source and binary forms,
|
|
|
|
# with or without modification, are permitted provided that the
|
|
|
|
# following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above
|
|
|
|
# copyright notice, this list of conditions and the
|
|
|
|
# following disclaimer.
|
|
|
|
#
|
|
|
|
# * Redistributions in binary form must reproduce the above
|
|
|
|
# copyright notice, this list of conditions and the
|
|
|
|
# following disclaimer in the documentation and/or other
|
|
|
|
# materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# * Neither the name of the assimp team, nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior
|
|
|
|
# written permission of the assimp team.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#----------------------------------------------------------------------
|
2020-12-23 15:44:37 +00:00
|
|
|
SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
|
2019-05-24 21:34:25 +00:00
|
|
|
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
2020-07-17 11:06:52 +00:00
|
|
|
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2024-04-07 21:14:12 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED( VERSION 3.22 )
|
2019-05-24 16:44:47 +00:00
|
|
|
|
2024-04-07 21:14:12 +00:00
|
|
|
# Disabled importers: m3d for 5.1 or later
|
2021-11-13 07:16:34 +00:00
|
|
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_IMPORTER)
|
|
|
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_M3D_EXPORTER)
|
2019-05-24 16:44:47 +00:00
|
|
|
# Toggles the use of the hunter package manager
|
2020-03-23 16:35:32 +00:00
|
|
|
option(ASSIMP_HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
2019-05-24 16:44:47 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(ASSIMP_HUNTER_ENABLED)
|
2021-08-20 18:42:02 +00:00
|
|
|
include("cmake-modules/HunterGate.cmake")
|
2020-02-09 18:31:06 +00:00
|
|
|
HunterGate(
|
2024-04-07 14:49:55 +00:00
|
|
|
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
|
|
|
|
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
|
2020-02-09 18:31:06 +00:00
|
|
|
)
|
2019-05-24 20:37:09 +00:00
|
|
|
add_definitions(-DASSIMP_USE_HUNTER)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2019-05-24 20:37:09 +00:00
|
|
|
|
2024-04-07 21:14:12 +00:00
|
|
|
PROJECT(Assimp VERSION 5.4.0)
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2016-08-13 07:13:22 +00:00
|
|
|
# All supported options ###############################################
|
2018-03-20 11:46:03 +00:00
|
|
|
|
2016-10-21 10:50:41 +00:00
|
|
|
OPTION( BUILD_SHARED_LIBS
|
|
|
|
"Build package with shared libraries."
|
2016-08-13 07:13:22 +00:00
|
|
|
ON
|
|
|
|
)
|
2020-03-23 16:35:32 +00:00
|
|
|
OPTION( ASSIMP_BUILD_FRAMEWORK
|
2017-11-19 22:10:05 +00:00
|
|
|
"Build package as Mac OS X Framework bundle."
|
|
|
|
OFF
|
|
|
|
)
|
2016-08-13 07:13:22 +00:00
|
|
|
OPTION( ASSIMP_DOUBLE_PRECISION
|
|
|
|
"Set to ON to enable double precision processing"
|
|
|
|
OFF
|
|
|
|
)
|
2016-10-21 10:50:41 +00:00
|
|
|
OPTION( ASSIMP_OPT_BUILD_PACKAGES
|
|
|
|
"Set to ON to generate CPack configuration files and packaging targets"
|
2016-08-13 07:13:22 +00:00
|
|
|
OFF
|
|
|
|
)
|
2016-10-21 10:50:41 +00:00
|
|
|
OPTION( ASSIMP_ANDROID_JNIIOSYSTEM
|
|
|
|
"Android JNI IOSystem support is active"
|
2016-08-13 07:13:22 +00:00
|
|
|
OFF
|
|
|
|
)
|
|
|
|
OPTION( ASSIMP_NO_EXPORT
|
|
|
|
"Disable Assimp's export functionality."
|
|
|
|
OFF
|
|
|
|
)
|
2017-07-31 12:25:00 +00:00
|
|
|
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
2016-08-13 07:13:22 +00:00
|
|
|
"If the supplementary tools for Assimp are built in addition to the library."
|
2022-06-29 09:15:29 +00:00
|
|
|
OFF
|
2016-08-13 07:13:22 +00:00
|
|
|
)
|
2017-07-31 12:25:00 +00:00
|
|
|
OPTION ( ASSIMP_BUILD_SAMPLES
|
2016-08-13 07:13:22 +00:00
|
|
|
"If the official samples are built as well (needs Glut)."
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
OPTION ( ASSIMP_BUILD_TESTS
|
|
|
|
"If the test suite for Assimp is built in addition to the library."
|
|
|
|
ON
|
|
|
|
)
|
2016-11-16 11:24:55 +00:00
|
|
|
OPTION ( ASSIMP_COVERALLS
|
2017-07-31 12:25:00 +00:00
|
|
|
"Enable this to measure test coverage."
|
|
|
|
OFF
|
2016-11-16 11:24:55 +00:00
|
|
|
)
|
2020-01-28 18:37:38 +00:00
|
|
|
OPTION( ASSIMP_INSTALL
|
2020-03-23 16:35:32 +00:00
|
|
|
"Disable this if you want to use assimp as a submodule."
|
2020-01-28 18:37:38 +00:00
|
|
|
ON
|
|
|
|
)
|
2022-04-30 15:08:34 +00:00
|
|
|
OPTION ( ASSIMP_WARNINGS_AS_ERRORS
|
|
|
|
"Treat all warnings as errors."
|
2022-05-03 19:31:09 +00:00
|
|
|
ON
|
2022-04-30 15:08:34 +00:00
|
|
|
)
|
2017-09-12 15:57:44 +00:00
|
|
|
OPTION ( ASSIMP_ASAN
|
|
|
|
"Enable AddressSanitizer."
|
|
|
|
OFF
|
|
|
|
)
|
2017-10-07 14:13:08 +00:00
|
|
|
OPTION ( ASSIMP_UBSAN
|
|
|
|
"Enable Undefined Behavior sanitizer."
|
|
|
|
OFF
|
|
|
|
)
|
2020-03-23 16:35:32 +00:00
|
|
|
OPTION ( ASSIMP_BUILD_DOCS
|
2017-07-31 12:25:00 +00:00
|
|
|
"Build documentation using Doxygen."
|
|
|
|
OFF
|
2017-04-18 12:51:17 +00:00
|
|
|
)
|
2020-03-23 16:35:32 +00:00
|
|
|
OPTION( ASSIMP_INJECT_DEBUG_POSTFIX
|
2019-04-17 08:32:24 +00:00
|
|
|
"Inject debug postfix in .a/.so/.dll lib names"
|
2018-08-07 19:22:54 +00:00
|
|
|
ON
|
|
|
|
)
|
2017-04-18 12:51:17 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
OPTION ( ASSIMP_IGNORE_GIT_HASH
|
2018-09-08 19:46:06 +00:00
|
|
|
"Don't call git to get the hash."
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
|
2023-02-18 16:09:14 +00:00
|
|
|
IF (WIN32)
|
|
|
|
OPTION( ASSIMP_BUILD_ZLIB
|
2024-04-07 21:14:12 +00:00
|
|
|
"Build your zlib"
|
2023-02-18 16:09:14 +00:00
|
|
|
ON
|
|
|
|
)
|
|
|
|
ELSE()
|
|
|
|
OPTION( ASSIMP_BUILD_ZLIB
|
2024-04-07 21:14:12 +00:00
|
|
|
"Build your zlib"
|
2023-12-29 16:31:11 +00:00
|
|
|
OFF
|
2023-02-18 16:09:14 +00:00
|
|
|
)
|
|
|
|
ENDIF()
|
|
|
|
|
2022-02-21 14:17:23 +00:00
|
|
|
IF (WIN32)
|
2024-04-07 21:14:12 +00:00
|
|
|
# Use a subset of Windows.h
|
2021-01-18 07:39:39 +00:00
|
|
|
ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN )
|
|
|
|
|
|
|
|
IF(MSVC)
|
|
|
|
OPTION( ASSIMP_INSTALL_PDB
|
|
|
|
"Install MSVC debug files."
|
|
|
|
ON )
|
|
|
|
IF(NOT (MSVC_VERSION LESS 1900))
|
2024-04-07 21:14:12 +00:00
|
|
|
# Multibyte character set has been deprecated since at least MSVC2015 (possibly earlier)
|
2021-01-18 07:39:39 +00:00
|
|
|
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
|
|
|
|
ENDIF()
|
2022-04-30 15:40:48 +00:00
|
|
|
|
2024-04-07 21:14:12 +00:00
|
|
|
# Link statically against c/c++ lib to avoid missing redistributable such as
|
2022-03-15 06:46:30 +00:00
|
|
|
# "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users
|
|
|
|
# a choice to opt for the shared runtime if they want.
|
|
|
|
option(USE_STATIC_CRT "Link against the static runtime libraries." OFF)
|
2022-04-30 15:40:48 +00:00
|
|
|
|
2024-04-07 21:14:12 +00:00
|
|
|
# The CMAKE_CXX_FLAGS vars can be overridden by some Visual Studio generators, so we use an alternative
|
2022-03-15 06:46:30 +00:00
|
|
|
# global method here:
|
|
|
|
if (${USE_STATIC_CRT})
|
|
|
|
add_compile_options(
|
|
|
|
$<$<CONFIG:>:/MT>
|
|
|
|
$<$<CONFIG:Debug>:/MTd>
|
|
|
|
$<$<CONFIG:Release>:/MT>
|
|
|
|
)
|
|
|
|
endif()
|
2021-01-18 07:39:39 +00:00
|
|
|
ENDIF()
|
2020-05-02 19:08:24 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF (IOS AND NOT ASSIMP_HUNTER_ENABLED)
|
2018-08-31 17:29:17 +00:00
|
|
|
IF (NOT CMAKE_BUILD_TYPE)
|
|
|
|
SET(CMAKE_BUILD_TYPE "Release")
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2018-12-20 14:51:01 +00:00
|
|
|
ADD_DEFINITIONS(-DENABLE_BITCODE)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2018-07-01 11:48:20 +00:00
|
|
|
|
2016-08-13 07:13:22 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF (ASSIMP_BUILD_FRAMEWORK)
|
2017-11-19 22:10:05 +00:00
|
|
|
SET (BUILD_SHARED_LIBS ON)
|
|
|
|
MESSAGE(STATUS "Framework bundle building enabled")
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2017-11-19 22:10:05 +00:00
|
|
|
|
2016-04-23 07:42:05 +00:00
|
|
|
IF(NOT BUILD_SHARED_LIBS)
|
2017-10-07 11:59:12 +00:00
|
|
|
MESSAGE(STATUS "Shared libraries disabled")
|
2016-04-23 07:42:05 +00:00
|
|
|
SET(LINK_SEARCH_START_STATIC TRUE)
|
2022-04-07 10:07:57 +00:00
|
|
|
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
2017-10-07 11:59:12 +00:00
|
|
|
ELSE()
|
|
|
|
MESSAGE(STATUS "Shared libraries enabled")
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2015-04-07 06:20:27 +00:00
|
|
|
|
2011-05-09 19:34:21 +00:00
|
|
|
# Define here the needed parameters
|
2019-05-24 21:34:25 +00:00
|
|
|
SET (ASSIMP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|
|
|
SET (ASSIMP_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
|
|
|
SET (ASSIMP_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
2016-04-23 07:42:05 +00:00
|
|
|
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
|
2019-05-24 21:34:25 +00:00
|
|
|
SET (ASSIMP_SOVERSION 5)
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2017-07-31 12:25:00 +00:00
|
|
|
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
|
2023-09-09 17:29:15 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
2015-02-07 17:26:57 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(NOT ASSIMP_IGNORE_GIT_HASH)
|
2018-09-08 19:46:06 +00:00
|
|
|
# Get the current working branch
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND git rev-parse --abbrev-ref HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
2014-05-19 12:36:24 +00:00
|
|
|
|
2018-09-08 19:46:06 +00:00
|
|
|
# Get the latest abbreviated commit hash of the working branch
|
|
|
|
EXECUTE_PROCESS(
|
2018-11-22 11:46:02 +00:00
|
|
|
COMMAND git rev-parse --short=8 HEAD
|
2018-09-08 19:46:06 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET
|
|
|
|
)
|
|
|
|
ENDIF()
|
2014-05-19 12:36:24 +00:00
|
|
|
|
2016-04-23 07:42:05 +00:00
|
|
|
IF(NOT GIT_COMMIT_HASH)
|
2018-03-31 17:12:53 +00:00
|
|
|
SET(GIT_COMMIT_HASH 0)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2014-05-19 12:36:24 +00:00
|
|
|
|
2016-07-15 03:20:16 +00:00
|
|
|
IF(ASSIMP_DOUBLE_PRECISION)
|
2020-10-05 16:53:42 +00:00
|
|
|
ADD_DEFINITIONS(-DASSIMP_DOUBLE_PRECISION)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2016-07-15 03:20:16 +00:00
|
|
|
|
2019-03-01 17:38:59 +00:00
|
|
|
INCLUDE_DIRECTORIES( BEFORE
|
2018-03-31 17:12:53 +00:00
|
|
|
./
|
2019-06-10 21:26:00 +00:00
|
|
|
code/
|
2018-03-31 17:12:53 +00:00
|
|
|
include
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include
|
2016-06-10 23:14:25 +00:00
|
|
|
)
|
2014-05-19 12:36:24 +00:00
|
|
|
|
2017-06-10 18:12:12 +00:00
|
|
|
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
|
2016-04-23 07:42:05 +00:00
|
|
|
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" )
|
|
|
|
SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
|
|
|
|
SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
2011-05-09 19:34:21 +00:00
|
|
|
|
2016-08-14 10:23:16 +00:00
|
|
|
IF( UNIX )
|
2017-04-25 12:35:07 +00:00
|
|
|
# Use GNUInstallDirs for Unix predefined directories
|
2017-07-31 12:25:00 +00:00
|
|
|
INCLUDE(GNUInstallDirs)
|
2024-04-07 21:14:12 +00:00
|
|
|
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit Linux
|
2023-09-09 17:29:15 +00:00
|
|
|
IF(NOT ${OPERATING_SYSTEM} MATCHES "Android")
|
2024-04-07 21:14:12 +00:00
|
|
|
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit Linux
|
2022-02-20 13:06:11 +00:00
|
|
|
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
|
2022-02-20 10:53:26 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2017-04-18 12:51:17 +00:00
|
|
|
|
2020-03-31 20:01:04 +00:00
|
|
|
# Grouped compiler settings ########################################
|
2023-09-27 12:44:05 +00:00
|
|
|
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW AND NOT HAIKU)
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(NOT ASSIMP_HUNTER_ENABLED)
|
2020-04-28 05:39:13 +00:00
|
|
|
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2019-05-24 16:57:23 +00:00
|
|
|
ENDIF()
|
2023-06-29 07:02:39 +00:00
|
|
|
|
|
|
|
IF(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13)
|
|
|
|
MESSAGE(STATUS "GCC13 detected disabling \"-Wdangling-reference\" in Cpp files as it appears to be a false positive")
|
|
|
|
ADD_COMPILE_OPTIONS("$<$<COMPILE_LANGUAGE:CXX>:-Wno-dangling-reference>")
|
|
|
|
ENDIF()
|
2015-05-19 03:44:54 +00:00
|
|
|
# hide all not-exported symbols
|
2020-12-04 08:47:43 +00:00
|
|
|
IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" )
|
2023-01-20 18:45:45 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
|
|
|
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
|
|
|
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
2020-12-04 08:47:43 +00:00
|
|
|
ELSE()
|
2023-01-20 18:45:45 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
|
|
|
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
|
|
|
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
2020-12-04 08:47:43 +00:00
|
|
|
ENDIF()
|
2016-04-23 07:42:05 +00:00
|
|
|
ELSEIF(MSVC)
|
2015-05-19 03:44:54 +00:00
|
|
|
# enable multi-core compilation with MSVC
|
2021-01-06 14:10:50 +00:00
|
|
|
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl
|
2023-07-15 13:54:15 +00:00
|
|
|
ADD_COMPILE_OPTIONS(/bigobj)
|
2020-07-20 15:04:11 +00:00
|
|
|
ELSE() # msvc
|
2023-07-15 13:54:15 +00:00
|
|
|
ADD_COMPILE_OPTIONS(/MP /bigobj)
|
2020-07-20 15:04:11 +00:00
|
|
|
ENDIF()
|
2023-01-20 18:45:45 +00:00
|
|
|
|
2017-10-02 10:08:20 +00:00
|
|
|
# disable "elements of array '' will be default initialized" warning on MSVC2013
|
|
|
|
IF(MSVC12)
|
2021-08-31 10:59:31 +00:00
|
|
|
ADD_COMPILE_OPTIONS(/wd4351)
|
2017-10-02 10:08:20 +00:00
|
|
|
ENDIF()
|
2024-04-07 21:14:12 +00:00
|
|
|
# supress warning for double to float conversion if Double precision is activated
|
2023-01-20 18:45:45 +00:00
|
|
|
ADD_COMPILE_OPTIONS(/wd4244)
|
2019-12-18 01:51:23 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
|
2023-01-20 18:45:45 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
2021-05-04 17:10:24 +00:00
|
|
|
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
|
2021-01-06 14:10:50 +00:00
|
|
|
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(NOT ASSIMP_HUNTER_ENABLED)
|
2020-04-26 19:19:59 +00:00
|
|
|
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2019-05-24 16:57:23 +00:00
|
|
|
ENDIF()
|
2020-04-26 19:19:59 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
|
2019-05-24 16:57:23 +00:00
|
|
|
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
2021-12-28 13:59:37 +00:00
|
|
|
ELSEIF( MINGW )
|
2019-04-10 14:07:24 +00:00
|
|
|
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
2019-04-10 14:31:57 +00:00
|
|
|
message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.")
|
2019-04-10 14:07:24 +00:00
|
|
|
ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
|
2019-04-10 14:31:57 +00:00
|
|
|
message(WARNING "MinGW is old, if you experience errors, update MinGW.")
|
2019-04-10 14:07:24 +00:00
|
|
|
ENDIF()
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(NOT ASSIMP_HUNTER_ENABLED)
|
2022-08-05 19:47:58 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-std=gnu++17 ${CMAKE_CXX_FLAGS}")
|
2019-05-24 16:57:23 +00:00
|
|
|
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
|
|
|
ENDIF()
|
2022-07-08 21:42:16 +00:00
|
|
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2023-12-10 14:12:12 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -g ${CMAKE_CXX_FLAGS}")
|
2022-07-08 21:42:16 +00:00
|
|
|
ELSE()
|
2023-12-10 14:12:12 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wno-dangling-reference -Wall -Wno-long-long -Wa,-mbig-obj -O3 ${CMAKE_CXX_FLAGS}")
|
2022-07-08 21:42:16 +00:00
|
|
|
ENDIF()
|
|
|
|
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
2016-04-23 07:42:05 +00:00
|
|
|
ENDIF()
|
2009-04-18 00:10:16 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF ( IOS AND NOT ASSIMP_HUNTER_ENABLED)
|
2019-09-21 16:02:37 +00:00
|
|
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2023-09-09 17:29:15 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
2019-09-21 16:02:37 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
|
|
|
|
ELSE()
|
2023-09-09 17:29:15 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -O3")
|
2019-09-21 16:02:37 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
|
|
|
ENDIF()
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2018-06-27 10:04:49 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
IF (ASSIMP_COVERALLS)
|
|
|
|
MESSAGE(STATUS "Coveralls enabled")
|
2023-09-09 17:29:15 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
INCLUDE(Coveralls)
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
|
|
|
ENDIF()
|
2016-11-16 10:39:44 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
IF (ASSIMP_ASAN)
|
|
|
|
MESSAGE(STATUS "AddressSanitizer enabled")
|
2023-09-09 17:29:15 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
2023-09-09 17:29:15 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
2018-03-31 17:12:53 +00:00
|
|
|
ENDIF()
|
2017-09-12 15:57:44 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
IF (ASSIMP_UBSAN)
|
|
|
|
MESSAGE(STATUS "Undefined Behavior sanitizer enabled")
|
2023-09-09 17:29:15 +00:00
|
|
|
|
2020-08-03 21:12:08 +00:00
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
|
2023-09-09 17:29:15 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,shift,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,return,signed-integer-overflow,bounds,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin -fno-sanitize-recover=all")
|
2018-03-31 17:12:53 +00:00
|
|
|
ENDIF()
|
2017-10-07 14:13:08 +00:00
|
|
|
|
2017-03-02 03:12:47 +00:00
|
|
|
INCLUDE (FindPkgMacros)
|
2013-04-20 21:15:59 +00:00
|
|
|
INCLUDE (PrecompiledHeader)
|
|
|
|
|
2020-08-07 20:04:39 +00:00
|
|
|
# Set Assimp project output directory variables.
|
2022-01-11 17:36:05 +00:00
|
|
|
# Will respect top-level CMAKE_*_OUTPUT_DIRECTORY variables if any are set.
|
2022-01-12 14:04:41 +00:00
|
|
|
IF(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
2022-01-11 17:36:05 +00:00
|
|
|
SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for runtime output files")
|
|
|
|
ELSE()
|
|
|
|
SET(ASSIMP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
|
|
|
|
ENDIF()
|
|
|
|
|
2022-01-12 14:04:41 +00:00
|
|
|
IF(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
2022-01-11 17:36:05 +00:00
|
|
|
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE STRING "Path for library output files")
|
|
|
|
ELSE()
|
|
|
|
SET(ASSIMP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
|
|
|
|
ENDIF()
|
|
|
|
|
2022-01-12 14:04:41 +00:00
|
|
|
IF(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
2022-01-11 17:36:05 +00:00
|
|
|
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib" CACHE STRING "Path for library output files")
|
|
|
|
ELSE()
|
|
|
|
SET(ASSIMP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} CACHE STRING "Path for runtime output files")
|
|
|
|
ENDIF()
|
2020-08-07 20:04:39 +00:00
|
|
|
|
|
|
|
# Macro used to set the output directories of a target to the
|
|
|
|
# respective Assimp output directories.
|
|
|
|
MACRO(TARGET_USE_COMMON_OUTPUT_DIRECTORY target)
|
|
|
|
set_target_properties(${target} PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY ${ASSIMP_RUNTIME_OUTPUT_DIRECTORY}
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${ASSIMP_LIBRARY_OUTPUT_DIRECTORY}
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${ASSIMP_ARCHIVE_OUTPUT_DIRECTORY}
|
|
|
|
)
|
|
|
|
ENDMACRO()
|
2009-04-18 00:10:16 +00:00
|
|
|
|
2019-04-17 09:03:18 +00:00
|
|
|
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
|
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF (ASSIMP_INJECT_DEBUG_POSTFIX AND (is_multi_config OR 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
|
2020-05-18 07:40:12 +00:00
|
|
|
IF (NOT TARGET uninstall AND ASSIMP_INSTALL)
|
2015-05-19 03:44:54 +00:00
|
|
|
# add make uninstall capability
|
2017-07-31 12:25:00 +00:00
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
2018-03-31 17:12:53 +00:00
|
|
|
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
|
|
|
|
2020-07-14 22:40:54 +00:00
|
|
|
IF( UNIX )
|
|
|
|
# Use GNUInstallDirs for Unix predefined directories
|
|
|
|
INCLUDE(GNUInstallDirs)
|
|
|
|
|
|
|
|
SET( ASSIMP_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
|
|
|
SET( ASSIMP_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
SET( ASSIMP_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
|
|
|
|
ELSE()
|
|
|
|
# Cache these to allow the user to override them on non-Unix platforms
|
|
|
|
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
|
|
|
|
"Path the built library files are installed to." )
|
|
|
|
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
|
|
|
|
"Path the header files are installed to." )
|
|
|
|
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
|
|
|
|
"Path the tool executables are installed to." )
|
|
|
|
|
|
|
|
SET(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_INCLUDE_INSTALL_DIR})
|
|
|
|
SET(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR})
|
|
|
|
SET(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_BIN_INSTALL_DIR})
|
|
|
|
ENDIF()
|
|
|
|
|
2020-10-13 17:30:58 +00:00
|
|
|
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(ASSIMP_HUNTER_ENABLED)
|
2019-05-24 21:34:25 +00:00
|
|
|
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
2021-08-20 19:02:42 +00:00
|
|
|
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-hunter-config.cmake.in")
|
2020-10-13 17:30:58 +00:00
|
|
|
set(NAMESPACE "${PROJECT_NAME}::")
|
|
|
|
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
2019-05-24 21:34:25 +00:00
|
|
|
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
|
|
|
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
2020-10-13 17:30:58 +00:00
|
|
|
ELSE()
|
|
|
|
set(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
|
2021-08-20 18:42:02 +00:00
|
|
|
set(CMAKE_CONFIG_TEMPLATE_FILE "cmake-modules/assimp-plain-config.cmake.in")
|
2020-10-13 17:30:58 +00:00
|
|
|
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
|
|
|
|
set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::")
|
|
|
|
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets")
|
|
|
|
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake")
|
|
|
|
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake")
|
|
|
|
ENDIF()
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2020-10-13 17:30:58 +00:00
|
|
|
set(INCLUDE_INSTALL_DIR "include")
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2020-10-13 17:30:58 +00:00
|
|
|
# Include module with fuction 'write_basic_package_version_file'
|
|
|
|
include(CMakePackageConfigHelpers)
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2020-10-13 17:30:58 +00:00
|
|
|
# Note: PROJECT_VERSION is used as a VERSION
|
|
|
|
write_basic_package_version_file("${VERSION_CONFIG}" COMPATIBILITY SameMajorVersion)
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2020-10-13 17:30:58 +00:00
|
|
|
configure_package_config_file(
|
|
|
|
${CMAKE_CONFIG_TEMPLATE_FILE}
|
|
|
|
"${PROJECT_CONFIG}"
|
|
|
|
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
|
|
|
|
)
|
2019-05-24 21:34:25 +00:00
|
|
|
|
2024-04-16 21:41:21 +00:00
|
|
|
if(ASSIMP_INSTALL)
|
|
|
|
install(
|
|
|
|
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
|
|
|
|
DESTINATION "${CONFIG_INSTALL_DIR}"
|
|
|
|
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
|
|
|
)
|
2020-10-13 17:30:58 +00:00
|
|
|
|
2024-04-16 21:41:21 +00:00
|
|
|
install(
|
|
|
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
|
|
NAMESPACE "${NAMESPACE}"
|
|
|
|
DESTINATION "${CONFIG_INSTALL_DIR}"
|
|
|
|
COMPONENT ${LIBASSIMP-DEV_COMPONENT}
|
|
|
|
)
|
|
|
|
endif()
|
2015-07-04 20:08:26 +00:00
|
|
|
|
2020-03-23 16:35:32 +00:00
|
|
|
IF( ASSIMP_BUILD_DOCS )
|
2018-03-31 17:12:53 +00:00
|
|
|
ADD_SUBDIRECTORY(doc)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2017-04-25 12:35:07 +00:00
|
|
|
|
2011-05-30 14:13:33 +00:00
|
|
|
# Search for external dependencies, and build them from source if not found
|
|
|
|
# Search for zlib
|
2020-03-23 16:35:32 +00:00
|
|
|
IF(ASSIMP_HUNTER_ENABLED)
|
2019-05-24 20:13:55 +00:00
|
|
|
hunter_add_package(ZLIB)
|
|
|
|
find_package(ZLIB CONFIG REQUIRED)
|
|
|
|
|
|
|
|
add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
|
|
|
set(ZLIB_FOUND TRUE)
|
|
|
|
set(ZLIB_LIBRARIES ZLIB::zlib)
|
|
|
|
set(ASSIMP_BUILD_MINIZIP TRUE)
|
2020-02-23 12:09:35 +00:00
|
|
|
ELSE()
|
2021-01-29 07:20:18 +00:00
|
|
|
# If the zlib is already found outside, add an export in case assimpTargets can't find it.
|
2024-04-16 21:41:21 +00:00
|
|
|
IF( ZLIB_FOUND AND ASSIMP_INSTALL)
|
2021-03-28 23:26:03 +00:00
|
|
|
INSTALL( TARGETS zlib zlibstatic
|
2021-01-29 07:20:18 +00:00
|
|
|
EXPORT "${TARGETS_EXPORT_NAME}")
|
|
|
|
ENDIF()
|
|
|
|
|
2019-05-24 20:13:55 +00:00
|
|
|
IF ( NOT ASSIMP_BUILD_ZLIB )
|
|
|
|
FIND_PACKAGE(ZLIB)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2019-05-24 20:13:55 +00:00
|
|
|
|
2023-01-21 14:57:44 +00:00
|
|
|
IF ( NOT ZLIB_FOUND AND NOT ASSIMP_BUILD_ZLIB )
|
|
|
|
message( FATAL_ERROR
|
|
|
|
"Build configured with -DASSIMP_BUILD_ZLIB=OFF but unable to find zlib"
|
|
|
|
)
|
|
|
|
ELSEIF( NOT ZLIB_FOUND )
|
2019-05-24 20:13:55 +00:00
|
|
|
MESSAGE(STATUS "compiling zlib from sources")
|
|
|
|
INCLUDE(CheckIncludeFile)
|
|
|
|
INCLUDE(CheckTypeSize)
|
|
|
|
INCLUDE(CheckFunctionExists)
|
|
|
|
|
|
|
|
# Explicitly turn off ASM686 and AMD64 cmake options.
|
|
|
|
# The AMD64 option causes a build failure on MSVC and the ASM builds seem to have problems:
|
|
|
|
# https://github.com/madler/zlib/issues/41#issuecomment-125848075
|
|
|
|
# Also prevents these options from "polluting" the cmake options if assimp is being
|
|
|
|
# included as a submodule.
|
|
|
|
set( ASM686 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE )
|
|
|
|
set( AMD64 FALSE CACHE INTERNAL "Override ZLIB flag to turn off assembly" FORCE )
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
# need to ensure we don't link with system zlib or minizip as well.
|
|
|
|
SET(ASSIMP_BUILD_MINIZIP 1)
|
2020-02-23 12:09:35 +00:00
|
|
|
ELSE()
|
2019-05-24 20:13:55 +00:00
|
|
|
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
|
|
|
SET(ZLIB_LIBRARIES_LINKED -lz)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2019-05-24 20:13:55 +00:00
|
|
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2019-05-24 20:13:55 +00:00
|
|
|
|
|
|
|
IF( NOT IOS )
|
2018-07-10 12:34:46 +00:00
|
|
|
IF( NOT ASSIMP_BUILD_MINIZIP )
|
2019-05-24 20:13:55 +00:00
|
|
|
use_pkgconfig(UNZIP minizip)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
|
|
|
ELSE ()
|
2019-05-24 20:13:55 +00:00
|
|
|
IF( NOT BUILD_SHARED_LIBS )
|
2018-07-10 12:34:46 +00:00
|
|
|
IF( NOT ASSIMP_BUILD_MINIZIP )
|
2019-05-24 20:13:55 +00:00
|
|
|
use_pkgconfig(UNZIP minizip)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF ()
|
|
|
|
ENDIF ()
|
2011-05-30 14:13:33 +00:00
|
|
|
|
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." )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
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
|
|
|
)
|
2020-05-02 19:08:24 +00:00
|
|
|
IF( ASSIMP_BUILD_ARCHITECTURE STREQUAL "")
|
|
|
|
ELSE()
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS ( -D'ASSIMP_BUILD_ARCHITECTURE="${ASSIMP_BUILD_ARCHITECTURE}"' )
|
2020-05-03 13:55:42 +00:00
|
|
|
ENDIF()
|
2011-09-28 09:04:49 +00:00
|
|
|
|
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
|
|
|
)
|
2020-05-02 19:08:24 +00:00
|
|
|
IF( ASSIMP_BUILD_COMPILER STREQUAL "")
|
|
|
|
ELSE()
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS ( -D'ASSIMP_BUILD_COMPILER="${ASSIMP_BUILD_COMPILER}"' )
|
2020-05-02 19:08:24 +00:00
|
|
|
ENDIF()
|
2011-09-28 09:04:49 +00:00
|
|
|
|
|
|
|
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
|
2021-05-01 16:46:12 +00:00
|
|
|
"Build the C4D importer, which relies on the non-free Cineware SDK."
|
2015-02-23 13:23:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
2024-04-06 22:25:46 +00:00
|
|
|
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/includes")
|
2015-05-19 03:44:54 +00:00
|
|
|
|
2024-04-06 22:25:46 +00:00
|
|
|
IF (WIN32)
|
2015-05-19 03:44:54 +00:00
|
|
|
# pick the correct prebuilt library
|
2022-09-21 11:45:21 +00:00
|
|
|
IF(MSVC143)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2022")
|
|
|
|
ELSEIF(MSV142)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2019")
|
|
|
|
ELSEIF(MSVC15)
|
2018-03-31 17:12:53 +00:00
|
|
|
SET(C4D_LIB_POSTFIX "_2017")
|
|
|
|
ELSEIF(MSVC14)
|
2016-07-01 14:57:45 +00:00
|
|
|
SET(C4D_LIB_POSTFIX "_2015")
|
|
|
|
ELSEIF(MSVC12)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2013")
|
|
|
|
ELSEIF(MSVC11)
|
|
|
|
SET(C4D_LIB_POSTFIX "_2012")
|
2015-05-19 03:44:54 +00:00
|
|
|
ELSEIF(MSVC10)
|
2016-07-01 14:57:45 +00:00
|
|
|
SET(C4D_LIB_POSTFIX "_2010")
|
2015-05-19 03:44:54 +00:00
|
|
|
ELSE()
|
2016-04-06 08:29:41 +00:00
|
|
|
MESSAGE( FATAL_ERROR
|
2024-04-06 22:25:46 +00:00
|
|
|
"C4D for Windows is currently only supported with MSVC 10, 11, 12, 14, 14.2, 14.3"
|
2015-05-19 03:44:54 +00:00
|
|
|
)
|
|
|
|
ENDIF()
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2021-05-01 16:46:12 +00:00
|
|
|
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/libraries/win")
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2016-07-01 14:57:45 +00:00
|
|
|
SET(C4D_DEBUG_LIBRARIES
|
2021-05-01 16:46:12 +00:00
|
|
|
"${C4D_LIB_BASE_PATH}/cinewarelib${C4D_LIB_POSTFIX}/cinewarelib_debug.lib"
|
2016-07-01 14:57:45 +00:00
|
|
|
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_debug.lib"
|
|
|
|
)
|
|
|
|
SET(C4D_RELEASE_LIBRARIES
|
2021-05-01 16:46:12 +00:00
|
|
|
"${C4D_LIB_BASE_PATH}/cinewarelib${C4D_LIB_POSTFIX}/cinewarelib_release.lib"
|
2016-07-01 14:57:45 +00:00
|
|
|
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_release.lib"
|
|
|
|
)
|
2016-04-06 08:29:41 +00:00
|
|
|
|
2021-05-01 16:46:12 +00:00
|
|
|
# winsock and winmm are necessary (and undocumented) dependencies of Cineware SDK because
|
|
|
|
# it can be used to communicate with a running Cinema 4D instance
|
2015-05-19 03:44:54 +00:00
|
|
|
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
|
2024-04-06 22:25:46 +00:00
|
|
|
ELSEIF (APPLE)
|
|
|
|
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Cineware/libraries/osx")
|
|
|
|
|
|
|
|
SET(C4D_DEBUG_LIBRARIES
|
|
|
|
"${C4D_LIB_BASE_PATH}/debug/libcinewarelib.a"
|
|
|
|
"${C4D_LIB_BASE_PATH}/debug/libjpeglib.a"
|
|
|
|
)
|
|
|
|
SET(C4D_RELEASE_LIBRARIES
|
|
|
|
"${C4D_LIB_BASE_PATH}/release/libcinewarelib.a"
|
|
|
|
"${C4D_LIB_BASE_PATH}/release/libjpeglib.a"
|
|
|
|
)
|
2015-05-19 03:44:54 +00:00
|
|
|
ELSE ()
|
2016-04-06 08:29:41 +00:00
|
|
|
MESSAGE( FATAL_ERROR
|
2024-04-06 22:25:46 +00:00
|
|
|
"C4D is currently only available on Windows and macOS with Cineware SDK installed in contrib/Cineware"
|
2015-05-19 03:44:54 +00:00
|
|
|
)
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
|
|
|
ELSE ()
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2015-02-23 13:23:28 +00:00
|
|
|
|
2024-04-08 21:28:37 +00:00
|
|
|
if(ASSIMP_BUILD_DRACO_STATIC)
|
|
|
|
set(ASSIMP_BUILD_DRACO ON)
|
|
|
|
endif()
|
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
# Draco requires cmake 3.12
|
|
|
|
IF (DEFINED CMAKE_VERSION AND "${CMAKE_VERSION}" VERSION_LESS "3.12")
|
|
|
|
message(NOTICE "draco requires cmake 3.12 or newer, cmake is ${CMAKE_VERSION} . Draco is disabled")
|
|
|
|
SET ( ASSIMP_BUILD_DRACO OFF CACHE BOOL "Disabled: Draco requires newer cmake" FORCE )
|
|
|
|
ELSE()
|
2021-02-27 09:01:09 +00:00
|
|
|
OPTION ( ASSIMP_BUILD_DRACO "If the Draco libraries are to be built. Primarily for glTF" OFF )
|
2021-01-27 10:18:33 +00:00
|
|
|
IF ( ASSIMP_BUILD_DRACO )
|
|
|
|
# Primarily for glTF v2
|
|
|
|
# Enable Draco glTF feature set
|
|
|
|
set(DRACO_GLTF ON CACHE BOOL "" FORCE)
|
|
|
|
# Disable unnecessary or omitted components
|
|
|
|
set(DRACO_JS_GLUE OFF CACHE BOOL "" FORCE)
|
|
|
|
set(DRACO_WASM OFF CACHE BOOL "" FORCE)
|
|
|
|
set(DRACO_MAYA_PLUGIN OFF CACHE BOOL "" FORCE)
|
|
|
|
set(DRACO_UNITY_PLUGIN OFF CACHE BOOL "" FORCE)
|
|
|
|
set(DRACO_TESTS OFF CACHE BOOL "" FORCE)
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
IF(ASSIMP_HUNTER_ENABLED)
|
|
|
|
hunter_add_package(draco)
|
|
|
|
find_package(draco CONFIG REQUIRED)
|
2021-01-29 22:22:16 +00:00
|
|
|
set(draco_LIBRARIES draco::draco)
|
2021-01-26 17:56:39 +00:00
|
|
|
ELSE()
|
2021-01-27 10:18:33 +00:00
|
|
|
# Draco 1.4.1 has many warnings and will not build with /WX or -Werror
|
|
|
|
# See https://github.com/google/draco/issues/672
|
|
|
|
# and https://github.com/google/draco/issues/673
|
|
|
|
IF(MSVC)
|
|
|
|
set(DRACO_CXX_FLAGS "/W0")
|
|
|
|
ELSE()
|
|
|
|
list(APPEND DRACO_CXX_FLAGS
|
|
|
|
"-Wno-bool-compare"
|
|
|
|
"-Wno-comment"
|
|
|
|
"-Wno-maybe-uninitialized"
|
|
|
|
"-Wno-sign-compare"
|
|
|
|
"-Wno-unused-local-typedefs"
|
|
|
|
)
|
2024-04-08 21:28:37 +00:00
|
|
|
|
|
|
|
if(NOT ASSIMP_BUILD_DRACO_STATIC)
|
|
|
|
# Draco 1.4.1 does not explicitly export any symbols under GCC/clang
|
|
|
|
list(APPEND DRACO_CXX_FLAGS
|
|
|
|
"-fvisibility=default"
|
|
|
|
)
|
|
|
|
endif()
|
2021-01-27 10:18:33 +00:00
|
|
|
ENDIF()
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-02-03 11:38:20 +00:00
|
|
|
# Don't build or install all of Draco by default
|
|
|
|
ADD_SUBDIRECTORY( "contrib/draco" EXCLUDE_FROM_ALL )
|
2021-01-27 10:18:33 +00:00
|
|
|
|
2024-04-08 21:28:37 +00:00
|
|
|
if(ASSIMP_BUILD_DRACO_STATIC)
|
|
|
|
set_property(DIRECTORY "contrib/draco" PROPERTY BUILD_SHARED_LIBS OFF)
|
|
|
|
endif()
|
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
if(MSVC OR WIN32)
|
|
|
|
set(draco_LIBRARIES "draco")
|
2021-01-26 17:18:15 +00:00
|
|
|
else()
|
2024-04-08 21:28:37 +00:00
|
|
|
if(ASSIMP_BUILD_DRACO_STATIC)
|
2021-01-27 10:18:33 +00:00
|
|
|
set(draco_LIBRARIES "draco_static")
|
2024-04-08 21:28:37 +00:00
|
|
|
else()
|
|
|
|
set(draco_LIBRARIES "draco_shared")
|
2021-01-27 10:18:33 +00:00
|
|
|
endif()
|
2021-01-26 17:18:15 +00:00
|
|
|
endif()
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
# Don't build the draco command-line tools by default
|
|
|
|
set_target_properties(draco_encoder draco_decoder PROPERTIES
|
|
|
|
EXCLUDE_FROM_ALL TRUE
|
|
|
|
EXCLUDE_FROM_DEFAULT_BUILD TRUE
|
2023-09-09 17:29:15 +00:00
|
|
|
)
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-02-03 11:38:20 +00:00
|
|
|
# Do build the draco shared library
|
|
|
|
set_target_properties(${draco_LIBRARIES} PROPERTIES
|
|
|
|
EXCLUDE_FROM_ALL FALSE
|
|
|
|
EXCLUDE_FROM_DEFAULT_BUILD FALSE
|
2023-09-09 17:29:15 +00:00
|
|
|
)
|
2021-02-03 11:38:20 +00:00
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
TARGET_USE_COMMON_OUTPUT_DIRECTORY(${draco_LIBRARIES})
|
|
|
|
TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_encoder)
|
|
|
|
TARGET_USE_COMMON_OUTPUT_DIRECTORY(draco_decoder)
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
set(draco_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/draco/src")
|
2021-01-29 22:10:38 +00:00
|
|
|
|
2021-01-27 10:18:33 +00:00
|
|
|
# This is probably wrong
|
2024-04-16 21:41:21 +00:00
|
|
|
if (ASSIMP_INSTALL)
|
|
|
|
INSTALL( TARGETS ${draco_LIBRARIES}
|
|
|
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
|
|
|
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
|
|
|
ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
|
|
|
RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}
|
|
|
|
FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR}
|
|
|
|
COMPONENT ${LIBASSIMP_COMPONENT}
|
|
|
|
INCLUDES DESTINATION include
|
|
|
|
)
|
|
|
|
endif()
|
2021-01-27 10:18:33 +00:00
|
|
|
ENDIF()
|
2021-01-22 16:31:59 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Main assimp code
|
2010-03-03 21:46:56 +00:00
|
|
|
ADD_SUBDIRECTORY( code/ )
|
2022-04-30 15:08:34 +00:00
|
|
|
|
2012-07-17 22:56:15 +00:00
|
|
|
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
2019-09-21 16:02:37 +00:00
|
|
|
# The viewer for windows only
|
2022-02-21 14:17:23 +00:00
|
|
|
IF (WIN32)
|
2022-04-07 10:07:57 +00:00
|
|
|
FIND_PACKAGE(DirectX)
|
|
|
|
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
|
2016-04-28 16:44:47 +00:00
|
|
|
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
|
|
|
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2022-02-21 14:17:23 +00:00
|
|
|
ELSE()
|
|
|
|
MESSAGE("Building Assimp Viewer only supported on Windows.")
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2020-03-09 09:55:32 +00:00
|
|
|
# The command line tool
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2010-09-27 08:31:09 +00:00
|
|
|
|
2021-01-29 22:10:38 +00:00
|
|
|
IF ( ASSIMP_BUILD_SAMPLES )
|
2020-03-06 15:26:51 +00:00
|
|
|
SET( SAMPLES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/samples )
|
|
|
|
SET( SAMPLES_SHARED_CODE_DIR ${SAMPLES_DIR}/SharedCode )
|
2015-05-19 03:44:54 +00:00
|
|
|
IF ( WIN32 )
|
|
|
|
ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )
|
2019-03-16 08:45:21 +00:00
|
|
|
ADD_SUBDIRECTORY( samples/SimpleTexturedDirectx11 )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2015-05-19 03:44:54 +00:00
|
|
|
ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2012-07-17 22:56:15 +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/ )
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF ()
|
2012-07-17 22:56:15 +00:00
|
|
|
|
2022-04-07 10:07:57 +00:00
|
|
|
# Generate a pkg-config .pc, revision.h, and config.h for the Assimp library.
|
2014-10-15 05:28:14 +00:00
|
|
|
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
|
2020-01-28 18:37:38 +00:00
|
|
|
IF ( ASSIMP_INSTALL )
|
|
|
|
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2020-01-28 18:37:38 +00:00
|
|
|
|
2022-04-07 10:07:57 +00:00
|
|
|
CONFIGURE_FILE(
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/revision.h
|
|
|
|
)
|
|
|
|
|
|
|
|
CONFIGURE_FILE(
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include/assimp/config.h
|
|
|
|
)
|
|
|
|
|
2020-01-28 18:37:38 +00:00
|
|
|
IF ( ASSIMP_INSTALL )
|
|
|
|
IF(CMAKE_CPACK_COMMAND AND UNIX AND ASSIMP_OPT_BUILD_PACKAGES)
|
|
|
|
# Packing information
|
|
|
|
SET(CPACK_PACKAGE_NAME "assimp{ASSIMP_VERSION_MAJOR}.{ASSIMP_VERSION_MINOR}")
|
|
|
|
SET(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
|
|
|
|
SET(CPACK_PACKAGE_VENDOR "https://github.com/assimp")
|
|
|
|
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}" )
|
|
|
|
SET(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config)
|
|
|
|
|
|
|
|
# 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)
|
2023-09-24 06:56:00 +00:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_NAME "assimp")
|
2020-01-28 18:37:38 +00:00
|
|
|
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES contrib/gtest 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)
|
2016-04-23 07:42:05 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2015-12-10 16:15:27 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
2017-04-17 19:25:57 +00:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin64/")
|
|
|
|
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib64/")
|
2019-04-17 08:32:24 +00:00
|
|
|
else()
|
2017-04-17 19:25:57 +00:00
|
|
|
SET(BIN_DIR "${PROJECT_SOURCE_DIR}/bin32/")
|
|
|
|
SET(LIB_DIR "${PROJECT_SOURCE_DIR}/lib32/")
|
|
|
|
ENDIF()
|
|
|
|
|
2019-04-17 08:32:24 +00:00
|
|
|
IF(MSVC_TOOLSET_VERSION)
|
2020-08-07 14:14:44 +00:00
|
|
|
SET(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}")
|
2021-12-16 13:55:23 +00:00
|
|
|
SET(ASSIMP_MSVC_VERSION ${MSVC_PREFIX})
|
2019-04-17 08:32:24 +00:00
|
|
|
ELSE()
|
|
|
|
IF(MSVC12)
|
|
|
|
SET(ASSIMP_MSVC_VERSION "vc120")
|
|
|
|
ELSEIF(MSVC14)
|
|
|
|
SET(ASSIMP_MSVC_VERSION "vc140")
|
|
|
|
ELSEIF(MSVC15)
|
|
|
|
SET(ASSIMP_MSVC_VERSION "vc141")
|
2022-09-21 11:45:21 +00:00
|
|
|
ELSEIF(MSV142)
|
|
|
|
SET(ASSIMP_MSVC_VERSION "vc142")
|
|
|
|
ELSEIF(MSVC143)
|
|
|
|
SET(ASSIMP_MSVC_VERSION "vc143")
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
2019-04-17 08:32:24 +00:00
|
|
|
ENDIF()
|
2017-04-17 19:25:57 +00:00
|
|
|
|
2018-03-31 17:12:53 +00:00
|
|
|
IF(MSVC12 OR MSVC14 OR MSVC15 )
|
|
|
|
ADD_CUSTOM_TARGET(UpdateAssimpLibsDebugSymbolsAndDLLs COMMENT "Copying Assimp Libraries ..." VERBATIM)
|
2017-07-29 11:45:25 +00:00
|
|
|
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
|
2017-07-31 12:25:00 +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)
|
2017-07-29 11:45:25 +00:00
|
|
|
ELSE()
|
2017-07-31 12:25:00 +00:00
|
|
|
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/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/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/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/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/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/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/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/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET UpdateAssimpLibsDebugSymbolsAndDLLs COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/code/assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb ${LIB_DIR}assimp-${ASSIMP_MSVC_VERSION}-mtd.pdb VERBATIM)
|
2017-07-29 11:45:25 +00:00
|
|
|
ENDIF()
|
2020-02-23 12:09:35 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF ()
|