@@ -21,16 +21,6 @@ set(CMAKE_CXX_STANDARD 17)
21
21
set (CMAKE_CXX_STANDARD_REQUIRED ON )
22
22
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
23
23
24
- # ============================================================================
25
- set (USER_PREFIX "$ENV{HOME} /local" )
26
-
27
- list (APPEND CMAKE_PREFIX_PATH "${USER_PREFIX} " )
28
- list (APPEND CMAKE_LIBRARY_PATH "${USER_PREFIX} /lib" )
29
- list (APPEND CMAKE_INCLUDE_PATH "${USER_PREFIX} /include" )
30
-
31
- include_directories ("${USER_PREFIX} /include" )
32
- link_directories ("${USER_PREFIX} /lib" )
33
-
34
24
# =============================================================================
35
25
# Compiler Flags Configuration
36
26
# =============================================================================
@@ -165,18 +155,6 @@ configure_logging()
165
155
# Dependency Management
166
156
# =============================================================================
167
157
168
- # Add user-installed dependencies to search paths
169
- if (DEFINED ENV{CMAKE_PREFIX_PATH} )
170
- list (PREPEND CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH} )
171
- endif ()
172
-
173
- # Add common user installation paths
174
- set (USER_PREFIX_PATHS
175
- "$ENV{HOME} /local"
176
- "$ENV{HOME} /.local"
177
- "/usr/local"
178
- )
179
-
180
158
# Find required packages
181
159
find_package (Python3 REQUIRED COMPONENTS Interpreter Development.Module )
182
160
find_package (pybind11 CONFIG REQUIRED )
@@ -192,85 +170,23 @@ include_directories(${GLib_INCLUDE_DIRS})
192
170
link_directories (${GLib_LIBRARY_DIRS} )
193
171
list (APPEND required_libs ${GLib_LIBRARIES} )
194
172
195
- # ZSTD dependency - try multiple find methods
196
- find_package (ZSTD QUIET )
197
- if (NOT ZSTD_FOUND )
198
- # Try pkg-config
199
- pkg_check_modules (ZSTD_PC QUIET libzstd )
200
- if (ZSTD_PC_FOUND )
201
- set (ZSTD_FOUND TRUE )
202
- set (ZSTD_INCLUDE_DIR ${ZSTD_PC_INCLUDE_DIRS} )
203
- set (ZSTD_LIBRARIES ${ZSTD_PC_LIBRARIES} )
204
- set (ZSTD_LIBRARY_DIRS ${ZSTD_PC_LIBRARY_DIRS} )
205
- else ()
206
- # Try manual find
207
- find_path (ZSTD_INCLUDE_DIR zstd.h
208
- PATHS ${CMAKE_INCLUDE_PATH}
209
- PATH_SUFFIXES zstd
210
- )
211
- find_library (ZSTD_LIBRARIES zstd
212
- PATHS ${CMAKE_LIBRARY_PATH}
213
- )
214
- if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARIES )
215
- set (ZSTD_FOUND TRUE )
216
- endif ()
217
- endif ()
218
- endif ()
219
-
220
- if (NOT ZSTD_FOUND )
221
- message (FATAL_ERROR "ZSTD not found. Please install zstd or set CMAKE_PREFIX_PATH to point to user installation." )
222
- endif ()
223
-
173
+ # ZSTD dependency
174
+ find_package (ZSTD REQUIRED )
224
175
message (STATUS "ZSTD_INCLUDE_DIR: ${ZSTD_INCLUDE_DIR} , ZSTD_LIBRARIES: ${ZSTD_LIBRARIES} " )
225
- include_directories (${ZSTD_INCLUDE_DIR} )
226
- if (ZSTD_LIBRARY_DIRS )
227
- link_directories (${ZSTD_LIBRARY_DIRS} )
176
+ if ("${ZSTD_LIBRARIES} " STREQUAL "" )
177
+ message (FATAL_ERROR "zstd not found" )
228
178
endif ()
179
+ include_directories (${ZSTD_INCLUDE_DIR} )
180
+ link_directories (${ZSTD_LIBRARY_DIRS} )
229
181
list (APPEND required_libs ${ZSTD_LIBRARIES} )
230
182
231
- # TCMalloc dependency (optional)
232
- find_library (TCMALLOC_LIBRARY tcmalloc
233
- PATHS ${CMAKE_LIBRARY_PATH}
234
- )
235
- if (TCMALLOC_LIBRARY )
236
- list (APPEND optional_libs ${TCMALLOC_LIBRARY} )
237
- message (STATUS "TCMalloc found: ${TCMALLOC_LIBRARY} " )
238
- add_compile_definitions (USE_TCMALLOC=1 )
239
- else ()
240
- message (STATUS "TCMalloc not found, using system malloc" )
241
- endif ()
242
-
243
183
# Optional dependencies based on features
244
184
if (ENABLE_GLCACHE )
245
- # Try to find XGBoost
246
- find_package (xgboost QUIET )
247
- if (NOT xgboost_FOUND )
248
- # Try manual find for user installation
249
- find_path (XGBOOST_INCLUDE_DIR xgboost
250
- PATHS ${CMAKE_INCLUDE_PATH}
251
- )
252
- find_library (XGBOOST_LIBRARIES xgboost
253
- PATHS ${CMAKE_LIBRARY_PATH}
254
- )
255
- if (XGBOOST_INCLUDE_DIR AND XGBOOST_LIBRARIES )
256
- set (xgboost_FOUND TRUE )
257
- add_library (xgboost::xgboost UNKNOWN IMPORTED )
258
- set_target_properties (xgboost::xgboost PROPERTIES
259
- IMPORTED_LOCATION ${XGBOOST_LIBRARIES}
260
- INTERFACE_INCLUDE_DIRECTORIES ${XGBOOST_INCLUDE_DIR}
261
- )
262
- endif ()
263
- endif ()
264
-
265
- if (xgboost_FOUND )
266
- include_directories (${XGBOOST_INCLUDE_DIR} )
267
- list (APPEND optional_libs xgboost::xgboost )
268
- add_compile_definitions (ENABLE_GLCACHE=1 )
269
- message (STATUS "XGBOOST_INCLUDE_DIR: ${XGBOOST_INCLUDE_DIR} " )
270
- else ()
271
- message (WARNING "XGBoost not found, disabling GLCACHE feature" )
272
- set (ENABLE_GLCACHE OFF )
273
- endif ()
185
+ find_package (xgboost REQUIRED )
186
+ include_directories (${XGBOOST_INCLUDE_DIR} )
187
+ list (APPEND optional_libs xgboost::xgboost )
188
+ add_compile_definitions (ENABLE_GLCACHE=1 )
189
+ message (STATUS "XGBOOST_INCLUDE_DIR: ${XGBOOST_INCLUDE_DIR} " )
274
190
endif ()
275
191
276
192
# LightGBM for LRB and 3L_CACHE
@@ -285,30 +201,22 @@ foreach(FEATURE ${LIGHTGBM_FEATURES})
285
201
endforeach ()
286
202
287
203
if (LIGHTGBM_NEEDED )
288
- # Try to find LightGBM
289
204
if (NOT DEFINED LIGHTGBM_PATH )
290
- find_path (LIGHTGBM_PATH LightGBM
291
- PATHS ${CMAKE_INCLUDE_PATH}
292
- )
293
- endif ()
294
-
295
- if (NOT DEFINED LIGHTGBM_LIB )
296
- find_library (LIGHTGBM_LIB _lightgbm
297
- PATHS ${CMAKE_LIBRARY_PATH}
298
- )
205
+ find_path (LIGHTGBM_PATH LightGBM )
299
206
endif ()
300
-
301
207
if (NOT LIGHTGBM_PATH )
302
- message (FATAL_ERROR "LIGHTGBM_PATH not found. Please install LightGBM or set CMAKE_PREFIX_PATH. " )
208
+ message (FATAL_ERROR "LIGHTGBM_PATH not found" )
303
209
endif ()
304
210
211
+ if (NOT DEFINED LIGHTGBM_LIB )
212
+ find_library (LIGHTGBM_LIB _lightgbm )
213
+ endif ()
305
214
if (NOT LIGHTGBM_LIB )
306
- message (FATAL_ERROR "LIGHTGBM_LIB not found. Please install LightGBM or set CMAKE_PREFIX_PATH. " )
215
+ message (FATAL_ERROR "LIGHTGBM_LIB not found" )
307
216
endif ()
308
217
309
218
include_directories (${LIGHTGBM_PATH} )
310
219
list (APPEND optional_libs ${LIGHTGBM_LIB} )
311
- message (STATUS "LightGBM found: ${LIGHTGBM_PATH} , ${LIGHTGBM_LIB} " )
312
220
endif ()
313
221
314
222
# =============================================================================
@@ -411,4 +319,4 @@ configure_platform_specific_linking(libcachesim_python)
411
319
# Installation
412
320
# =============================================================================
413
321
414
- install (TARGETS libcachesim_python LIBRARY DESTINATION libcachesim )
322
+ install (TARGETS libcachesim_python LIBRARY DESTINATION libcachesim )
0 commit comments