@@ -21,16 +21,6 @@ set(CMAKE_CXX_STANDARD 17)
2121set (CMAKE_CXX_STANDARD_REQUIRED ON )
2222set (CMAKE_POSITION_INDEPENDENT_CODE ON )
2323
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-
3424# =============================================================================
3525# Compiler Flags Configuration
3626# =============================================================================
@@ -165,18 +155,6 @@ configure_logging()
165155# Dependency Management
166156# =============================================================================
167157
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-
180158# Find required packages
181159find_package (Python3 REQUIRED COMPONENTS Interpreter Development.Module)
182160find_package (pybind11 CONFIG REQUIRED)
@@ -192,85 +170,23 @@ include_directories(${GLib_INCLUDE_DIRS})
192170link_directories (${GLib_LIBRARY_DIRS} )
193171list (APPEND required_libs ${GLib_LIBRARIES} )
194172
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)
224175message (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" )
228178endif ()
179+ include_directories (${ZSTD_INCLUDE_DIR} )
180+ link_directories (${ZSTD_LIBRARY_DIRS} )
229181list (APPEND required_libs ${ZSTD_LIBRARIES} )
230182
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-
243183# Optional dependencies based on features
244184if (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} " )
274190endif ()
275191
276192# LightGBM for LRB and 3L_CACHE
@@ -285,30 +201,22 @@ foreach(FEATURE ${LIGHTGBM_FEATURES})
285201endforeach ()
286202
287203if (LIGHTGBM_NEEDED)
288- # Try to find LightGBM
289204 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)
299206 endif ()
300-
301207 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" )
303209 endif ()
304210
211+ if (NOT DEFINED LIGHTGBM_LIB)
212+ find_library (LIGHTGBM_LIB _lightgbm)
213+ endif ()
305214 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" )
307216 endif ()
308217
309218 include_directories (${LIGHTGBM_PATH} )
310219 list (APPEND optional_libs ${LIGHTGBM_LIB} )
311- message (STATUS "LightGBM found: ${LIGHTGBM_PATH} , ${LIGHTGBM_LIB} " )
312220endif ()
313221
314222# =============================================================================
@@ -411,4 +319,4 @@ configure_platform_specific_linking(libcachesim_python)
411319# Installation
412320# =============================================================================
413321
414- install (TARGETS libcachesim_python LIBRARY DESTINATION libcachesim)
322+ install (TARGETS libcachesim_python LIBRARY DESTINATION libcachesim)
0 commit comments