Skip to content

Commit

Permalink
examples/depth_camera: Fixed windows usage (#1060)
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Pecka <[email protected]>
  • Loading branch information
peci1 authored Sep 16, 2024
1 parent 6cf203d commit 21993f0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/depth_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions examples/depth_camera/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
13 changes: 12 additions & 1 deletion tutorials/23_depth_camera_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 21993f0

Please sign in to comment.