STORM-IRIT / Radium-Engine

Research 3D Engine for rendering, animation and processing
https://storm-irit.github.io/Radium-Engine/
Apache License 2.0
100 stars 50 forks source link

Missing guards in HeadlessExample #979

Closed nmellado closed 2 years ago

nmellado commented 2 years ago

When glfw3 is not installed, the example HeadlessExample is still included in the cmake build chain, causing cmake to fail at configure time (headless component is not found).

dlyr commented 2 years ago

This should be done with Radium_FOUND test, which search for headless component, which is available if glfw is found ... Maybe something is wrong with this find_package

nmellado commented 2 years ago

I think we only miss QUIET

MathiasPaulin commented 2 years ago

I'll verify but the exemple is included in the build chain using

find_package(Radium COMPONENTS Headless QUIET)
if(Radium_FOUND)
    add_subdirectory(HeadlessExample)
    add_dependencies(${PROJECT_NAME} HeadlessExample)
    add_dependencies(Install_${PROJECT_NAME} Install_HeadlessExample)
endif()

So there is a guard, thereis the QUIET parameter ... and it works on several ci that do not have glfw3 installed. What is the branch you use ?

nmellado commented 2 years ago

In the source tree we have https://github.com/STORM-IRIT/Radium-Engine/blob/73e91bd368b10e83e5e9481b2c564ceb5f3b7ee5/examples/HeadlessExample/CMakeLists.txt#L26

and this is the line that failed on @Marina2468's computer, before I installed the glfw3-dev package.

I guess the problem comes from the successive calls to find_package: https://github.com/STORM-IRIT/Radium-Engine/blob/73e91bd368b10e83e5e9481b2c564ceb5f3b7ee5/examples/CMakeLists.txt#L35-L46 -> Radium will be found at the first call, and I guess that RADIUM_FOUND will be set. Shall we look explicitly for the headless package in the if() instead ?

MathiasPaulin commented 2 years ago

The actual release-candidate branch configure the example without HeadlessExample when the headless component is not configured/installed. I tested by configuring and installing Radium with "-DRADIUM_GENERATE_LIB_HEADLESS=OFF". In the build tree, Headless example was not configured due to the absence of Headless component, that is the expected behavior. By using Radium example as an independant project, fetching Radium from the install tree, headless example is not configured that is also the expected behavior. Could you please post the full log of the configuration so that we can understand what is wrong ?

MathiasPaulin commented 2 years ago

Hereare my logs : When glfw3 is not found (see the warning at the beginning of my log extraction), headless component is not configured (see the list Actual configured components) nor the headless examples (no HeadlessExample in the list of configured example).

We can improve the display of the configuration summary to have the RADIUM_GENERATE_LIB_HEADLESS set to OFF but this will not change the good behavior of the release-candidate branch.


...

CMake Warning at src/Headless/CMakeLists.txt:17 (message):
  glfw3 package not found.  Headless component is disabled

-- [Examples] [configure_radium_app] Configuring application CoreExample for being relocatable after installation.
-- [Examples] Found WrapAtomic: TRUE  
-- [Examples] Found WrapOpenGL: TRUE  
-- [Examples] [configure_radium_app] Configuring application CustomCameraManipulator for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application DrawPrimitives for being relocatable after installation.
-- [Examples] [configure_bundled_radium_app] Registering resources  Radium-Engine/examples/DrawPrimitives/Assets for DrawPrimitives 
-- [Examples] [install_target_resources] Linking resources directory Radium-Engine/examples/DrawPrimitives/Assets for target DrawPrimitives into build dir  Radium-Engine/cmake-build-relwithdebinfo-clang/examples/DrawPrimitives/DrawPrimitives.app/Contents/Resources/Examples/DrawPrimitives/Assets
-- [Examples] [install_target_resources] Installing resources for target DrawPrimitives into Resources/Examples/DrawPrimitives/Assets
-- [Examples] [configure_radium_app] Configuring application EntityAnimation for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application EnvMap for being relocatable after installation.
-- [Examples] [configure_cmdline_radium_app] Registering resources  Radium-Engine/examples/EnvMap/Assets for EnvMap 
-- [Examples] [install_target_resources] Linking resources directory  Radium-Engine/examples/EnvMap/Assets for target EnvMap into build dir  Radium-Engine/cmake-build-relwithdebinfo-clang/examples/EnvMap/../Resources/Examples/EnvMap/Assets
-- [Examples] [install_target_resources] Installing resources for target EnvMap into Resources/Examples/EnvMap/Assets
-- [Examples] [configure_radium_app] Configuring application HelloRadium for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application KeyEvent for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application Picking for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application RawShaderMaterial for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application SimpleAnimation for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application SimpleSimulation for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application TexturedQuad for being relocatable after installation.
-- [Examples] [configure_radium_app] Configuring application Volume for being relocatable after installation.
-- [Examples] [configure_cmdline_radium_app] Registering resources Radium-Engine/examples/Volume/Assets for Volume 
-- [Examples] [install_target_resources] Linking resources directory Radium-Engine/examples/Volume/Assets for target Volume into build dir Radium-Engine/cmake-build-relwithdebinfo-clang/examples/Volume/../Resources/Examples/Volume/Assets
-- [Examples] [install_target_resources] Installing resources for target Volume into Resources/Examples/Volume/Assets
-- [Examples] [Plugins sharing lib] : configure library UpstreamLibrary
-- [Examples] [install_target_resources] Linking resources directory Radium-Engine/examples/PluginsWithLib/Upstream/Library/LibraryResources for target UpstreamLibrary into build dir Radium-Engine/cmake-build-relwithdebinfo-clang/examples/PluginsWithLib/Upstream/Library/../Resources//LibraryResources
-- [Examples] [install_target_resources] Installing resources for target UpstreamLibrary into Resources//LibraryResources
-- [Examples] [Plugins sharing lib] : configure plugin UpstreamPlugin
-- [Examples] [configure_radium_plugin] Install the helper library UpstreamLibrary for plugin UpstreamPlugin into Radium-Engine/Bundle-Clang-RelWithDebInfo/PluginsExample/lib
-- [Examples] [configure_radium_plugin] Installing UpstreamLibrary resources inRadium-Engine/Bundle-Clang-RelWithDebInfo/PluginsExample/Resources/
-- [Examples] [Plugins sharing lib] : configure plugin DownstreamPlugin
-- [Examples] Configuring the plugin DownstreamPlugin
-- [Examples] [configure_radium_plugin] Install the helper library RadiumExamples::UpstreamLibrary for plugin DownstreamPlugin into Radium-Engine/Bundle-Clang-RelWithDebInfo/PluginsExample/lib
-- [Examples] [configure_radium_plugin] Installing RadiumExamples::UpstreamLibrary resources in Radium-Engine/Bundle-Clang-RelWithDebInfo/PluginsExample/Resources/
-- [Tests] [Sanitizers] Sanitizers:
-- [Tests] [Sanitizers]   + ADDRESS_SANITIZER                     OFF
-- [Tests] [Sanitizers]   + UB_SANITIZER                          OFF
-- [Tests] [Sanitizers]   + THREAD_SANITIZER                      OFF
-- [Tests] [Sanitizers]   + MEMORY_SANITIZER                      OFF
-- [Tests] Already downloaded: https://github.com/catchorg/Catch2.git
-- [Tests] could not run HeadlessExample integration test, missing tools XVFB_EXECUTABLE-NOTFOUND
-- [Tests] could not run HeadlessExample integration test, missing tools XVFB_EXECUTABLE-NOTFOUND, /opt/local/bin/compare

┌────────────────────┤│ Final overview for radiumproject │├─────────────────────┐
│                                                                               │
│ Version:               1.2.53 @ nicolede.local                                │
│ Git Changeset: 73e91bd368b10e83e5e9481b2c564ceb5f3b7ee5                       │
│                                                                               │
│ Install prefix:                                                               │
│   Radium-Engine/Bundle-Clang-RelWithDebInfo                                   │
│                                                                               │
│ Compiler: /opt/local/bin/clang++ - Clang in version 11.1.0.                   │
│ CMAKE_BUILD_TYPE               RelWithDebInfo                                 │
│   possible options: Debug Release RelWithDebInfo MinSizeRel                   │
│   set with ` cmake -DCMAKE_BUILD_TYPE=Debug .. `                              │
│                                                                               │
│ RADIUM_ENABLE_EXAMPLES         ON                                             │
│ RADIUM_ENABLE_TESTING          ON                                             │
│ RADIUM_ENABLE_COVERAGE         OFF                                            │
│ RADIUM_ENABLE_PCH              OFF                                            │
│ RADIUM_USE_DOUBLE              OFF                                            │
│ RADIUM_GENERATE_LIB_CORE       ON                                             │
│ RADIUM_GENERATE_LIB_ENGINE     ON                                             │
│ RADIUM_GENERATE_LIB_GUI        ON                                             │
│ RADIUM_GENERATE_LIB_HEADLESS   ON                                             │
│ RADIUM_GENERATE_LIB_IO         ON                                             │
│ RADIUM_GENERATE_LIB_PLUGINBASE ON                                             │
│  -- Actual configured components: Core Engine IO PluginBase Gui               │
│ RADIUM_GIT_UPDATE_SUBMODULE    ON                                             │
│ RADIUM_IO_ASSIMP               ON                                             │
│ RADIUM_IO_TINYPLY              ON                                             │
│ RADIUM_IO_VOLUMES              ON                                             │
│ RADIUM_IO_DEPRECATED           ON                                             │
│ RADIUM_INSTALL_DOC             OFF                                            │
│ RADIUM_UPDATE_VERSION          OFF                                            │
│ RADIUM_QUIET                   OFF                                            │
│ USE_GOLD_LINKER                [undef]                                        │
│ QT_DEFAULT_MAJOR_VERSION       6                                              │
└───────────────────────────────────────────────────────────────────────────────┘

-- Configuring done
-- Generating done
dlyr commented 2 years ago

I have one error with tests when glfw3 is not foud. Hence there is no check in integration to see if HeadlessExample is a target.

CMake Error at tests/integration/CMakeLists.txt:135 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:HeadlessExample>

  No target "HeadlessExample"
dlyr commented 2 years ago

And the message about actual configured component do not show headless

MathiasPaulin commented 2 years ago

Thereare some improvement to do (I also reach to the one in integration but I found it not related to the actual issues talking about examples). I'll push a PR with some improvement in a few minutes.

MathiasPaulin commented 2 years ago

I also got an error from a fresh build, without glfw3

I'm not able to reproduce this error. fresh build (as always to verify an issue), glfw3 not installed But I just found the reason. I'll update the PR.

MathiasPaulin commented 2 years ago

OK, fixed (not pushed yet). I suppose the example were not configured (RADIUM_ENABLE_EXAMPLES set to OFF) and the testing was requested (RADIUM_ENABLE_TESTING set to ON) on your failure cases. This produce the bug. Having all the logs for an issue (or, at least the exact configuration used (the config summary at the end of the log) could be helpful