Skip to content

Commit c4758b3

Browse files
committed
make targets optional at cmake configure time
1 parent 8dbe240 commit c4758b3

File tree

4 files changed

+43
-28
lines changed

4 files changed

+43
-28
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ option(RAYX_ENABLE_OPENMP "This option enables the search for OPENMP. Project wi
2323
option(RAYX_REQUIRE_OPENMP "If option 'RAYX_ENABLE_OPENMP' is ON, this option will add the requirement that openmp must be found." OFF)
2424
option(RAYX_ENABLE_H5 "This option enables the search for HDF5. Project will be compiled without HDF5 if not found." ON)
2525
option(RAYX_REQUIRE_H5 "If option 'RAYX_ENABLE_H5' is ON, this option will add the requirement that HDF5 must be found." OFF)
26+
option(RAYX_BUILD_TESTS "This option builds the RAYX test suite." ON)
27+
option(RAYX_BUILD_RAYX_CLI "This option builds the RAYX command line interface." ON)
28+
option(RAYX_BUILD_RAYX_UI "This option builds the RAYX graphical user interface." ON)
2629
option(RAYX_STATIC_LIB "This option builds 'rayx-core' as a static library." OFF)
2730
# ------------------
2831

Extern/CMakeLists.txt

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
22
include(CheckLanguage)
33

4-
set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)
5-
6-
add_subdirectory(googletest)
7-
8-
# support version in CMakeLists.txt of portable-file-dialogs was removed from cmake. thus we include the header only library by hand
9-
add_library(portable_file_dialogs INTERFACE)
10-
target_include_directories(portable_file_dialogs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/portable-file-dialogs)
11-
12-
# --- CLI11 ---
13-
set(CLI11_SANITIZERS OFF)
14-
set(CLI11_BUILD_DOCS OFF)
15-
set(CLI11_BUILD_TESTS OFF)
16-
set(CLI11_BUILD_EXAMPLES OFF)
17-
set(CLI11_BUILD_EXAMPLES_JSON OFF)
18-
set(CLI11_SINGLE_FILE_TESTS OFF)
19-
set(CLI11_INSTALL OFF)
20-
set(CLI11_FORCE_LIBCXX OFF)
21-
set(CLI11_CUDA_TESTS OFF)
22-
set(CLI11_CLANG_TIDY OFF)
23-
add_subdirectory(CLI11)
24-
254
# --- alpaka ---
265

276
# alpaka openmp backend
@@ -97,5 +76,32 @@ if(RAYX_ENABLE_H5)
9776
endif()
9877
endif()
9978

79+
if (RAYX_BUILD_TESTS)
80+
set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)
81+
82+
add_subdirectory(googletest)
83+
endif()
84+
85+
# --- CLI11 ---
86+
if (RAYX_BUILD_RAYX_CLI)
87+
set(CLI11_SANITIZERS OFF)
88+
set(CLI11_BUILD_DOCS OFF)
89+
set(CLI11_BUILD_TESTS OFF)
90+
set(CLI11_BUILD_EXAMPLES OFF)
91+
set(CLI11_BUILD_EXAMPLES_JSON OFF)
92+
set(CLI11_SINGLE_FILE_TESTS OFF)
93+
set(CLI11_INSTALL OFF)
94+
set(CLI11_FORCE_LIBCXX OFF)
95+
set(CLI11_CUDA_TESTS OFF)
96+
set(CLI11_CLANG_TIDY OFF)
97+
add_subdirectory(CLI11)
98+
endif()
99+
100100
# --- SDL ---
101-
add_subdirectory(SDL EXCLUDE_FROM_ALL)
101+
if(RAYX_BUILD_RAYX_UI)
102+
# support version in CMakeLists.txt of portable-file-dialogs was removed from cmake. thus we include the header only library by hand
103+
add_library(portable_file_dialogs INTERFACE)
104+
target_include_directories(portable_file_dialogs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/portable-file-dialogs)
105+
106+
add_subdirectory(SDL EXCLUDE_FROM_ALL)
107+
endif()

Intern/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ endif()
1212
# ---- Subdirectories ----
1313
add_subdirectory(rayx-core)
1414

15-
if(NOT RAYX_CMD STREQUAL "NO")
16-
add_subdirectory(rayx)
15+
if(RAYX_BUILD_RAYX_CLI)
16+
if(NOT RAYX_CMD STREQUAL "NO")
17+
add_subdirectory(rayx)
18+
endif()
1719
endif()
1820

19-
# Don't build rayx-ui without Vulkan
20-
if(NOT VULKAN STREQUAL "NO")
21-
add_subdirectory(rayx-ui)
21+
if(RAYX_BUILD_RAYX_UI)
22+
# Don't build rayx-ui without Vulkan
23+
if(NOT VULKAN STREQUAL "NO")
24+
add_subdirectory(rayx-ui)
25+
endif()
2226
endif()
2327

2428
# ------------------------

Intern/rayx-core/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ endif()
4646
# -----------------------
4747

4848
# ---- Add tests ----
49-
add_subdirectory(tests)
49+
if(RAYX_BUILD_TESTS)
50+
add_subdirectory(tests)
51+
endif()
5052

5153
# -------------------
5254

0 commit comments

Comments
 (0)