Skip to content

Commit

Permalink
Merge pull request STORM-IRIT#1016 from dlyr/updateExternals
Browse files Browse the repository at this point in the history
[external] update globjects and glm.
  • Loading branch information
nmellado authored Oct 26, 2022
2 parents e48bc73 + 7a9fc57 commit a1d72ee
Show file tree
Hide file tree
Showing 35 changed files with 166 additions and 682 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ jobs:
echo "$GITHUB_WORKSPACE/build/Radium-Engine/src/PluginBase" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/glfw_install/lib/cmake/glfw3/" >> $GITHUB_PATH
echo "${{ env.ext-dir }}/bin" >> $GITHUB_PATH
echo "${{ env.ext-dir }}/glbinding" >> $GITHUB_PATH
echo "${{ env.ext-dir }}/globjects" >> $GITHUB_PATH
- name: Prepare directories
run: |
mkdir -p install/
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ endif()

# Packaging stuff (deb, rpm, windows installer) add_subdirectory(packaging)

install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT meta)
install(FILES README.md DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT meta)
install(FILES LICENSE README.md TYPE DATA)

# -------------------------------------------------------------------------------
# Wrap up of settings printed on build
Expand Down
7 changes: 7 additions & 0 deletions cmake/ExternalInclude.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ endmacro()
macro(check_externals_prerequisite)
find_package(Git REQUIRED)
endmacro()

macro(set_external_dir MODULE PATH)
list(APPEND RADIUM_EXTERNALS ${MODULE})
set(RADIUM_EXTERNALS ${RADIUM_EXTERNALS} PARENT_SCOPE)
set(${MODULE}_DIR "${CMAKE_INSTALL_PREFIX}/${PATH}")
set(${MODULE}_DIR "${${MODULE}_DIR}" PARENT_SCOPE)
endmacro()
12 changes: 0 additions & 12 deletions cmake/RadiumSetupFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1026,18 +1026,6 @@ function(configure_radium_library)
endforeach()
endfunction()

# Simple macro to populate LocalDependencies variable according to cmake args NAME is the name of
# the variable to test, e.g. "Eigen3_DIR"
macro(populate_local_dependencies)
set(oneValueArgs NAME)
cmake_parse_arguments(CHECKDEP "DUMMY_OPTION" "${oneValueArgs}" "DUMMY_MULTI" ${ARGN})
if(${CHECKDEP_NAME})
string(REPLACE "\\" "/" CHECKDEP_STRING ${${CHECKDEP_NAME}})
set(LocalDependencies "${LocalDependencies};-D${CHECKDEP_NAME}=${CHECKDEP_STRING}")
set(LocalDependencies ${LocalDependencies} PARENT_SCOPE)
endif()
endmacro()

# cmake debug helper function to list "all" target properties
# https://stackoverflow.com/questions/32183975/how-to-print-all-the-properties-of-a-target-in-cmake
function(print_target_properties tgt)
Expand Down
5 changes: 2 additions & 3 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,9 @@ if(DOXYGEN_FOUND)
COMMENT "Generating API documentation with Doxygen"
)

# Where docs will be installed. Note: if docs shall be not a part of final release, leave this
# commented out docs will be only available in [build_dir]/doc/doc/index.html
# Where docs will be installed.
if(RADIUM_INSTALL_DOC)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/ OPTIONAL)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html TYPE DOC OPTIONAL)
endif()
endif()

Expand Down
7 changes: 4 additions & 3 deletions doc/basics/compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ For instance, with directory structure for externals as defined in \ref dependen
"environments": [
{
"QtDir": "C:/Qt/5.15.2/msvc2019_64/"
"glfwDir" : "C:/path/to/glfwInstallation"
"glfwDir" : "C:/path/to/glfwInstallation",
"ExternalInstallDir": "${projectDir}/../radium-externals/install"
}
],
"configurations": [
Expand All @@ -221,7 +222,7 @@ For instance, with directory structure for externals as defined in \ref dependen
"environments": [
{
"environment": "RadiumDllsLocations",
"ExternalDllsDIR": "${projectDir}/../radium-externals/install/${name}/bin",
"ExternalDllsDIR": "${env.ExternalInstallDir}/${name}/bin;${env.ExternalInstallDir}/${name}/glbinding;${env.ExternalInstallDir}/${name}/globjects",
"QtDllsDIR": "${env.QtDir}/bin",
"RadiumDlls": "${buildRoot}/src/Core;${buildRoot}/src/Engine;${buildRoot}/src/Gui;${buildRoot}/src/Headless;${buildRoot}/src/IO;${buildRoot}/src/PluginBase"
}
Expand All @@ -240,7 +241,7 @@ For instance, with directory structure for externals as defined in \ref dependen
"environments": [
{
"environment": "RadiumDllsLocations",
"ExternalDllsDIR": "${projectDir}/../radium-externals/install/${name}/bin",
"ExternalDllsDIR": "${env.ExternalInstallDir}/${name}/bin;${env.ExternalInstallDir}/${name}/glbinding;${env.ExternalInstallDir}/${name}/globjects",
"QtDllsDIR": "${env.QtDir}/bin",
"RadiumDlls": "${buildRoot}/src/Core;${buildRoot}/src/Engine;${buildRoot}/src/Gui;${buildRoot}/src/Headless;${buildRoot}/src/IO;${buildRoot}/src/PluginBase"
}
Expand Down
81 changes: 35 additions & 46 deletions doc/basics/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ For convenience, dependencies install procedure create a configuration file, you
The cmake config file `/path/to/external/install/radium-options.cmake` contains, depending on your dependency configuration:

~~~{.cmake}
set(RADIUM_DEP_PREFIX "/path/to/external/install/")
set(Eigen3_DIR "${RADIUM_DEP_PREFIX}/share/eigen3/cmake/" CACHE PATH "My Eigen")
set(OpenMesh_DIR "${RADIUM_DEP_PREFIX}/share/OpenMesh/cmake/" CACHE PATH "My OpenMesh")
set(cpplocate_DIR "${RADIUM_DEP_PREFIX}/share/cpplocate/" CACHE PATH "My cpplocate")
set(glm_DIR "${RADIUM_DEP_PREFIX}/lib/cmake/glm/" CACHE PATH "My glm")
set(glbinding_DIR "${RADIUM_DEP_PREFIX}/share/glbinding/" CACHE PATH "My glbinding")
set(globjects_DIR "${RADIUM_DEP_PREFIX}/share/globjects/" CACHE PATH "My globjects")
set(stb_DIR "${RADIUM_DEP_PREFIX}/include/stb/" CACHE PATH "My stb")
set(assimp_DIR "${RADIUM_DEP_PREFIX}/lib/cmake/assimp-5.0/" CACHE PATH "My assimp")
set(tinyply_DIR "${RADIUM_DEP_PREFIX}/lib/cmake/tinyply/" CACHE PATH "My tinyply")
set(tinyEXR_DIR "${RADIUM_DEP_PREFIX}/share/tinyEXR/cmake/" CACHE PATH "My tinyEXR")
set(nlohmann_json_DIR "${RADIUM_DEP_PREFIX}/lib/cmake/nlohmann_json/" CACHE PATH "My json")
set(PowerSlider_DIR "${RADIUM_DEP_PREFIX}/lib/cmake/PowerSlider/" CACHE PATH "My PowerSlider")
set(RADIUM_IO_ASSIMP ON CACHE BOOL "Radium uses assimp io")
set(RADIUM_IO_TINYPLY ON CACHE BOOL "Radium uses tinyply io")
set(Eigen3_DIR "/path/to/external/install/share/eigen3/cmake/" CACHE PATH "My Eigen3 location")
set(OpenMesh_DIR "/path/to/external/install/share/OpenMesh/cmake/" CACHE PATH "My OpenMesh location")
set(cpplocate_DIR "/path/to/external/install/share/cpplocate/" CACHE PATH "My cpplocate location")
set(nlohmann_json_DIR "/path/to/external/install/lib/cmake/nlohmann_json/" CACHE PATH "My nlohmann_json location")
set(glm_DIR "/path/to/external/install/glm/lib/cmake/glm/" CACHE PATH "My glm location")
set(glbinding_DIR "/path/to/external/install/glbinding/" CACHE PATH "My glbinding location")
set(globjects_DIR "/path/to/external/install/globjects/" CACHE PATH "My globjects location")
set(stb_DIR "/path/to/external/install/include/stb/" CACHE PATH "My stb location")
set(stb_INCLUDE_DIR "/path/to/external/install/include/" CACHE PATH "My stb_INCLUDE location")
set(tinyEXR_DIR "/path/to/external/install/share/tinyEXR/cmake/" CACHE PATH "My tinyEXR location")
set(assimp_DIR "/path/to/external/install/lib/cmake/assimp-5.0/" CACHE PATH "My assimp location")
set(tinyply_DIR "/path/to/external/install/lib/cmake/tinyply/" CACHE PATH "My tinyply location")
set(PowerSlider_DIR "/path/to/external/install/lib/cmake/PowerSlider/" CACHE PATH "My PowerSlider location")
set(RADIUM_IO_ASSIMP ON CACHE BOOL "Radium uses assimp io")
set(RADIUM_IO_TINYPLY ON CACHE BOOL "Radium uses tinyply io")
~~~

When configuring Radium cmake project, don't forget to add this file by calling `cmake -C /path/to/external/install/radium-options.cmake ......`
Expand All @@ -108,19 +108,8 @@ You can also provide these variables as cmake command line argument:

~~~{.bash}
cmake \
-DEigen3_DIR /path/to/external/install/share/eigen3/cmake/ \
-DOpenMesh_DIR /path/to/external/install/share/OpenMesh/cmake/ \
-Dcpplocate_DIR /path/to/external/install/share/cpplocate/ \
-Dnlohmann_json_DIR /path/to/external/install/lib/cmake/nlohmann_json/ \
-Dglm_DIR /path/to/external/install/lib/cmake/glm/ \
-Dglbinding_DIR /path/to/external/install/share/glbinding/ \
-Dglobjects_DIR /path/to/external/install/share/globjects/ \
-DPowerSlider_DIR /path/to/external/install/lib/cmake/PowerSlider \
-Dstb_DIR /path/to/external/install/include/stb/ \
-Dassimp_DIR /path/to/external/install/lib/cmake/assimp-5.0/ \
-Dtinyply_DIR /path/to/external/install/lib/cmake/tinyply/ \
-DtinyEXR_DIR /path/to/external/install/share/tinyEXR/cmake/ \
.......
-DEigen3_DIR /path/to/external/install/share/eigen3/cmake/
... and so on ...
~~~

# User provided external dependencies
Expand All @@ -131,10 +120,6 @@ To this end, just provide the corresponding '*_DIR' to cmake at configuration ti
Currently supported (note that these paths must refer to the installation directory of the corresponding library):
<!-- (generated running ../script/list_dep.py from Radium-Engine/external directory) -->

* `Eigen3_DIR`
* `OpenMesh_DIR`
* `cpplocate_DIR`
* `nlohmann_json_DIR`
* `assimp_DIR`
* `tinyply_DIR`
* `PowerSlider_DIR`
Expand All @@ -143,33 +128,37 @@ Currently supported (note that these paths must refer to the installation direct
* `globjects_DIR`
* `stb_DIR`
* `tinyEXR_DIR`
* `Eigen3_DIR`
* `OpenMesh_DIR`
* `cpplocate_DIR`
* `nlohmann_json_DIR`

Radium is compiled and tested with specific version of dependencies, as given in the external's folder CMakeLists.txt and state here for the record

* Eigen3: https://gitlab.com/libeigen/eigen.git, [e80ec243],
* with options `-DEIGEN_TEST_CXX11=OFF -DBUILD_TESTING=OFF -DEIGEN_BUILD_DOC=OFF`
* OpenMesh: https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git, [tags/OpenMesh-8.1],
* with options `-DBUILD_APPS=OFF`
* cpplocate: https://github.com/cginternals/cpplocate.git, [tags/v2.2.0],
* with options `-DOPTION_BUILD_TESTS=OFF -DOPTION_BUILD_DOCS=OFF`
* nlohmann_json: https://github.com/nlohmann/json.git, [release/3.10.5],
* with options `-DJSON_Install=ON -DJSON_BuildTests=OFF`
* assimp: https://github.com/assimp/assimp.git, [tags/v5.0.1],
* with options `-DASSIMP_BUILD_ASSIMP_TOOLS=False -DASSIMP_BUILD_SAMPLES=False -DASSIMP_BUILD_TESTS=False -DIGNORE_GIT_HASH=True -DASSIMP_NO_EXPORT=True`
* tinyply: https://github.com/ddiakopoulos/tinyply.git, [tags/2.3.2],
* with options `-DSHARED_LIB=TRUE`
* PowerSlider: https://github.com/dlyr/PowerSlider.git, [origin/master],
* with options `-DBUILD_DESIGNER_PLUGIN=OFF -DBUILD_EXAMPLE_APP=OFF`
* glm: https://github.com/g-truc/glm.git, [0.9.9.5],
* with options `-DGLM_TEST_ENABLE=OFF -DBUILD_STATIC_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib`
* glbinding: https://github.com/cginternals/glbinding.git, [663e19cf1ae6a5fa1acfb1bd952fc43f647ca79c],
* with options `-DOPTION_BUILD_TESTS=OFF -DOPTION_BUILD_DOCS=OFF -DOPTION_BUILD_TOOLS=OFF -DOPTION_BUILD_EXAMPLES=OFF`
* globjects: https://github.com/dlyr/globjects.git, [11c559a07d9e310abb2f53725fd47cfaf538f8b1],
* with options `-DOPTION_BUILD_DOCS=OFF -DOPTION_BUILD_EXAMPLES=OFF -DOPTION_USE_EIGEN=ON -Dglbinding_DIR=${glbinding_DIR} -Dglm_DIR=${glm_DIR} -DEigen3_DIR=${Eigen3_DIR}`
* glm: https://github.com/g-truc/glm.git, [cc98465e3508535ba8c7f6208df934c156a018dc],
* with options `-DGLM_TEST_ENABLE=OFF -DBUILD_STATIC_LIBS=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>`
* glbinding: https://github.com/cginternals/glbinding.git, [758d33b4d4f1815d46d91fcf4ca4914d837267fa],
* with options `-DOPTION_BUILD_TESTS=OFF -DOPTION_BUILD_DOCS=OFF -DOPTION_BUILD_TOOLS=OFF -DOPTION_BUILD_EXAMPLES=OFF -DOPTION_BUILD_OWN_KHR_HEADERS=ON -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>`
* globjects: https://github.com/cginternals/globjects.git, [4363356ae2ef5c936ab078fba48d1ea507c295c4],
* with options `-DOPTION_BUILD_DOCS=OFF -DOPTION_BUILD_EXAMPLES=OFF -DOPTION_USE_EIGEN=ON -Dglbinding_DIR=${glbinding_DIR} -Dglm_DIR=${glm_DIR} -DEigen3_DIR=${Eigen3_DIR} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>`
* stb: https://github.com/nothings/stb.git, [1034f5e5c4809ea0a7f4387e0cd37c5184de3cdd],
* with options `None`
* tinyEXR: https://github.com/MathiasPaulin/tinyexr.git, [origin/radium],
* with options `-DBUILD_INSTALLABLE_LIB=ON`
* Eigen3: https://gitlab.com/libeigen/eigen.git, [tags/3.4.0],
* with options `-DEIGEN_TEST_CXX11=OFF -DBUILD_TESTING=OFF -DEIGEN_BUILD_DOC=OFF`
* OpenMesh: https://www.graphics.rwth-aachen.de:9000/OpenMesh/OpenMesh.git, [tags/OpenMesh-8.1],
* with options `-DBUILD_APPS=OFF`
* cpplocate: https://github.com/cginternals/cpplocate.git, [tags/v2.2.0],
* with options `-DOPTION_BUILD_TESTS=OFF -DOPTION_BUILD_DOCS=OFF`
* nlohmann_json: https://github.com/nlohmann/json.git, [tags/v3.10.5],
* with options `-DJSON_Install=ON -DJSON_BuildTests=OFF`

<!-- (end script copy) -->

Expand Down
23 changes: 19 additions & 4 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.13)
set(RADIUM_DEPENDENCIES_PROJECT_NAME radium_externals)
project(${RADIUM_DEPENDENCIES_PROJECT_NAME})

list(APPEND CMAKE_MESSAGE_INDENT "[Externals] ")

# prevent this cmake script to be used through a add_subdirectory of another project than
# ${RADIUM_DEPENDENCIES_PROJECT_NAME} ...
if(NOT CMAKE_PROJECT_NAME STREQUAL ${RADIUM_DEPENDENCIES_PROJECT_NAME})
Expand All @@ -12,6 +14,7 @@ if(NOT CMAKE_PROJECT_NAME STREQUAL ${RADIUM_DEPENDENCIES_PROJECT_NAME})
${CMAKE_PROJECT_NAME} !)"
)
else()
set(RADIUM_EXTERNALS "")
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

Expand Down Expand Up @@ -99,10 +102,22 @@ else()
# add Gui dependencies
add_subdirectory(Gui)

message(STATUS "Set install prefix to ${CMAKE_INSTALL_PREFIX}")
# generate radium-option.cmake configuration file
file(REMOVE "${CMAKE_INSTALL_PREFIX}/radium-options.cmake")
foreach(external IN_LIST ${RADIUM_EXTERNALS})
if(${external}_DIR)
file(
APPEND "${CMAKE_INSTALL_PREFIX}/radium-options.cmake"
"set(${external}_DIR \"${${external}_DIR}\" CACHE PATH \"My ${external} location\")\n"
)
endif()
endforeach()

configure_file(
"${CMAKE_CURRENT_LIST_DIR}/radium-options.cmake.in"
"${CMAKE_INSTALL_PREFIX}/radium-options.cmake" @ONLY
file(APPEND "${CMAKE_INSTALL_PREFIX}/radium-options.cmake"
"set(RADIUM_IO_ASSIMP ${RADIUM_IO_ASSIMP} CACHE BOOL \"Radium uses assimp io\")\n"
)
file(APPEND "${CMAKE_INSTALL_PREFIX}/radium-options.cmake"
"set(RADIUM_IO_TINYPLY ${RADIUM_IO_TINYPLY} CACHE BOOL \"Radium uses tinyply io\")\n"
)

endif()
14 changes: 10 additions & 4 deletions external/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ project(radiumcore-external VERSION 1.0.0)
include(ExternalProject)
include(ExternalInclude)

list(APPEND CMAKE_MESSAGE_INDENT "[Core] ")
string(REPLACE ";" "" indent_string "${CMAKE_MESSAGE_INDENT}")
set(indent_string "${indent_string}--")

# force installing by default all the external projects
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS install)

# Add fPIC for all dependencies
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
string(REPLACE ";" "" indent_string "${CMAKE_MESSAGE_INDENT}")
set(indent_string "${indent_string}--")

add_custom_target(CoreExternals ALL)

Expand All @@ -23,7 +25,7 @@ if(NOT DEFINED Eigen3_DIR)
Eigen3
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG tags/3.4.0
GIT_SHALLOW FALSE
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
PATCH_COMMAND git reset --hard && git apply -v --ignore-whitespace
"${CMAKE_CURRENT_LIST_DIR}/patches/eigen.patch"
Expand All @@ -32,6 +34,7 @@ if(NOT DEFINED Eigen3_DIR)
-DEIGEN_BUILD_DOC=OFF "-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies(CoreExternals Eigen3)
set_external_dir(Eigen3 "share/eigen3/cmake/")
else()
status_message("" "eigen3" ${Eigen3_DIR})
endif()
Expand All @@ -53,6 +56,7 @@ if(NOT DEFINED OpenMesh_DIR)
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies(CoreExternals OpenMesh)
set_external_dir(OpenMesh "share/OpenMesh/cmake/")
else()
status_message("" "OpenMesh" ${OpenMesh_DIR})
endif()
Expand All @@ -73,13 +77,14 @@ if(NOT DEFINED cpplocate_DIR OR NOT cpplocate_DIR)
-DOPTION_BUILD_DOCS=OFF -DCMAKE_MESSAGE_INDENT=${indent_string}\;
)
add_dependencies(CoreExternals cpplocate)
set_external_dir(cpplocate "share/cpplocate/")
else()
status_message("" "cpplocate" ${cpplocate_DIR})
endif()

if(NOT DEFINED nlohmann_json_DIR)
check_externals_prerequisite()
status_message("[CoreExternal]" "nlohmann_json" "remote git")
status_message("" "nlohmann_json" "remote git")
ExternalProject_Add(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
Expand All @@ -91,6 +96,7 @@ if(NOT DEFINED nlohmann_json_DIR)
"-DCMAKE_MESSAGE_INDENT=${indent_string}\;"
)
add_dependencies(CoreExternals nlohmann_json)
set_external_dir(nlohmann_json "lib/cmake/nlohmann_json/")
else()
status_message("" "nlohmann_json" ${nlohmann_json_DIR})
endif()
19 changes: 0 additions & 19 deletions external/Core/package.cmake

This file was deleted.

Loading

0 comments on commit a1d72ee

Please sign in to comment.