Skip to content

Commit 236bbd8

Browse files
committed
change RPATH for rayx-core, rayx-core-tst, rayx, rayx-ui
before, cmake determined RPATH automatically, using absolute paths this creates RPATHs which are not portable. Now CMake will add a relative RPATH. Additionally, following RPATHs are added: $ORIGIN # search next to the executable $ORIGIN/lib $ORIGIN/../lib
1 parent c4758b3 commit 236bbd8

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ set(CMAKE_CUDA_STANDARD 20)
1111
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
1212
# ------------------
1313

14+
# --- Prevent CMake from using absolute paths in RPATH. Use relative paths instead ---
15+
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
16+
# ------------------
17+
1418
# ---- Options ----
1519
option(RAYX_WERROR "add -Werror option. Warning will be treated as errors." OFF) # inactive per default
1620
if (RAYX_WERROR)

Intern/rayx-core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ endif()
5454

5555
# ---- Project ----
5656
project(rayx-core VERSION ${RAYX_VERSION})
57+
5758
file(GLOB_RECURSE SOURCE ${PROJECT_SOURCE_DIR}/src/*.cpp)
5859
file(GLOB_RECURSE ALPAKA_SOURCE
5960
${PROJECT_SOURCE_DIR}/src/Shader/*.cpp

Intern/rayx-core/tests/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ enable_testing()
77
set(BINARY rayx-core-tst)
88
file(GLOB_RECURSE SOURCE *.h *.cpp)
99
add_executable(${BINARY} ${SOURCE})
10+
set_target_properties(${BINARY} PROPERTIES
11+
BUILD_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib" # also $ORIGIN/../../lib/$<CONFIG> will be added automatically by CMake for multi-config generators
12+
INSTALL_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib" # TODO: review if this is necessary
13+
)
1014
add_test(NAME ${BINARY} COMMAND ${BINARY})
1115
# -----------------
1216

Intern/rayx-ui/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ if(Vulkan_FOUND)
1919

2020
add_executable(${PROJECT_NAME} WIN32 ${SOURCE} ${IMGUI_SOURCES})
2121

22+
set_target_properties(${PROJECT_NAME} PROPERTIES
23+
BUILD_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib"
24+
INSTALL_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib" # TODO: review if this is necessary
25+
)
26+
2227
if(MSVC)
2328
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
2429
if(RAYX_WERROR)

Intern/rayx/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
66

77
# ---- Project ----
88
project(rayx VERSION ${RAYX_VERSION})
9+
910
file(GLOB_RECURSE SOURCE ${PROJECT_SOURCE_DIR}/src/*.cpp)
1011
add_executable(${PROJECT_NAME} ${SOURCE})
12+
13+
set_target_properties(${PROJECT_NAME} PROPERTIES
14+
BUILD_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib"
15+
INSTALL_RPATH "$ORIGIN;$ORIGIN/lib;$ORIGIN/../lib" # TODO: review if this is necessary
16+
)
1117
# ------------------
1218

1319

0 commit comments

Comments
 (0)