Externalize Assimp
This commit is contained in:
parent
2e5e3cb01e
commit
9336d0cb1a
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(Couch)
|
||||
set(CMAKE_MODULE_PATH, ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR/cmake.})
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
|
||||
|
||||
option(LUA_ENABLED "Lua scripting support" ON)
|
||||
if (LUA_ENABLED)
|
||||
|
33
cmake/modules/FindASSIMP.cmake
Normal file
33
cmake/modules/FindASSIMP.cmake
Normal file
@ -0,0 +1,33 @@
|
||||
# - Try to find Assimp
|
||||
# Once done, this will define
|
||||
#
|
||||
# ASSIMP_FOUND - system has Assimp
|
||||
# ASSIMP_INCLUDE_DIR - the Assimp include directories
|
||||
# ASSIMP_LIBRARIES - link these to use Assimp
|
||||
message(STATUS "Looking for Assimp")
|
||||
FIND_PATH( ASSIMP_INCLUDE_DIR assimp/mesh.h
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
${CMAKE_SOURCE_DIR}/includes
|
||||
)
|
||||
FIND_LIBRARY( ASSIMP_LIBRARY assimp
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
${CMAKE_SOURCE_DIR}/lib
|
||||
)
|
||||
IF(ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARY)
|
||||
SET( ASSIMP_FOUND TRUE )
|
||||
SET( ASSIMP_LIBRARIES ${ASSIMP_LIBRARY} )
|
||||
ENDIF(ASSIMP_INCLUDE_DIR AND ASSIMP_LIBRARY)
|
||||
IF(ASSIMP_FOUND)
|
||||
IF(NOT ASSIMP_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found ASSIMP: ${ASSIMP_LIBRARY}")
|
||||
ENDIF(NOT ASSIMP_FIND_QUIETLY)
|
||||
ELSE(ASSIMP_FOUND)
|
||||
IF(ASSIMP_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find libASSIMP")
|
||||
ENDIF(ASSIMP_FIND_REQUIRED)
|
||||
ENDIF(ASSIMP_FOUND)
|
@ -8,6 +8,9 @@ find_package(glfw3 3.3 REQUIRED)
|
||||
## Find Bullet
|
||||
find_package(Bullet REQUIRED)
|
||||
|
||||
## Find AssImp
|
||||
find_package(ASSIMP REQUIRED)
|
||||
|
||||
if (LUA_ENABLED)
|
||||
## Find Lua
|
||||
find_package(Lua REQUIRED)
|
||||
@ -71,6 +74,10 @@ target_include_directories(couchlib
|
||||
PUBLIC
|
||||
${BULLET_INCLUDE_DIRS})
|
||||
|
||||
target_include_directories(couchlib
|
||||
PUBLIC
|
||||
${ASSIMP_INCLUDE_DIR})
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(couchlib glfw)
|
||||
endif()
|
||||
@ -80,6 +87,7 @@ if (LUA_ENABLED)
|
||||
target_link_libraries(couchlib ${LUA_LIBRARIES})
|
||||
endif ()
|
||||
target_link_libraries(couchlib ${BULLET_LIBRARIES})
|
||||
target_link_libraries(couchlib ${ASSIMP_LIBRARY})
|
||||
|
||||
## Add documentation
|
||||
find_package(Doxygen REQUIRED
|
||||
|
7
thirdparty/CMakeLists.txt
vendored
7
thirdparty/CMakeLists.txt
vendored
@ -3,10 +3,3 @@ project(Couch)
|
||||
## STB (image)
|
||||
target_include_directories(couchlib
|
||||
PUBLIC stb)
|
||||
|
||||
## ASSIMP
|
||||
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT FALSE CACHE BOOL "Turn off all assimp importers")
|
||||
set(ASSIMP_BUILD_OBJ_IMPORTER ON CACHE BOOL "Turn on wavefront importer")
|
||||
add_subdirectory(assimp)
|
||||
target_link_libraries(couchlib assimp::assimp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user