@@ -14,6 +14,11 @@ project(drjit-core
14
14
# Optional features available to users
15
15
# ----------------------------------------------------------
16
16
17
+ option (DRJIT_USE_SYSTEM_NANOTHREAD "Use the system nanothread library?" OFF )
18
+ option (DRJIT_USE_SYSTEM_LZ4 "Use the system lz4 library?" OFF )
19
+ option (DRJIT_USE_SYSTEM_XXHASH "Use the system xxHash library?" OFF )
20
+ option (DRJIT_USE_SYSTEM_TSL_ROBIN_MAP "Use the system tsl-robin-map library?" OFF )
21
+
17
22
option (DRJIT_DYNAMIC_LLVM "Resolve LLVM dynamically at run time?" ON )
18
23
option (DRJIT_ENABLE_TESTS "Build Dr.Jit-Core test suite?" OFF )
19
24
@@ -43,6 +48,11 @@ include(ext/nanothread/ext/cmake-defaults/CMakeLists.txt)
43
48
# Print a few messages explaining what will be compiled
44
49
# ----------------------------------------------------------
45
50
51
+ message (STATUS "Dr.Jit-Core: using system nanothread: ${DRJIT_USE_SYSTEM_NANOTHREAD} " )
52
+ message (STATUS "Dr.Jit-Core: using system lz4: ${DRJIT_USE_SYSTEM_LZ4} " )
53
+ message (STATUS "Dr.Jit-Core: using system xxHash: ${DRJIT_USE_SYSTEM_XXHASH} " )
54
+ message (STATUS "Dr.Jit-Core: using system tsl-robin-map: ${DRJIT_USE_SYSTEM_TSL_ROBIN_MAP} " )
55
+
46
56
if (DRJIT_DYNAMIC_LLVM)
47
57
message (STATUS "Dr.Jit-Core: LLVM will be loaded dynamically at runtime." )
48
58
else ()
@@ -73,32 +83,33 @@ endif()
73
83
# Find or build the dependencies
74
84
# ----------------------------------------------------------
75
85
76
- find_package (nanothread)
77
- if (NOT nanothread_FOUND)
86
+ if (DRJIT_USE_SYSTEM_NANOTHREAD)
87
+ find_package (nanothread REQUIRED)
88
+ else ()
78
89
add_subdirectory (ext /nanothread)
79
90
mark_as_advanced (NANOTHREAD_ENABLE_TESTS)
80
91
endif ()
81
92
82
- find_package (PkgConfig )
83
- if (PkgConfig_FOUND )
93
+ if (DRJIT_USE_SYSTEM_LZ4 )
94
+ find_package (PkgConfig REQUIRED )
84
95
pkg_check_modules(lz4 liblz4 IMPORTED_TARGET)
85
96
add_library (lz4 ALIAS PkgConfig::lz4)
86
- endif ()
87
- if (NOT lz4_FOUND)
97
+ else ()
88
98
add_library (lz4 ext /lz4/lz4.c)
89
99
target_include_directories (lz4 PUBLIC ext /lz4)
90
100
endif ()
91
101
92
- find_package (xxHash)
93
- if (NOT xxHash_FOUND)
102
+ if (DRJIT_USE_SYSTEM_XXHASH)
103
+ find_package (xxHash REQUIRED)
104
+ else ()
94
105
add_library (xxhash ext /lz4/xxhash.c)
95
106
target_include_directories (xxhash PUBLIC ext /lz4)
96
-
97
107
add_library (xxHash::xxhash ALIAS xxhash)
98
108
endif ()
99
109
100
- find_package (tsl-robin-map)
101
- if (NOT tsl-robin-map_FOUND)
110
+ if (DRJIT_USE_SYSTEM_TSL_ROBIN_MAP)
111
+ find_package (tsl-robin-map REQUIRED)
112
+ else ()
102
113
add_subdirectory (ext /robin_map)
103
114
endif ()
104
115
0 commit comments