Make assimp optional
This commit is contained in:
52
3rdParty/assimp/CMakeLists.txt
vendored
52
3rdParty/assimp/CMakeLists.txt
vendored
@@ -1,23 +1,39 @@
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT DEFINED ASSIMP_REPO)
|
||||
set(ASSIMP_REPO https://github.com/assimp/assimp.git)
|
||||
find_package(assimp QUIET)
|
||||
if (assimp_FOUND)
|
||||
message("Using system assimp")
|
||||
elseif (USE_ASSIMP)
|
||||
if(NOT DEFINED ASSIMP_REPO)
|
||||
set(ASSIMP_REPO https://github.com/assimp/assimp.git)
|
||||
endif ()
|
||||
FetchContent_Declare(
|
||||
assimp
|
||||
EXCLUDE_FROM_ALL
|
||||
GIT_REPOSITORY ${ASSIMP_REPO}
|
||||
GIT_TAG v5.0.1
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_INJECT_DEBUG_POSTFIX OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_MakeAvailable(assimp)
|
||||
|
||||
set(assimp_FOUND ON PARENT_SCOPE)
|
||||
endif ()
|
||||
|
||||
FetchContent_Declare(
|
||||
assimp
|
||||
EXCLUDE_FROM_ALL
|
||||
GIT_REPOSITORY ${ASSIMP_REPO}
|
||||
GIT_TAG v5.0.1
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_INJECT_DEBUG_POSTFIX OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "" FORCE)
|
||||
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_MakeAvailable(assimp)
|
||||
function(LinkAssimp TARGET)
|
||||
if (NOT assimp_FOUND)
|
||||
find_package(assimp QUIET)
|
||||
endif ()
|
||||
if (assimp_FOUND)
|
||||
target_link_libraries(${TARGET} PUBLIC assimp)
|
||||
endif ()
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user