Use hunter to download dependencies if HUNTER_ENABLED is ON
parent
1db3e1e11f
commit
a4587e8609
|
@ -34,8 +34,7 @@
|
|||
# (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 )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.0 )
|
||||
|
||||
# Toggles the use of the hunter package manager
|
||||
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
|
||||
|
@ -386,6 +385,15 @@ ENDIF( SYSTEM_IRRXML )
|
|||
|
||||
# Search for external dependencies, and build them from source if not found
|
||||
# Search for zlib
|
||||
IF(HUNTER_ENABLED)
|
||||
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)
|
||||
ELSE(HUNTER_ENABLED)
|
||||
IF ( NOT ASSIMP_BUILD_ZLIB )
|
||||
FIND_PACKAGE(ZLIB)
|
||||
ENDIF( NOT ASSIMP_BUILD_ZLIB )
|
||||
|
@ -416,8 +424,8 @@ ELSE(NOT ZLIB_FOUND)
|
|||
SET(ZLIB_LIBRARIES_LINKED -lz)
|
||||
ENDIF(NOT ZLIB_FOUND)
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# Search for unzip
|
||||
IF( NOT IOS )
|
||||
IF( NOT ASSIMP_BUILD_MINIZIP )
|
||||
use_pkgconfig(UNZIP minizip)
|
||||
|
@ -501,7 +509,9 @@ ELSE (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
|||
ADD_DEFINITIONS( -DASSIMP_BUILD_NO_C4D_IMPORTER )
|
||||
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
|
||||
|
||||
IF(NOT HUNTER_ENABLED)
|
||||
ADD_SUBDIRECTORY(contrib)
|
||||
ENDIF(NOT HUNTER_ENABLED)
|
||||
|
||||
ADD_SUBDIRECTORY( code/ )
|
||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||
|
|
|
@ -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)
|
||||
|
@ -848,12 +848,39 @@ SET( Extra_SRCS
|
|||
)
|
||||
SOURCE_GROUP( Extra FILES ${Extra_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)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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)
|
||||
|
||||
# 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
|
||||
|
@ -868,7 +895,13 @@ SET( Poly2Tri_SRCS
|
|||
../contrib/poly2tri/poly2tri/sweep/sweep_context.h
|
||||
)
|
||||
SOURCE_GROUP( Contrib\\Poly2Tri FILES ${Poly2Tri_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# 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
|
||||
|
@ -877,7 +910,13 @@ SET( unzip_SRCS
|
|||
../contrib/unzip/unzip.h
|
||||
)
|
||||
SOURCE_GROUP(Contrib\\unzip FILES ${unzip_SRCS})
|
||||
ENDIF(HUNTER_ENABLED)
|
||||
|
||||
# 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
|
||||
|
@ -892,7 +931,13 @@ else()
|
|||
endif()
|
||||
|
||||
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
|
||||
|
@ -909,7 +954,12 @@ SET ( openddl_parser_SRCS
|
|||
../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
|
||||
|
@ -942,22 +992,29 @@ SET ( open3dgc_SRCS
|
|||
../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 ()
|
||||
|
||||
# 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(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 )
|
||||
|
||||
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})
|
||||
|
@ -1037,7 +1098,22 @@ TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
|
|||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
|
||||
)
|
||||
|
||||
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,12 +1195,14 @@ ENDIF(APPLE)
|
|||
|
||||
# Build against external unzip, or add ../contrib/unzip so
|
||||
# assimp can #include "unzip.h"
|
||||
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)
|
||||
|
|
|
@ -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