Skip to content

Commit

Permalink
Add nanogui as external project
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Mar 19, 2020
1 parent b6d2907 commit 5e00b29
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ include(cmakemodules/script_libdc1394.cmake REQUIRED) # Check for libdc1394-2
include(cmakemodules/script_liblas.cmake REQUIRED) # Check for the LAS LiDAR format library
include(cmakemodules/script_libtclap.cmake REQUIRED) # Check for system libtclap
include(cmakemodules/script_matlab.cmake REQUIRED) # Support for Matlab MEX functions generation
include(cmakemodules/script_nanogui.cmake REQUIRED) # Check for nanogui
include(cmakemodules/script_national_instruments.cmake REQUIRED) # NI C library
include(cmakemodules/script_nite2.cmake REQUIRED) # Check for NITE2 library
include(cmakemodules/script_octomap.cmake REQUIRED) # Check for the octomap library
Expand Down
54 changes: 54 additions & 0 deletions cmakemodules/script_nanogui.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Declares external project: nanogui
# https://github.com/wjakob/nanogui
# ===================================================
set(CMAKE_MRPT_HAS_NANOGUI 0)
set(CMAKE_MRPT_HAS_NANOGUI_SYSTEM 0)

set(EMBEDDED_NANOGUI_DIR "${MRPT_BINARY_DIR}/otherlibs/nanogui")

set(BUILD_NANOGUI ON CACHE BOOL "Build an embedded version of nanogui (OpenGL GUIs)")
if (BUILD_NANOGUI)
include(ExternalProject)

set(nanogui_PREFIX "${MRPT_BINARY_DIR}/otherlibs/nanogui")
set(nanogui_INSTALL_DIR "${MRPT_BINARY_DIR}/otherlibs/nanogui/install")
set(nanogui_CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${nanogui_INSTALL_DIR}
-DNANOGUI_BUILD_PYTHON=OFF
-DNANOGUI_BUILD_EXAMPLE=OFF
-DCMAKE_LIBRARY_OUTPUT_PATH=${MRPT_BINARY_DIR}/lib
-DLIBRARY_OUTPUT_PATH=${MRPT_BINARY_DIR}/lib
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${MRPT_BINARY_DIR}/bin
-DRUNTIME_OUTPUT_DIRECTORY=${MRPT_BINARY_DIR}/bin
-DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}
)

# download from GH
ExternalProject_Add(EP_nanogui
PREFIX ${nanogui_PREFIX}
GIT_REPOSITORY https://github.com/wjakob/nanogui.git
GIT_SUBMODULES ext/eigen ext/glfw ext/nanovg # ext/pybind
INSTALL_DIR ${nanogui_INSTALL_DIR}
CMAKE_ARGS ${nanogui_CMAKE_ARGS}
)
set(CMAKE_MRPT_HAS_NANOGUI 1)
set(CMAKE_MRPT_HAS_NANOGUI_SYSTEM 0)
endif()

if (CMAKE_MRPT_HAS_ASSIMP)
if (NOT "${ASSIMP_LIBRARY_DIRS}" STREQUAL "")
link_directories("${ASSIMP_LIBRARY_DIRS}")
endif()

mark_as_advanced(ASSIMP_DIR)

if ($ENV{VERBOSE})
message(STATUS "Assimp:")
message(STATUS " ASSIMP_INCLUDE_DIRS: ${ASSIMP_INCLUDE_DIRS}")
message(STATUS " ASSIMP_CXX_FLAGS: ${ASSIMP_CXX_FLAGS}")
message(STATUS " ASSIMP_LINK_FLAGS: ${ASSIMP_LINK_FLAGS}")
message(STATUS " ASSIMP_LIBRARIES: ${ASSIMP_LIBRARIES}")
message(STATUS " ASSIMP_LIBRARY_DIRS: ${ASSIMP_LIBRARY_DIRS}")
message(STATUS " ASSIMP_VERSION: ${ASSIMP_VERSION}")
endif ($ENV{VERBOSE})
endif (CMAKE_MRPT_HAS_ASSIMP)
3 changes: 2 additions & 1 deletion cmakemodules/script_show_final_summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ SHOW_CONFIG_LINE_SYSTEM("yamlcpp (YAML file format) " CMAKE_MRPT_HAS_YA
message(STATUS "")

message(STATUS " ______________________ GUI LIBRARIES ______________________")
SHOW_CONFIG_LINE ("wxWidgets " CMAKE_MRPT_HAS_WXWIDGETS)
SHOW_CONFIG_LINE ("nanogui (OpenGL GUI) " CMAKE_MRPT_HAS_NANOGUI)
SHOW_CONFIG_LINE ("Qt5 " CMAKE_MRPT_HAS_Qt5)
SHOW_CONFIG_LINE ("wxWidgets " CMAKE_MRPT_HAS_WXWIDGETS)
message(STATUS "")

message(STATUS " _______________________ WRAPPERS/BINDINGS ______________________")
Expand Down
3 changes: 3 additions & 0 deletions parse-files/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ ${CMAKE_MRPT_BUILD_SHARED_LIB}

#define MRPT_HAS_Qt5 ${CMAKE_MRPT_HAS_Qt5}

#define MRPT_HAS_NANOGUI ${CMAKE_MRPT_HAS_NANOGUI}
#define MRPT_HAS_NANOGUI_SYSTEM ${CMAKE_MRPT_HAS_NANOGUI_SYSTEM}

/** Has MRPT libjpeg? And whether it's in the system (Linux) or built-in (Windows, some rare cases in Linux). */
#define MRPT_HAS_JPEG ${CMAKE_MRPT_HAS_JPEG}
#define MRPT_HAS_JPEG_SYSTEM ${CMAKE_MRPT_HAS_JPEG_SYSTEM}
Expand Down

0 comments on commit 5e00b29

Please sign in to comment.