From 21993f033463d3a491022bb378d0d9aed79f233b Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Mon, 16 Sep 2024 22:40:43 +0200 Subject: [PATCH] examples/depth_camera: Fixed windows usage (#1060) Signed-off-by: Martin Pecka --- examples/depth_camera/CMakeLists.txt | 4 +++- examples/depth_camera/Main.cc | 5 +++++ tutorials/23_depth_camera_tutorial.md | 13 ++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/depth_camera/CMakeLists.txt b/examples/depth_camera/CMakeLists.txt index a29651028..79d9a471c 100644 --- a/examples/depth_camera/CMakeLists.txt +++ b/examples/depth_camera/CMakeLists.txt @@ -20,7 +20,9 @@ if (NOT APPLE) link_directories(${GLEW_LIBRARY_DIRS}) endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +if(NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") +endif() configure_file (example_config.hh.in ${PROJECT_BINARY_DIR}/example_config.hh) diff --git a/examples/depth_camera/Main.cc b/examples/depth_camera/Main.cc index ac715ce5c..c461b5408 100644 --- a/examples/depth_camera/Main.cc +++ b/examples/depth_camera/Main.cc @@ -38,8 +38,13 @@ using namespace gz; using namespace rendering; +#if not defined(_WIN32) const std::string RESOURCE_PATH = common::joinPaths(std::string(PROJECT_BINARY_PATH), "media"); +#else +const std::string RESOURCE_PATH = + common::joinPaths(std::string(PROJECT_BINARY_PATH), "..", "media"); +#endif void buildScene(ScenePtr _scene) { diff --git a/tutorials/23_depth_camera_tutorial.md b/tutorials/23_depth_camera_tutorial.md index 40712202c..f4c7cb379 100644 --- a/tutorials/23_depth_camera_tutorial.md +++ b/tutorials/23_depth_camera_tutorial.md @@ -7,7 +7,11 @@ This example shows how to use the depth camera. In order to compile this tutorial, you need to install some prerequisites : ```bash +# Linux sudo apt-get install build-essential freeglut3-dev libglew-dev + +# Windows (via conda) +conda install glew --channel conda-forge ``` ## Compile and run the example @@ -20,13 +24,20 @@ cd gz-rendering/examples/depth_camera mkdir build cd build cmake .. -make +# On Linux +cmake --build . +# On Windows +cmake --build . --config Release ``` Execute the example: ```{.sh} +# Linux ./depth_camera ogre + +# Windows +.\Release\depth_camera.exe ogre ``` You'll see: