Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ endif()

include(CompilerFlags)

###############################################################################
# Include utility functions for setting debugging environments

include(DebuggerEnvironment)

###############################################################################
# External linking options

Expand Down
27 changes: 27 additions & 0 deletions share/cmake/utils/DebuggerEnvironment.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.


###############################################################################
# Define a function to set debugger environment so that the run time
# dependencies can be located by the debugger.

function(set_debugger_env target_name)
cmake_parse_arguments(ARG "NEEDS_GL" "" "" ${ARGN})

if(NOT TARGET ${target_name})
message(FATAL_ERROR "set_debugger_env: '${target_name}' is not a CMake target")
endif()

# Set the Paths for Visual Studio IDE Debugger.
if(MSVC)
if(OCIO_GL_ENABLED AND ARG_NEEDS_GL)
# Add folders for glut and glew DLLs.
set(extra_dirs "${GLUT_INCLUDE_DIR}/../bin;${GLEW_INCLUDE_DIRS}/../bin")
endif()

set_property(TARGET ${target_name} PROPERTY
VS_DEBUGGER_ENVIRONMENT "PATH=$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:${target_name}>,;>;${extra_dirs};%PATH%"
)
endif()
endfunction()
4 changes: 4 additions & 0 deletions src/apps/ocioarchive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ ocio_strip_binary(ocioarchive)
install(TARGETS ocioarchive
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ocioarchive)
4 changes: 4 additions & 0 deletions src/apps/ociobakelut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ ocio_strip_binary(ociobakelut)
install(TARGETS ociobakelut
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociobakelut)
4 changes: 4 additions & 0 deletions src/apps/ociocheck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ ocio_strip_binary(ociocheck)
install(TARGETS ociocheck
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociocheck)
4 changes: 4 additions & 0 deletions src/apps/ociochecklut/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ ocio_strip_binary(ociochecklut)
install(TARGETS ociochecklut
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociochecklut NEEDS_GL)
4 changes: 4 additions & 0 deletions src/apps/ocioconvert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ ocio_strip_binary(ocioconvert)
install(TARGETS ocioconvert
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ocioconvert NEEDS_GL)
4 changes: 4 additions & 0 deletions src/apps/ociodisplay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ ocio_strip_binary(ociodisplay)
install(TARGETS ociodisplay
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociodisplay NEEDS_GL)
4 changes: 4 additions & 0 deletions src/apps/ociolutimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ ocio_strip_binary(ociolutimage)
install(TARGETS ociolutimage
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociolutimage)
4 changes: 4 additions & 0 deletions src/apps/ociomakeclf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ ocio_strip_binary(ociomakeclf)
install(TARGETS ociomakeclf
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociomakeclf)
4 changes: 4 additions & 0 deletions src/apps/ociomergeconfigs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ ocio_strip_binary(ociomergeconfigs)
install(TARGETS ociomergeconfigs
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociomergeconfigs)
4 changes: 4 additions & 0 deletions src/apps/ocioperf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ ocio_strip_binary(ocioperf)
install(TARGETS ocioperf
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ocioperf)
4 changes: 4 additions & 0 deletions src/apps/ociowrite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ ocio_strip_binary(ociowrite)
install(TARGETS ociowrite
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Set the debugger environment so that the executable can be launched
# directly within IDE (e.g. Visual Studio).
set_debugger_env(ociowrite)
22 changes: 13 additions & 9 deletions tests/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ endif()

# Note: To avoid changing PATH from outside the cmake files.
if(MSVC AND BUILD_SHARED_LIBS)
# Build time list of runtime dll dirs for the exe target.
set(dll_dirs_expr "$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:test_gpu_exec>,;>")

if (MSVC_IDE)
# Note: By default Microsoft Visual Studio editor happens the build type to the build directory.
set(BUILD_TYPE ${CMAKE_BUILD_TYPE})
endif()
# Add folders for glut and glew DLLs.
set(extra_dirs "${GLUT_INCLUDE_DIR}/../bin;${GLEW_INCLUDE_DIRS}/../bin")

set(NEW_PATH "${PROJECT_BINARY_DIR}/src/OpenColorIO/${BUILD_TYPE}")
set(NEW_PATH "${NEW_PATH}\\\;${GLUT_INCLUDE_DIR}/../bin")
set(NEW_PATH "${NEW_PATH}\\\;${GLEW_INCLUDE_DIRS}/../bin")

set_tests_properties(test_gpu PROPERTIES ENVIRONMENT PATH=${NEW_PATH})
# Tell CTest to use this PATH while launching test_gpu_exec
set_tests_properties(test_gpu PROPERTIES
ENVIRONMENT "PATH=${dll_dirs_expr};${extra_dirs};$ENV{PATH}"
)

# Also set the debugger environment so that you can launch
# test_gpu_exec directly within Visual Studio.
set_property(TARGET test_gpu_exec PROPERTY
VS_DEBUGGER_ENVIRONMENT "PATH=${dll_dirs_expr};${extra_dirs};%PATH%"
)
endif()