Merge pull request #2488 from rbsheth/rbsheth_hunterize_assimp
Use Hunter for pulling in dependenciespull/2254/head
commit
2d3c3379e5
232
CMakeLists.txt
232
CMakeLists.txt
|
@ -34,9 +34,24 @@
|
|||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#----------------------------------------------------------------------
|
||||
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
PROJECT( Assimp )
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.0 )
|
||||
|
||||
# Toggles the use of the hunter package manager
|
||||
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
||||
|
||||
include("cmake/HunterGate.cmake")
|
||||
HunterGate(
|
||||
URL "https://github.com/ruslo/hunter/archive/v0.23.176.tar.gz"
|
||||
SHA1 "2e9ae973d028660b735ac4c6142725ca36a0048a"
|
||||
)
|
||||
|
||||
IF(HUNTER_ENABLED)
|
||||
add_definitions(-DASSIMP_USE_HUNTER)
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
PROJECT( Assimp VERSION 5.0.0 )
|
||||
|
||||
# All supported options ###############################################
|
||||
|
||||
|
@ -67,7 +82,7 @@ OPTION( ASSIMP_NO_EXPORT
|
|||
)
|
||||
OPTION( ASSIMP_BUILD_ZLIB
|
||||
"Build your own zlib"
|
||||
OFF
|
||||
OFF
|
||||
)
|
||||
OPTION( ASSIMP_BUILD_ASSIMP_TOOLS
|
||||
"If the supplementary tools for Assimp are built in addition to the library."
|
||||
|
@ -115,12 +130,12 @@ OPTION ( IGNORE_GIT_HASH
|
|||
OFF
|
||||
)
|
||||
|
||||
IF (IOS)
|
||||
IF (IOS AND NOT HUNTER_ENABLED)
|
||||
IF (NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Release")
|
||||
ENDIF (NOT CMAKE_BUILD_TYPE)
|
||||
ADD_DEFINITIONS(-DENABLE_BITCODE)
|
||||
ENDIF (IOS)
|
||||
ENDIF (IOS AND NOT HUNTER_ENABLED)
|
||||
|
||||
# Use subset of Windows.h
|
||||
if (WIN32)
|
||||
|
@ -151,17 +166,18 @@ ELSE()
|
|||
ENDIF(NOT BUILD_SHARED_LIBS)
|
||||
|
||||
# Define here the needed parameters
|
||||
SET (ASSIMP_VERSION_MAJOR 5)
|
||||
SET (ASSIMP_VERSION_MINOR 0)
|
||||
SET (ASSIMP_VERSION_PATCH 0)
|
||||
SET (ASSIMP_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||
SET (ASSIMP_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||
SET (ASSIMP_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
|
||||
SET (ASSIMP_SOVERSION 4)
|
||||
SET (PROJECT_VERSION "${ASSIMP_VERSION}")
|
||||
SET (ASSIMP_SOVERSION 5)
|
||||
|
||||
SET( ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used for uploading the sources" )
|
||||
|
||||
# Enable C++11 support globally
|
||||
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
|
||||
if(NOT HUNTER_ENABLED)
|
||||
# Enable C++11 support globally
|
||||
set_property( GLOBAL PROPERTY CXX_STANDARD 11 )
|
||||
endif()
|
||||
|
||||
IF(NOT IGNORE_GIT_HASH)
|
||||
# Get the current working branch
|
||||
|
@ -222,9 +238,13 @@ ENDIF( UNIX )
|
|||
|
||||
# Grouped compiler settings
|
||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
# hide all not-exported symbols
|
||||
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c++0x ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
SET(LIBSTDC++_LIBRARIES -lstdc++)
|
||||
ELSEIF(MSVC)
|
||||
# enable multi-core compilation with MSVC
|
||||
|
@ -235,20 +255,28 @@ ELSEIF(MSVC)
|
|||
ADD_COMPILE_OPTIONS(/wd4351)
|
||||
ENDIF()
|
||||
ELSEIF ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
|
||||
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 ${CMAKE_CXX_FLAGS}" )
|
||||
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "-g -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long ${CMAKE_CXX_FLAGS}" )
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
||||
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
message(FATAL_ERROR "MinGW is too old to be supported. Please update MinGW and try again.")
|
||||
ELSEIF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
|
||||
message(WARNING "MinGW is old, if you experience errors, update MinGW.")
|
||||
ENDIF()
|
||||
SET( CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -std=c++11 -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}" )
|
||||
SET(CMAKE_C_FLAGS "-fPIC -fno-strict-aliasing ${CMAKE_C_FLAGS} ")
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall -Wno-long-long -Wa,-mbig-obj ${CMAKE_CXX_FLAGS}")
|
||||
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
|
||||
ADD_DEFINITIONS( -U__STRICT_ANSI__ )
|
||||
ENDIF()
|
||||
|
||||
IF ( IOS )
|
||||
IF ( IOS AND NOT HUNTER_ENABLED)
|
||||
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
||||
|
@ -259,7 +287,7 @@ ELSE()
|
|||
# Experimental for pdb generation
|
||||
ENDIF()
|
||||
|
||||
ENDIF( IOS )
|
||||
ENDIF( IOS AND NOT HUNTER_ENABLED)
|
||||
|
||||
IF (ASSIMP_COVERALLS)
|
||||
MESSAGE(STATUS "Coveralls enabled")
|
||||
|
@ -326,28 +354,67 @@ IF (NOT TARGET uninstall)
|
|||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
ENDIF()
|
||||
|
||||
# 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}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
|
||||
IF (is_multi_config)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
|
||||
ELSEIF (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake")
|
||||
ELSE()
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
|
||||
ENDIF()
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
|
||||
#we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...)
|
||||
INSTALL(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake"
|
||||
${PACKAGE_TARGETS_FILE}
|
||||
DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
||||
IF(HUNTER_ENABLED)
|
||||
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
|
||||
set(INCLUDE_INSTALL_DIR "include")
|
||||
|
||||
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
|
||||
# Configuration
|
||||
set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
set(NAMESPACE "${PROJECT_NAME}::")
|
||||
|
||||
# Include module with fuction 'write_basic_package_version_file'
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# Note: PROJECT_VERSION is used as a VERSION
|
||||
write_basic_package_version_file("${VERSION_CONFIG}" COMPATIBILITY SameMajorVersion)
|
||||
|
||||
# Use variables:
|
||||
# * TARGETS_EXPORT_NAME
|
||||
# * PROJECT_NAME
|
||||
configure_package_config_file(
|
||||
"cmake/assimp-hunter-config.cmake.in"
|
||||
"${PROJECT_CONFIG}"
|
||||
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
NAMESPACE "${NAMESPACE}"
|
||||
DESTINATION "${CONFIG_INSTALL_DIR}"
|
||||
)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
# 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}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
|
||||
IF (is_multi_config)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
|
||||
ELSEIF (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake")
|
||||
ELSE()
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE)
|
||||
SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake")
|
||||
ENDIF()
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
|
||||
#we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...)
|
||||
INSTALL(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake"
|
||||
${PACKAGE_TARGETS_FILE}
|
||||
DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
FIND_PACKAGE( DirectX )
|
||||
|
||||
|
@ -362,48 +429,57 @@ ENDIF( SYSTEM_IRRXML )
|
|||
|
||||
# Search for external dependencies, and build them from source if not found
|
||||
# Search for zlib
|
||||
IF ( NOT ASSIMP_BUILD_ZLIB )
|
||||
FIND_PACKAGE(ZLIB)
|
||||
ENDIF( NOT ASSIMP_BUILD_ZLIB )
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(ZLIB)
|
||||
find_package(ZLIB CONFIG REQUIRED)
|
||||
|
||||
IF( NOT ZLIB_FOUND )
|
||||
MESSAGE(STATUS "compiling zlib from sources")
|
||||
INCLUDE(CheckIncludeFile)
|
||||
INCLUDE(CheckTypeSize)
|
||||
INCLUDE(CheckFunctionExists)
|
||||
add_definitions(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_LIBRARIES ZLIB::zlib)
|
||||
set(ASSIMP_BUILD_MINIZIP TRUE)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
IF ( NOT ASSIMP_BUILD_ZLIB )
|
||||
FIND_PACKAGE(ZLIB)
|
||||
ENDIF( NOT ASSIMP_BUILD_ZLIB )
|
||||
|
||||
# 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 )
|
||||
IF( NOT ZLIB_FOUND )
|
||||
MESSAGE(STATUS "compiling zlib from sources")
|
||||
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)
|
||||
# need to ensure we don't link with system zlib or minizip as well.
|
||||
SET(ASSIMP_BUILD_MINIZIP 1)
|
||||
ELSE(NOT ZLIB_FOUND)
|
||||
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||
SET(ZLIB_LIBRARIES_LINKED -lz)
|
||||
ENDIF(NOT ZLIB_FOUND)
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
# 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 )
|
||||
|
||||
# Search for unzip
|
||||
IF ( NOT IOS )
|
||||
# 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)
|
||||
ELSE(NOT ZLIB_FOUND)
|
||||
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_OWN_ZLIB)
|
||||
SET(ZLIB_LIBRARIES_LINKED -lz)
|
||||
ENDIF(NOT ZLIB_FOUND)
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
IF( NOT IOS )
|
||||
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
ELSE ( NOT IOS )
|
||||
IF(NOT BUILD_SHARED_LIBS)
|
||||
IF( NOT BUILD_SHARED_LIBS )
|
||||
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
ENDIF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
ENDIF (NOT BUILD_SHARED_LIBS)
|
||||
ENDIF ( NOT BUILD_SHARED_LIBS )
|
||||
ENDIF ( NOT IOS )
|
||||
|
||||
IF ( ASSIMP_NO_EXPORT )
|
||||
|
@ -477,7 +553,9 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
||||
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
|
||||
ADD_SUBDIRECTORY(contrib)
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
ADD_SUBDIRECTORY(contrib)
|
||||
ENDIF(NOT HUNTER_ENABLED)
|
||||
|
||||
ADD_SUBDIRECTORY( code/ )
|
||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||
|
|
|
@ -0,0 +1,540 @@
|
|||
# Copyright (c) 2013-2018, Ruslan Baratov
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use 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.
|
||||
#
|
||||
# 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 HOLDER 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.
|
||||
|
||||
# This is a gate file to Hunter package manager.
|
||||
# Include this file using `include` command and add package you need, example:
|
||||
#
|
||||
# cmake_minimum_required(VERSION 3.2)
|
||||
#
|
||||
# include("cmake/HunterGate.cmake")
|
||||
# HunterGate(
|
||||
# URL "https://github.com/path/to/hunter/archive.tar.gz"
|
||||
# SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d"
|
||||
# )
|
||||
#
|
||||
# project(MyProject)
|
||||
#
|
||||
# hunter_add_package(Foo)
|
||||
# hunter_add_package(Boo COMPONENTS Bar Baz)
|
||||
#
|
||||
# Projects:
|
||||
# * https://github.com/hunter-packages/gate/
|
||||
# * https://github.com/ruslo/hunter
|
||||
|
||||
option(HUNTER_ENABLED "Enable Hunter package manager support" ON)
|
||||
|
||||
if(HUNTER_ENABLED)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.2")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"At least CMake version 3.2 required for Hunter dependency management."
|
||||
" Update CMake or set HUNTER_ENABLED to OFF."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments) # cmake_parse_arguments
|
||||
|
||||
option(HUNTER_STATUS_PRINT "Print working status" ON)
|
||||
option(HUNTER_STATUS_DEBUG "Print a lot info" OFF)
|
||||
option(HUNTER_TLS_VERIFY "Enable/disable TLS certificate checking on downloads" ON)
|
||||
|
||||
set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki")
|
||||
|
||||
function(hunter_gate_status_print)
|
||||
if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG)
|
||||
foreach(print_message ${ARGV})
|
||||
message(STATUS "[hunter] ${print_message}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_status_debug)
|
||||
if(HUNTER_STATUS_DEBUG)
|
||||
foreach(print_message ${ARGV})
|
||||
string(TIMESTAMP timestamp)
|
||||
message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_wiki wiki_page)
|
||||
message("------------------------------ WIKI -------------------------------")
|
||||
message(" ${HUNTER_WIKI}/${wiki_page}")
|
||||
message("-------------------------------------------------------------------")
|
||||
message("")
|
||||
message(FATAL_ERROR "")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_internal_error)
|
||||
message("")
|
||||
foreach(print_message ${ARGV})
|
||||
message("[hunter ** INTERNAL **] ${print_message}")
|
||||
endforeach()
|
||||
message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
|
||||
message("")
|
||||
hunter_gate_wiki("error.internal")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_fatal_error)
|
||||
cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}")
|
||||
string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki)
|
||||
if(have_no_wiki)
|
||||
hunter_gate_internal_error("Expected wiki")
|
||||
endif()
|
||||
message("")
|
||||
foreach(x ${hunter_UNPARSED_ARGUMENTS})
|
||||
message("[hunter ** FATAL ERROR **] ${x}")
|
||||
endforeach()
|
||||
message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]")
|
||||
message("")
|
||||
hunter_gate_wiki("${hunter_WIKI}")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_user_error)
|
||||
hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data")
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_self root version sha1 result)
|
||||
string(COMPARE EQUAL "${root}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("root is empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${version}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("version is empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${sha1}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("sha1 is empty")
|
||||
endif()
|
||||
|
||||
string(SUBSTRING "${sha1}" 0 7 archive_id)
|
||||
|
||||
if(EXISTS "${root}/cmake/Hunter")
|
||||
set(hunter_self "${root}")
|
||||
else()
|
||||
set(
|
||||
hunter_self
|
||||
"${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked"
|
||||
)
|
||||
endif()
|
||||
|
||||
set("${result}" "${hunter_self}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Set HUNTER_GATE_ROOT cmake variable to suitable value.
|
||||
function(hunter_gate_detect_root)
|
||||
# Check CMake variable
|
||||
string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty)
|
||||
if(not_empty)
|
||||
set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check environment variable
|
||||
string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty)
|
||||
if(not_empty)
|
||||
set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT detected by environment variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check HOME environment variable
|
||||
string(COMPARE NOTEQUAL "$ENV{HOME}" "" result)
|
||||
if(result)
|
||||
set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check SYSTEMDRIVE and USERPROFILE environment variable (windows only)
|
||||
if(WIN32)
|
||||
string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result)
|
||||
if(result)
|
||||
set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug(
|
||||
"HUNTER_ROOT set using SYSTEMDRIVE environment variable"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result)
|
||||
if(result)
|
||||
set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE)
|
||||
hunter_gate_status_debug(
|
||||
"HUNTER_ROOT set using USERPROFILE environment variable"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
hunter_gate_fatal_error(
|
||||
"Can't detect HUNTER_ROOT"
|
||||
WIKI "error.detect.hunter.root"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(hunter_gate_download dir)
|
||||
string(
|
||||
COMPARE
|
||||
NOTEQUAL
|
||||
"$ENV{HUNTER_DISABLE_AUTOINSTALL}"
|
||||
""
|
||||
disable_autoinstall
|
||||
)
|
||||
if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL)
|
||||
hunter_gate_fatal_error(
|
||||
"Hunter not found in '${dir}'"
|
||||
"Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'"
|
||||
"Settings:"
|
||||
" HUNTER_ROOT: ${HUNTER_GATE_ROOT}"
|
||||
" HUNTER_SHA1: ${HUNTER_GATE_SHA1}"
|
||||
WIKI "error.run.install"
|
||||
)
|
||||
endif()
|
||||
string(COMPARE EQUAL "${dir}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("Empty 'dir' argument")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("HUNTER_GATE_SHA1 empty")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad)
|
||||
if(is_bad)
|
||||
hunter_gate_internal_error("HUNTER_GATE_URL empty")
|
||||
endif()
|
||||
|
||||
set(done_location "${dir}/DONE")
|
||||
set(sha1_location "${dir}/SHA1")
|
||||
|
||||
set(build_dir "${dir}/Build")
|
||||
set(cmakelists "${dir}/CMakeLists.txt")
|
||||
|
||||
hunter_gate_status_debug("Locking directory: ${dir}")
|
||||
file(LOCK "${dir}" DIRECTORY GUARD FUNCTION)
|
||||
hunter_gate_status_debug("Lock done")
|
||||
|
||||
if(EXISTS "${done_location}")
|
||||
# while waiting for lock other instance can do all the job
|
||||
hunter_gate_status_debug("File '${done_location}' found, skip install")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${build_dir}")
|
||||
file(REMOVE_RECURSE "${cmakelists}")
|
||||
|
||||
file(MAKE_DIRECTORY "${build_dir}") # check directory permissions
|
||||
|
||||
# Disabling languages speeds up a little bit, reduces noise in the output
|
||||
# and avoids path too long windows error
|
||||
file(
|
||||
WRITE
|
||||
"${cmakelists}"
|
||||
"cmake_minimum_required(VERSION 3.2)\n"
|
||||
"project(HunterDownload LANGUAGES NONE)\n"
|
||||
"include(ExternalProject)\n"
|
||||
"ExternalProject_Add(\n"
|
||||
" Hunter\n"
|
||||
" URL\n"
|
||||
" \"${HUNTER_GATE_URL}\"\n"
|
||||
" URL_HASH\n"
|
||||
" SHA1=${HUNTER_GATE_SHA1}\n"
|
||||
" DOWNLOAD_DIR\n"
|
||||
" \"${dir}\"\n"
|
||||
" TLS_VERIFY\n"
|
||||
" ${HUNTER_TLS_VERIFY}\n"
|
||||
" SOURCE_DIR\n"
|
||||
" \"${dir}/Unpacked\"\n"
|
||||
" CONFIGURE_COMMAND\n"
|
||||
" \"\"\n"
|
||||
" BUILD_COMMAND\n"
|
||||
" \"\"\n"
|
||||
" INSTALL_COMMAND\n"
|
||||
" \"\"\n"
|
||||
")\n"
|
||||
)
|
||||
|
||||
if(HUNTER_STATUS_DEBUG)
|
||||
set(logging_params "")
|
||||
else()
|
||||
set(logging_params OUTPUT_QUIET)
|
||||
endif()
|
||||
|
||||
hunter_gate_status_debug("Run generate")
|
||||
|
||||
# Need to add toolchain file too.
|
||||
# Otherwise on Visual Studio + MDD this will fail with error:
|
||||
# "Could not find an appropriate version of the Windows 10 SDK installed on this machine"
|
||||
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
|
||||
get_filename_component(absolute_CMAKE_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
|
||||
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${absolute_CMAKE_TOOLCHAIN_FILE}")
|
||||
else()
|
||||
# 'toolchain_arg' can't be empty
|
||||
set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=")
|
||||
endif()
|
||||
|
||||
string(COMPARE EQUAL "${CMAKE_MAKE_PROGRAM}" "" no_make)
|
||||
if(no_make)
|
||||
set(make_arg "")
|
||||
else()
|
||||
# Test case: remove Ninja from PATH but set it via CMAKE_MAKE_PROGRAM
|
||||
set(make_arg "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
"-H${dir}"
|
||||
"-B${build_dir}"
|
||||
"-G${CMAKE_GENERATOR}"
|
||||
"${toolchain_arg}"
|
||||
${make_arg}
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
RESULT_VARIABLE download_result
|
||||
${logging_params}
|
||||
)
|
||||
|
||||
if(NOT download_result EQUAL 0)
|
||||
hunter_gate_internal_error(
|
||||
"Configure project failed."
|
||||
"To reproduce the error run: ${CMAKE_COMMAND} -H${dir} -B${build_dir} -G${CMAKE_GENERATOR} ${toolchain_arg} ${make_arg}"
|
||||
"In directory ${dir}"
|
||||
)
|
||||
endif()
|
||||
|
||||
hunter_gate_status_print(
|
||||
"Initializing Hunter workspace (${HUNTER_GATE_SHA1})"
|
||||
" ${HUNTER_GATE_URL}"
|
||||
" -> ${dir}"
|
||||
)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${build_dir}"
|
||||
WORKING_DIRECTORY "${dir}"
|
||||
RESULT_VARIABLE download_result
|
||||
${logging_params}
|
||||
)
|
||||
|
||||
if(NOT download_result EQUAL 0)
|
||||
hunter_gate_internal_error("Build project failed")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${build_dir}")
|
||||
file(REMOVE_RECURSE "${cmakelists}")
|
||||
|
||||
file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}")
|
||||
file(WRITE "${done_location}" "DONE")
|
||||
|
||||
hunter_gate_status_debug("Finished")
|
||||
endfunction()
|
||||
|
||||
# Must be a macro so master file 'cmake/Hunter' can
|
||||
# apply all variables easily just by 'include' command
|
||||
# (otherwise PARENT_SCOPE magic needed)
|
||||
macro(HunterGate)
|
||||
if(HUNTER_GATE_DONE)
|
||||
# variable HUNTER_GATE_DONE set explicitly for external project
|
||||
# (see `hunter_download`)
|
||||
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
|
||||
endif()
|
||||
|
||||
# First HunterGate command will init Hunter, others will be ignored
|
||||
get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET)
|
||||
|
||||
if(NOT HUNTER_ENABLED)
|
||||
# Empty function to avoid error "unknown function"
|
||||
function(hunter_add_package)
|
||||
endfunction()
|
||||
|
||||
set(
|
||||
_hunter_gate_disabled_mode_dir
|
||||
"${CMAKE_CURRENT_LIST_DIR}/cmake/Hunter/disabled-mode"
|
||||
)
|
||||
if(EXISTS "${_hunter_gate_disabled_mode_dir}")
|
||||
hunter_gate_status_debug(
|
||||
"Adding \"disabled-mode\" modules: ${_hunter_gate_disabled_mode_dir}"
|
||||
)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${_hunter_gate_disabled_mode_dir}")
|
||||
endif()
|
||||
elseif(_hunter_gate_done)
|
||||
hunter_gate_status_debug("Secondary HunterGate (use old settings)")
|
||||
hunter_gate_self(
|
||||
"${HUNTER_CACHED_ROOT}"
|
||||
"${HUNTER_VERSION}"
|
||||
"${HUNTER_SHA1}"
|
||||
_hunter_self
|
||||
)
|
||||
include("${_hunter_self}/cmake/Hunter")
|
||||
else()
|
||||
set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name)
|
||||
if(_have_project_name)
|
||||
hunter_gate_fatal_error(
|
||||
"Please set HunterGate *before* 'project' command. "
|
||||
"Detected project: ${PROJECT_NAME}"
|
||||
WIKI "error.huntergate.before.project"
|
||||
)
|
||||
endif()
|
||||
|
||||
cmake_parse_arguments(
|
||||
HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV}
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1)
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url)
|
||||
string(
|
||||
COMPARE
|
||||
NOTEQUAL
|
||||
"${HUNTER_GATE_UNPARSED_ARGUMENTS}"
|
||||
""
|
||||
_have_unparsed
|
||||
)
|
||||
string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global)
|
||||
string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath)
|
||||
|
||||
if(_have_unparsed)
|
||||
hunter_gate_user_error(
|
||||
"HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}"
|
||||
)
|
||||
endif()
|
||||
if(_empty_sha1)
|
||||
hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory")
|
||||
endif()
|
||||
if(_empty_url)
|
||||
hunter_gate_user_error("URL suboption of HunterGate is mandatory")
|
||||
endif()
|
||||
if(_have_global)
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)")
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)")
|
||||
endif()
|
||||
endif()
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
if(_have_global)
|
||||
hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)")
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)")
|
||||
endif()
|
||||
endif()
|
||||
if(_have_filepath)
|
||||
if(_have_global)
|
||||
hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)")
|
||||
endif()
|
||||
if(HUNTER_GATE_LOCAL)
|
||||
hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
hunter_gate_detect_root() # set HUNTER_GATE_ROOT
|
||||
|
||||
# Beautify path, fix probable problems with windows path slashes
|
||||
get_filename_component(
|
||||
HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE
|
||||
)
|
||||
hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}")
|
||||
if(NOT HUNTER_ALLOW_SPACES_IN_PATH)
|
||||
string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces)
|
||||
if(NOT _contain_spaces EQUAL -1)
|
||||
hunter_gate_fatal_error(
|
||||
"HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces."
|
||||
"Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error"
|
||||
"(Use at your own risk!)"
|
||||
WIKI "error.spaces.in.hunter.root"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(
|
||||
REGEX
|
||||
MATCH
|
||||
"[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*"
|
||||
HUNTER_GATE_VERSION
|
||||
"${HUNTER_GATE_URL}"
|
||||
)
|
||||
string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty)
|
||||
if(_is_empty)
|
||||
set(HUNTER_GATE_VERSION "unknown")
|
||||
endif()
|
||||
|
||||
hunter_gate_self(
|
||||
"${HUNTER_GATE_ROOT}"
|
||||
"${HUNTER_GATE_VERSION}"
|
||||
"${HUNTER_GATE_SHA1}"
|
||||
_hunter_self
|
||||
)
|
||||
|
||||
set(_master_location "${_hunter_self}/cmake/Hunter")
|
||||
if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter")
|
||||
# Hunter downloaded manually (e.g. by 'git clone')
|
||||
set(_unused "xxxxxxxxxx")
|
||||
set(HUNTER_GATE_SHA1 "${_unused}")
|
||||
set(HUNTER_GATE_VERSION "${_unused}")
|
||||
else()
|
||||
get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE)
|
||||
set(_done_location "${_archive_id_location}/DONE")
|
||||
set(_sha1_location "${_archive_id_location}/SHA1")
|
||||
|
||||
# Check Hunter already downloaded by HunterGate
|
||||
if(NOT EXISTS "${_done_location}")
|
||||
hunter_gate_download("${_archive_id_location}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_done_location}")
|
||||
hunter_gate_internal_error("hunter_gate_download failed")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${_sha1_location}")
|
||||
hunter_gate_internal_error("${_sha1_location} not found")
|
||||
endif()
|
||||
file(READ "${_sha1_location}" _sha1_value)
|
||||
string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal)
|
||||
if(NOT _is_equal)
|
||||
hunter_gate_internal_error(
|
||||
"Short SHA1 collision:"
|
||||
" ${_sha1_value} (from ${_sha1_location})"
|
||||
" ${HUNTER_GATE_SHA1} (HunterGate)"
|
||||
)
|
||||
endif()
|
||||
if(NOT EXISTS "${_master_location}")
|
||||
hunter_gate_user_error(
|
||||
"Master file not found:"
|
||||
" ${_master_location}"
|
||||
"try to update Hunter/HunterGate"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
include("${_master_location}")
|
||||
set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES)
|
||||
endif()
|
||||
endmacro()
|
|
@ -0,0 +1,14 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
find_package(RapidJSON CONFIG REQUIRED)
|
||||
find_package(ZLIB CONFIG REQUIRED)
|
||||
find_package(utf8 CONFIG REQUIRED)
|
||||
find_package(irrXML CONFIG REQUIRED)
|
||||
find_package(minizip CONFIG REQUIRED)
|
||||
find_package(openddlparser CONFIG REQUIRED)
|
||||
find_package(poly2tri CONFIG REQUIRED)
|
||||
find_package(polyclipping CONFIG REQUIRED)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
|
@ -55,7 +55,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "3MFXmlTags.h"
|
||||
#include "D3MFOpcPackage.h"
|
||||
|
||||
#include <contrib/zip/src/zip.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <zip/zip.h>
|
||||
#else
|
||||
# include <contrib/zip/src/zip.h>
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
|
|
|
@ -58,7 +58,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
|
||||
#include "D3MFOpcPackage.h"
|
||||
#include <unzip.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <minizip/unzip.h>
|
||||
#else
|
||||
# include <unzip.h>
|
||||
#endif
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include "3MFXmlTags.h"
|
||||
#include <assimp/fast_atof.h>
|
||||
|
|
|
@ -56,7 +56,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <unzip.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <minizip/unzip.h>
|
||||
#else
|
||||
# include <unzip.h>
|
||||
#endif
|
||||
#include "3MFXmlTags.h"
|
||||
|
||||
namespace Assimp {
|
||||
|
@ -148,6 +152,15 @@ int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) {
|
|||
zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
|
||||
zlib_filefunc_def mapping;
|
||||
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
mapping.zopen_file = (open_file_func)open;
|
||||
mapping.zread_file = (read_file_func)read;
|
||||
mapping.zwrite_file = (write_file_func)write;
|
||||
mapping.ztell_file = (tell_file_func)tell;
|
||||
mapping.zseek_file = (seek_file_func)seek;
|
||||
mapping.zclose_file = (close_file_func)close;
|
||||
mapping.zerror_file = (error_file_func)testerror;
|
||||
#else
|
||||
mapping.zopen_file = open;
|
||||
mapping.zread_file = read;
|
||||
mapping.zwrite_file = write;
|
||||
|
@ -155,6 +168,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
|
|||
mapping.zseek_file = seek;
|
||||
mapping.zclose_file = close;
|
||||
mapping.zerror_file = testerror;
|
||||
#endif
|
||||
mapping.opaque = reinterpret_cast<voidpf>(pIOHandler);
|
||||
|
||||
return mapping;
|
||||
|
|
|
@ -144,7 +144,11 @@ namespace Assimp
|
|||
|
||||
#if ASSIMP_BLEND_WITH_POLY_2_TRI
|
||||
|
||||
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <poly2tri/poly2tri.h>
|
||||
#else
|
||||
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
#endif
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
# 3) Add libassimp using the file lists (eliminates duplication of file names between
|
||||
# source groups and library command)
|
||||
#
|
||||
cmake_minimum_required( VERSION 2.6 )
|
||||
cmake_minimum_required( VERSION 3.0 )
|
||||
SET( HEADER_PATH ../include/assimp )
|
||||
|
||||
if(NOT ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||
|
@ -267,7 +267,7 @@ MACRO(ADD_ASSIMP_EXPORTER name)
|
|||
ELSE ()
|
||||
set(ASSIMP_EXPORTER_ENABLED ${ASSIMP_BUILD_${name}_EXPORTER})
|
||||
ENDIF ()
|
||||
|
||||
|
||||
IF (ASSIMP_EXPORTER_ENABLED)
|
||||
SET(ASSIMP_EXPORTERS_ENABLED "${ASSIMP_EXPORTERS_ENABLED} ${name}")
|
||||
LIST(APPEND ASSIMP_EXPORTER_SRCS ${ARGN})
|
||||
|
@ -848,116 +848,173 @@ SET( Extra_SRCS
|
|||
)
|
||||
SOURCE_GROUP( Extra FILES ${Extra_SRCS})
|
||||
|
||||
SET( Clipper_SRCS
|
||||
../contrib/clipper/clipper.hpp
|
||||
../contrib/clipper/clipper.cpp
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\Clipper FILES ${Clipper_SRCS})
|
||||
# irrXML
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(irrXML)
|
||||
find_package(irrXML CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
# irrXML already included in contrib directory by parent CMakeLists.txt.
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
SET( Poly2Tri_SRCS
|
||||
../contrib/poly2tri/poly2tri/common/shapes.cc
|
||||
../contrib/poly2tri/poly2tri/common/shapes.h
|
||||
../contrib/poly2tri/poly2tri/common/utils.h
|
||||
../contrib/poly2tri/poly2tri/sweep/advancing_front.h
|
||||
../contrib/poly2tri/poly2tri/sweep/advancing_front.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/cdt.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/cdt.h
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep.h
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep_context.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep_context.h
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS})
|
||||
# utf8
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(utf8)
|
||||
find_package(utf8 CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
# utf8 is header-only, so Assimp doesn't need to do anything.
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
SET( unzip_SRCS
|
||||
../contrib/unzip/crypt.h
|
||||
../contrib/unzip/ioapi.c
|
||||
../contrib/unzip/ioapi.h
|
||||
../contrib/unzip/unzip.c
|
||||
../contrib/unzip/unzip.h
|
||||
)
|
||||
SOURCE_GROUP(Contrib\\unzip FILES ${unzip_SRCS})
|
||||
# polyclipping
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(polyclipping)
|
||||
find_package(polyclipping CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET( Clipper_SRCS
|
||||
../contrib/clipper/clipper.hpp
|
||||
../contrib/clipper/clipper.cpp
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\Clipper FILES ${Clipper_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
SET( ziplib_SRCS
|
||||
../contrib/zip/src/miniz.h
|
||||
../contrib/zip/src/zip.c
|
||||
../contrib/zip/src/zip.h
|
||||
)
|
||||
# poly2tri
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(poly2tri)
|
||||
find_package(poly2tri CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET( Poly2Tri_SRCS
|
||||
../contrib/poly2tri/poly2tri/common/shapes.cc
|
||||
../contrib/poly2tri/poly2tri/common/shapes.h
|
||||
../contrib/poly2tri/poly2tri/common/utils.h
|
||||
../contrib/poly2tri/poly2tri/sweep/advancing_front.h
|
||||
../contrib/poly2tri/poly2tri/sweep/advancing_front.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/cdt.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/cdt.h
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep.h
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep_context.cc
|
||||
../contrib/poly2tri/poly2tri/sweep/sweep_context.h
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# TODO if cmake required version has been updated to >3.12.0, collapse this to the second case only
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||
add_definitions(-DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
else()
|
||||
add_compile_definitions(MINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
endif()
|
||||
# minizip/unzip
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(minizip)
|
||||
find_package(minizip CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET( unzip_SRCS
|
||||
../contrib/unzip/crypt.h
|
||||
../contrib/unzip/ioapi.c
|
||||
../contrib/unzip/ioapi.h
|
||||
../contrib/unzip/unzip.c
|
||||
../contrib/unzip/unzip.h
|
||||
)
|
||||
SOURCE_GROUP(Contrib\\unzip FILES ${unzip_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
SOURCE_GROUP( ziplib FILES ${ziplib_SRCS} )
|
||||
# zip (https://github.com/kuba--/zip)
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(zip)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET( ziplib_SRCS
|
||||
../contrib/zip/src/miniz.h
|
||||
../contrib/zip/src/zip.c
|
||||
../contrib/zip/src/zip.h
|
||||
)
|
||||
|
||||
SET ( openddl_parser_SRCS
|
||||
../contrib/openddlparser/code/OpenDDLParser.cpp
|
||||
../contrib/openddlparser/code/DDLNode.cpp
|
||||
../contrib/openddlparser/code/OpenDDLCommon.cpp
|
||||
../contrib/openddlparser/code/OpenDDLExport.cpp
|
||||
../contrib/openddlparser/code/Value.cpp
|
||||
../contrib/openddlparser/code/OpenDDLStream.cpp
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParser.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLCommon.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLExport.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLStream.h
|
||||
../contrib/openddlparser/include/openddlparser/DDLNode.h
|
||||
../contrib/openddlparser/include/openddlparser/Value.h
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\openddl_parser FILES ${openddl_parser_SRCS})
|
||||
# TODO if cmake required version has been updated to >3.12.0, collapse this to the second case only
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||
add_definitions(-DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
else()
|
||||
add_compile_definitions(MINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
endif()
|
||||
|
||||
SET ( open3dgc_SRCS
|
||||
../contrib/Open3DGC/o3dgcAdjacencyInfo.h
|
||||
../contrib/Open3DGC/o3dgcArithmeticCodec.cpp
|
||||
../contrib/Open3DGC/o3dgcArithmeticCodec.h
|
||||
../contrib/Open3DGC/o3dgcBinaryStream.h
|
||||
../contrib/Open3DGC/o3dgcCommon.h
|
||||
../contrib/Open3DGC/o3dgcDVEncodeParams.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorDecoder.cpp
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorDecoder.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorEncoder.cpp
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorEncoder.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVector.h
|
||||
../contrib/Open3DGC/o3dgcFIFO.h
|
||||
../contrib/Open3DGC/o3dgcIndexedFaceSet.h
|
||||
../contrib/Open3DGC/o3dgcIndexedFaceSet.inl
|
||||
../contrib/Open3DGC/o3dgcSC3DMCDecoder.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCDecoder.inl
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncoder.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncoder.inl
|
||||
../contrib/Open3DGC/o3dgcTimer.h
|
||||
../contrib/Open3DGC/o3dgcTools.cpp
|
||||
../contrib/Open3DGC/o3dgcTriangleFans.cpp
|
||||
../contrib/Open3DGC/o3dgcTriangleFans.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListDecoder.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListDecoder.inl
|
||||
../contrib/Open3DGC/o3dgcTriangleListEncoder.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListEncoder.inl
|
||||
../contrib/Open3DGC/o3dgcVector.h
|
||||
../contrib/Open3DGC/o3dgcVector.inl
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\open3dgc FILES ${open3dgc_SRCS})
|
||||
SOURCE_GROUP( ziplib FILES ${ziplib_SRCS} )
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# openddlparser
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(openddlparser)
|
||||
find_package(openddlparser CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET ( openddl_parser_SRCS
|
||||
../contrib/openddlparser/code/OpenDDLParser.cpp
|
||||
../contrib/openddlparser/code/DDLNode.cpp
|
||||
../contrib/openddlparser/code/OpenDDLCommon.cpp
|
||||
../contrib/openddlparser/code/OpenDDLExport.cpp
|
||||
../contrib/openddlparser/code/Value.cpp
|
||||
../contrib/openddlparser/code/OpenDDLStream.cpp
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParser.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLParserUtils.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLCommon.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLExport.h
|
||||
../contrib/openddlparser/include/openddlparser/OpenDDLStream.h
|
||||
../contrib/openddlparser/include/openddlparser/DDLNode.h
|
||||
../contrib/openddlparser/include/openddlparser/Value.h
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\openddl_parser FILES ${openddl_parser_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# Open3DGC
|
||||
IF(HUNTER_ENABLED)
|
||||
# Nothing to do, not available in Hunter yet.
|
||||
ELSE(HUNTER_ENABLED)
|
||||
SET ( open3dgc_SRCS
|
||||
../contrib/Open3DGC/o3dgcAdjacencyInfo.h
|
||||
../contrib/Open3DGC/o3dgcArithmeticCodec.cpp
|
||||
../contrib/Open3DGC/o3dgcArithmeticCodec.h
|
||||
../contrib/Open3DGC/o3dgcBinaryStream.h
|
||||
../contrib/Open3DGC/o3dgcCommon.h
|
||||
../contrib/Open3DGC/o3dgcDVEncodeParams.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorDecoder.cpp
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorDecoder.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorEncoder.cpp
|
||||
../contrib/Open3DGC/o3dgcDynamicVectorEncoder.h
|
||||
../contrib/Open3DGC/o3dgcDynamicVector.h
|
||||
../contrib/Open3DGC/o3dgcFIFO.h
|
||||
../contrib/Open3DGC/o3dgcIndexedFaceSet.h
|
||||
../contrib/Open3DGC/o3dgcIndexedFaceSet.inl
|
||||
../contrib/Open3DGC/o3dgcSC3DMCDecoder.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCDecoder.inl
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncodeParams.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncoder.h
|
||||
../contrib/Open3DGC/o3dgcSC3DMCEncoder.inl
|
||||
../contrib/Open3DGC/o3dgcTimer.h
|
||||
../contrib/Open3DGC/o3dgcTools.cpp
|
||||
../contrib/Open3DGC/o3dgcTriangleFans.cpp
|
||||
../contrib/Open3DGC/o3dgcTriangleFans.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListDecoder.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListDecoder.inl
|
||||
../contrib/Open3DGC/o3dgcTriangleListEncoder.h
|
||||
../contrib/Open3DGC/o3dgcTriangleListEncoder.inl
|
||||
../contrib/Open3DGC/o3dgcVector.h
|
||||
../contrib/Open3DGC/o3dgcVector.inl
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\open3dgc FILES ${open3dgc_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# Check dependencies for glTF importer with Open3DGC-compression.
|
||||
# RT-extensions is used in "contrib/Open3DGC/o3dgcTimer.h" for collecting statistics. Pointed file
|
||||
# has implementation for different platforms: WIN32, __MACH__ and other ("else" block).
|
||||
FIND_PACKAGE(RT QUIET)
|
||||
IF (RT_FOUND OR MSVC)
|
||||
IF (NOT HUNTER_ENABLED AND (RT_FOUND OR MSVC))
|
||||
SET( ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC 1 )
|
||||
ADD_DEFINITIONS( -DASSIMP_IMPORTER_GLTF_USE_OPEN3DGC=1 )
|
||||
ELSE ()
|
||||
SET (open3dgc_SRCS "")
|
||||
MESSAGE (INFO " RT-extension not found. glTF import/export will be built without Open3DGC-compression.")
|
||||
MESSAGE (INFO " Hunter enabled or RT-extension not found. glTF import/export will be built without Open3DGC-compression.")
|
||||
#!TODO: off course is better to remove statistics timers from o3dgc codec. Or propose to choose what to use.
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
|
||||
INCLUDE_DIRECTORIES( "../contrib" )
|
||||
# RapidJSON
|
||||
IF(HUNTER_ENABLED)
|
||||
hunter_add_package(RapidJSON)
|
||||
find_package(RapidJSON CONFIG REQUIRED)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" )
|
||||
INCLUDE_DIRECTORIES( "../contrib" )
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# VC2010 fixes
|
||||
if(MSVC10)
|
||||
|
@ -974,12 +1031,14 @@ if ( MSVC )
|
|||
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
|
||||
endif ( MSVC )
|
||||
|
||||
if (UNZIP_FOUND)
|
||||
SET (unzip_compile_SRCS "")
|
||||
else (UNZIP_FOUND)
|
||||
SET (unzip_compile_SRCS ${unzip_SRCS})
|
||||
INCLUDE_DIRECTORIES( "../contrib/unzip/" )
|
||||
endif (UNZIP_FOUND)
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
if (UNZIP_FOUND)
|
||||
SET (unzip_compile_SRCS "")
|
||||
else (UNZIP_FOUND)
|
||||
SET (unzip_compile_SRCS ${unzip_SRCS})
|
||||
INCLUDE_DIRECTORIES( "../contrib/unzip/" )
|
||||
endif (UNZIP_FOUND)
|
||||
ENDIF(NOT HUNTER_ENABLED)
|
||||
|
||||
MESSAGE(STATUS "Enabled importer formats:${ASSIMP_IMPORTERS_ENABLED}")
|
||||
MESSAGE(STATUS "Disabled importer formats:${ASSIMP_IMPORTERS_DISABLED}")
|
||||
|
@ -1018,10 +1077,12 @@ SET( assimp_src
|
|||
)
|
||||
ADD_DEFINITIONS( -DOPENDDLPARSER_BUILD )
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${IRRXML_INCLUDE_DIR}
|
||||
../contrib/openddlparser/include
|
||||
)
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${IRRXML_INCLUDE_DIR}
|
||||
../contrib/openddlparser/include
|
||||
)
|
||||
ENDIF(NOT HUNTER_ENABLED)
|
||||
|
||||
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
SET( assimp_src ${assimp_src} ${C4D_SRCS})
|
||||
|
@ -1034,10 +1095,25 @@ ADD_LIBRARY(assimp::assimp ALIAS assimp)
|
|||
TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
||||
IF(HUNTER_ENABLED)
|
||||
TARGET_LINK_LIBRARIES(assimp
|
||||
PUBLIC
|
||||
polyclipping::polyclipping
|
||||
irrXML::irrXML
|
||||
openddlparser::openddl_parser
|
||||
poly2tri::poly2tri
|
||||
minizip::minizip
|
||||
ZLIB::zlib
|
||||
RapidJSON::rapidjson
|
||||
utf8::utf8
|
||||
zip::zip
|
||||
)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES} ${IRRXML_LIBRARY} )
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
if(ASSIMP_ANDROID_JNIIOSYSTEM)
|
||||
set(ASSIMP_ANDROID_JNIIOSYSTEM_PATH port/AndroidJNI)
|
||||
|
@ -1119,24 +1195,37 @@ ENDIF(APPLE)
|
|||
|
||||
# Build against external unzip, or add ../contrib/unzip so
|
||||
# assimp can #include "unzip.h"
|
||||
if (UNZIP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS})
|
||||
TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES})
|
||||
else (UNZIP_FOUND)
|
||||
INCLUDE_DIRECTORIES("../")
|
||||
endif (UNZIP_FOUND)
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
if (UNZIP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS})
|
||||
TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES})
|
||||
else (UNZIP_FOUND)
|
||||
INCLUDE_DIRECTORIES("../")
|
||||
endif (UNZIP_FOUND)
|
||||
ENDIF(NOT HUNTER_ENABLED)
|
||||
|
||||
# Add RT-extension library for glTF importer with Open3DGC-compression.
|
||||
IF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC)
|
||||
TARGET_LINK_LIBRARIES(assimp ${RT_LIBRARY})
|
||||
ENDIF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC)
|
||||
|
||||
IF(HUNTER_ENABLED)
|
||||
INSTALL( TARGETS assimp
|
||||
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")
|
||||
ELSE(HUNTER_ENABLED)
|
||||
INSTALL( TARGETS assimp
|
||||
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})
|
||||
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})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev)
|
||||
INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev)
|
||||
|
||||
|
|
|
@ -320,7 +320,11 @@ std::string BaseImporter::GetExtension( const std::string& file ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <utf8/utf8.h>
|
||||
#else
|
||||
# include "../contrib/utf8cpp/source/utf8.h"
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Convert to UTF8 data
|
||||
|
|
|
@ -49,8 +49,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "Common/PolyTools.h"
|
||||
#include "PostProcessing/ProcessHelper.h"
|
||||
|
||||
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
#include "../contrib/clipper/clipper.hpp"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <poly2tri/poly2tri.h>
|
||||
# include <polyclipping/clipper.hpp>
|
||||
#else
|
||||
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
# include "../contrib/clipper/clipper.hpp"
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <iterator>
|
||||
|
|
|
@ -52,7 +52,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <tuple>
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
|
||||
# include <unzip.h>
|
||||
# ifdef ASSIMP_USE_HUNTER
|
||||
# include <minizip/unzip.h>
|
||||
# else
|
||||
# include <unzip.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "IFCLoader.h"
|
||||
|
|
|
@ -49,8 +49,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "Common/PolyTools.h"
|
||||
#include "PostProcessing/ProcessHelper.h"
|
||||
|
||||
#include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
#include "../contrib/clipper/clipper.hpp"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <poly2tri/poly2tri.h>
|
||||
# include <polyclipping/clipper.hpp>
|
||||
#else
|
||||
# include "../contrib/poly2tri/poly2tri/poly2tri.h"
|
||||
# include "../contrib/clipper/clipper.hpp"
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#include "STEPFileEncoding.h"
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <contrib/utf8cpp/source/utf8.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <utf8/utf8.h>
|
||||
#else
|
||||
# include <contrib/utf8cpp/source/utf8.h>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -42,7 +42,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <utility>
|
||||
#include "MMDPmxParser.h"
|
||||
#include <assimp/StringUtils.h>
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <utf8/utf8.h>
|
||||
#else
|
||||
# include "../contrib/utf8cpp/source/utf8.h"
|
||||
#endif
|
||||
#include <assimp/Exceptional.h>
|
||||
|
||||
namespace pmx
|
||||
|
|
|
@ -213,7 +213,11 @@ static void propId2StdString( Property *prop, std::string &name, std::string &ke
|
|||
}
|
||||
|
||||
if ( nullptr != prop->m_key ) {
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
name = prop->m_key->m_text.m_buffer;
|
||||
#else
|
||||
name = prop->m_key->m_buffer;
|
||||
#endif
|
||||
if ( Value::ddl_string == prop->m_value->m_type ) {
|
||||
key = prop->m_value->getString();
|
||||
}
|
||||
|
@ -498,7 +502,11 @@ static void getRefNames( DDLNode *node, std::vector<std::string> &names ) {
|
|||
for( size_t i = 0; i < ref->m_numRefs; i++ ) {
|
||||
Name *currentName( ref->m_referencedName[ i ] );
|
||||
if( nullptr != currentName && nullptr != currentName->m_id ) {
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
const std::string name( currentName->m_id->m_text.m_buffer );
|
||||
#else
|
||||
const std::string name( currentName->m_id->m_buffer );
|
||||
#endif
|
||||
if( !name.empty() ) {
|
||||
names.push_back( name );
|
||||
}
|
||||
|
@ -1039,7 +1047,11 @@ void OpenGEXImporter::handleColorNode( ODDLParser::DDLNode *node, aiScene * /*pS
|
|||
col.g = col4.g;
|
||||
col.b = col4.b;
|
||||
}
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
const ColorType colType( getColorType( &prop->m_key->m_text ) );
|
||||
#else
|
||||
const ColorType colType( getColorType( prop->m_key ) );
|
||||
#endif
|
||||
if( DiffuseColor == colType ) {
|
||||
m_currentMaterial->AddProperty( &col, 1, AI_MATKEY_COLOR_DIFFUSE );
|
||||
} else if( SpecularColor == colType ) {
|
||||
|
|
|
@ -123,6 +123,15 @@ int IOSystem2Unzip::testerror(voidpf /*opaque*/, voidpf /*stream*/) {
|
|||
zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
|
||||
zlib_filefunc_def mapping;
|
||||
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
mapping.zopen_file = (open_file_func)open;
|
||||
mapping.zread_file = (read_file_func)read;
|
||||
mapping.zwrite_file = (write_file_func)write;
|
||||
mapping.ztell_file = (tell_file_func)tell;
|
||||
mapping.zseek_file = (seek_file_func)seek;
|
||||
mapping.zclose_file = (close_file_func)close;
|
||||
mapping.zerror_file = (error_file_func)testerror;
|
||||
#else
|
||||
mapping.zopen_file = open;
|
||||
mapping.zread_file = read;
|
||||
mapping.zwrite_file = write;
|
||||
|
@ -130,6 +139,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem* pIOHandler) {
|
|||
mapping.zseek_file = seek;
|
||||
mapping.zclose_file = close;
|
||||
mapping.zerror_file = testerror;
|
||||
#endif
|
||||
mapping.opaque = (voidpf) pIOHandler;
|
||||
|
||||
return mapping;
|
||||
|
|
|
@ -42,7 +42,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef AI_Q3BSP_ZIPARCHIVE_H_INC
|
||||
#define AI_Q3BSP_ZIPARCHIVE_H_INC
|
||||
|
||||
#include <unzip.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <minizip/unzip.h>
|
||||
#else
|
||||
# include <unzip.h>
|
||||
#endif
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <vector>
|
||||
|
|
|
@ -59,8 +59,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/ByteSwapper.h>
|
||||
#include <assimp/StreamReader.h>
|
||||
#include <assimp/TinyFormatter.h>
|
||||
//#include "../contrib/ConvertUTF/ConvertUTF.h"
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <utf8/utf8.h>
|
||||
#else
|
||||
//# include "../contrib/ConvertUTF/ConvertUTF.h"
|
||||
# include "../contrib/utf8cpp/source/utf8.h"
|
||||
#endif
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/scene.h>
|
||||
|
|
|
@ -60,7 +60,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/types.h>
|
||||
#include <assimp/MemoryIOWrapper.h>
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <utf8/utf8.h>
|
||||
#else
|
||||
# include "../contrib/utf8cpp/source/utf8.h"
|
||||
#endif
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <stack>
|
||||
#include <map>
|
||||
|
|
|
@ -57,7 +57,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
//#include <stdio.h>
|
||||
//#include <cstdint>
|
||||
#include <irrXML.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <irrXML/irrXML.h>
|
||||
#else
|
||||
# include <irrXML.h>
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
|
|
|
@ -44,7 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#define INCLUDED_AI_IRRXML_WRAPPER
|
||||
|
||||
// some long includes ....
|
||||
#include <irrXML.h>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <irrXML/irrXML.h>
|
||||
#else
|
||||
# include <irrXML.h>
|
||||
#endif
|
||||
#include "IOStream.hpp"
|
||||
#include "BaseImporter.h"
|
||||
#include <vector>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
cmake_minimum_required( VERSION 2.6 )
|
||||
cmake_minimum_required( VERSION 3.0 )
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${Assimp_SOURCE_DIR}/contrib/gtest/include
|
||||
|
|
Loading…
Reference in New Issue