From 09b0a2a7e6b3b14fb23e268eb2c0bc9315bbd9d0 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco Date: Sun, 6 Aug 2017 11:17:29 +0200 Subject: [PATCH] fix building w/o assimp --- cmakemodules/script_assimp.cmake | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/cmakemodules/script_assimp.cmake b/cmakemodules/script_assimp.cmake index 52d091221b..9c94df0154 100644 --- a/cmakemodules/script_assimp.cmake +++ b/cmakemodules/script_assimp.cmake @@ -15,12 +15,12 @@ find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(ASSIMP ${_QUIET} assimp) IF (ASSIMP_FOUND) - IF ($ENV{VERBOSE}) + IF ($ENV{VERBOSE}) MESSAGE(STATUS "Assimp: Found via pkg-config") MESSAGE(STATUS " ASSIMP_LIBRARIES=${ASSIMP_LIBRARIES}") MESSAGE(STATUS " ASSIMP_INCLUDE_DIRS=${ASSIMP_INCLUDE_DIRS}") ENDIF ($ENV{VERBOSE}) - + SET(CMAKE_MRPT_HAS_ASSIMP 1) SET(CMAKE_MRPT_HAS_ASSIMP_SYSTEM 1) @@ -28,19 +28,19 @@ IF(PKG_CONFIG_FOUND) ENDIF (ASSIMP_FOUND) ENDIF(PKG_CONFIG_FOUND) -IF (NOT ASSIMP_FOUND) +IF (NOT ASSIMP_FOUND AND EXISTS "${MRPT_SOURCE_DIR}/otherlibs/assimp/") SET(BUILD_ASSIMP ON CACHE BOOL "Build an embedded version of Assimp (3D models importer)") IF (BUILD_ASSIMP) # Use embedded version: # -------------------------- # Tune cmake vars for assimp build for mrpt: - SET (ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "If the supplementary tools for Assimp are built in addition to the library." FORCE) + SET (ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "If the supplementary tools for Assimp are built in addition to the library." FORCE) SET (ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "If the official samples are built as well (needs Glut)." FORCE) SET (ASSIMP_BUILD_STATIC_LIB ON CACHE BOOL "Build Assimp static." FORCE) SET (ASSIMP_BUILD_TESTS OFF CACHE BOOL "." FORCE) set(ASSIMP_LIBRARY_SUFFIX "-mrpt" CACHE STRING "Suffix to append to library names" FORCE) - + add_subdirectory("${MRPT_SOURCE_DIR}/otherlibs/assimp/") if(ENABLE_SOLUTION_FOLDERS) set_target_properties(assimp PROPERTIES FOLDER "3rd party") @@ -54,7 +54,7 @@ IF (NOT ASSIMP_FOUND) AMD64 ASM686 ASSIMP_BIN_INSTALL_DIR - ASSIMP_BUILD_STATIC_LIB + ASSIMP_BUILD_STATIC_LIB ASSIMP_DEBUG_POSTFIX ASSIMP_ENABLE_BOOST_WORKAROUND ASSIMP_NO_EXPORT @@ -66,25 +66,25 @@ IF (NOT ASSIMP_FOUND) ASSIMP_PACKAGE_VERSION ASSIMP_LIBRARY_SUFFIX ) - + # 2nd attempt: via cmake SET(ASSIMP_DIR "${EMBEDDED_ASSIMP_DIR}" CACHE PATH "Path to ASSIMP CMake config file" FORCE) FIND_PACKAGE(ASSIMP QUIET) - + SET(ASSIMP_FOUND_VIA_CMAKE 1) - + SET(CMAKE_MRPT_HAS_ASSIMP 1) SET(CMAKE_MRPT_HAS_ASSIMP_SYSTEM 0) - + # Override binary output dir: - SET_TARGET_PROPERTIES(assimp PROPERTIES + SET_TARGET_PROPERTIES(assimp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/" ) - + ENDIF (BUILD_ASSIMP) -ENDIF(NOT ASSIMP_FOUND) +ENDIF() IF (ASSIMP_FOUND_VIA_CMAKE) # override wrong target libs in -config.cmake file: @@ -110,7 +110,7 @@ IF (CMAKE_MRPT_HAS_ASSIMP) LINK_DIRECTORIES("${ASSIMP_LIBRARY_DIRS}") ENDIF(NOT ${ASSIMP_LIBRARY_DIRS} STREQUAL "") - IF ($ENV{VERBOSE}) + IF ($ENV{VERBOSE}) MESSAGE(STATUS "Assimp:") MESSAGE(STATUS " ASSIMP_INCLUDE_DIRS: ${ASSIMP_INCLUDE_DIRS}") MESSAGE(STATUS " ASSIMP_CXX_FLAGS: ${ASSIMP_CXX_FLAGS}") @@ -120,4 +120,3 @@ IF (CMAKE_MRPT_HAS_ASSIMP) MESSAGE(STATUS " ASSIMP_VERSION: ${ASSIMP_VERSION}") ENDIF ($ENV{VERBOSE}) ENDIF (CMAKE_MRPT_HAS_ASSIMP) -