@@ -29,21 +29,22 @@ endif()
29
29
find_package (pybind11 REQUIRED)
30
30
31
31
include (FetchContent)
32
+
33
+ # libdivide (header-only) via FetchContent
32
34
FetchContent_Declare(
33
- emhash
34
- GIT_REPOSITORY https://github.com/DiamonDinoia/emhash.git
35
- GIT_TAG master
36
- GIT_SHALLOW TRUE )
37
-
38
- # Only populate emhash, don't build it
39
- FetchContent_GetProperties(emhash)
40
- if (NOT emhash_POPULATED)
41
- FetchContent_Populate(emhash)
42
- endif ()
35
+ libdivide
36
+ GIT_REPOSITORY https://github.com/ridiculousfish/libdivide
37
+ GIT_TAG v5.2.0
38
+ )
39
+ FetchContent_MakeAvailable(libdivide)
43
40
44
- add_library (emhash INTERFACE )
45
- target_include_directories (emhash INTERFACE ${emhash_SOURCE_DIR} )
46
- target_compile_features (emhash INTERFACE cxx_std_17)
41
+ # tsl::robin_map via FetchContent
42
+ FetchContent_Declare(
43
+ tsl-robin-map
44
+ GIT_REPOSITORY https://github.com/Tessil/robin-map.git
45
+ GIT_TAG v1.4.0
46
+ )
47
+ FetchContent_MakeAvailable(tsl-robin-map)
47
48
48
49
# Set C++ standard
49
50
set (CMAKE_CXX_STANDARD 20)
@@ -66,7 +67,10 @@ pybind11_add_module(_simple_ans ${SOURCES} ${HEADERS})
66
67
67
68
# Configure include directories
68
69
target_include_directories (_simple_ans PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} /simple_ans/cpp)
69
- target_link_libraries (_simple_ans PRIVATE emhash)
70
+ target_link_libraries (_simple_ans PRIVATE libdivide tsl::robin_map)
71
+
72
+ # Ensure libdivide headers are on the include path
73
+ target_include_directories (_simple_ans PRIVATE ${libdivide_SOURCE_DIR} )
70
74
71
75
# Set compiler-specific options
72
76
if (MSVC )
@@ -76,9 +80,19 @@ else()
76
80
target_compile_options (_simple_ans PRIVATE -Wall -Wextra -Wpedantic -Wno-unknown-pragmas ${ARCH_FLAGS} )
77
81
endif ()
78
82
83
+ if (NOT MSVC )
84
+ # Enable additional optimizations for non-MSVC compilers
85
+ target_compile_options (_simple_ans PRIVATE -fomit-frame-pointer)
86
+ endif ()
87
+
79
88
if (ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" ))
80
89
set_target_properties (_simple_ans PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE )
81
90
endif ()
82
91
92
+ set_target_properties (_simple_ans PROPERTIES
93
+ CXX_VISIBILITY_PRESET hidden
94
+ VISIBILITY_INLINES_HIDDEN ON
95
+ )
96
+
83
97
# Install rules
84
98
install (TARGETS _simple_ans LIBRARY DESTINATION simple_ans)
0 commit comments