Skip to content

Commit

Permalink
fix building w/o assimp
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Aug 6, 2017
1 parent a033fb0 commit 09b0a2a
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions cmakemodules/script_assimp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ 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)

SET(ASSIMP_CXX_FLAGS ${ASSIMP_CFLAGS})
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")
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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}")
Expand All @@ -120,4 +120,3 @@ IF (CMAKE_MRPT_HAS_ASSIMP)
MESSAGE(STATUS " ASSIMP_VERSION: ${ASSIMP_VERSION}")
ENDIF ($ENV{VERBOSE})
ENDIF (CMAKE_MRPT_HAS_ASSIMP)

0 comments on commit 09b0a2a

Please sign in to comment.