@@ -29,21 +29,22 @@ endif()
2929find_package (pybind11 REQUIRED)
3030
3131include (FetchContent)
32+
33+ # libdivide (header-only) via FetchContent
3234FetchContent_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)
4340
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)
4748
4849# Set C++ standard
4950set (CMAKE_CXX_STANDARD 20)
@@ -66,7 +67,10 @@ pybind11_add_module(_simple_ans ${SOURCES} ${HEADERS})
6667
6768# Configure include directories
6869target_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} )
7074
7175# Set compiler-specific options
7276if (MSVC )
@@ -76,9 +80,19 @@ else()
7680 target_compile_options (_simple_ans PRIVATE -Wall -Wextra -Wpedantic -Wno-unknown-pragmas ${ARCH_FLAGS} )
7781endif ()
7882
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+
7988if (ipo_supported AND (CMAKE_BUILD_TYPE STREQUAL "Release" ))
8089 set_target_properties (_simple_ans PROPERTIES INTERPROCEDURAL_OPTIMIZATION TRUE )
8190endif ()
8291
92+ set_target_properties (_simple_ans PROPERTIES
93+ CXX_VISIBILITY_PRESET hidden
94+ VISIBILITY_INLINES_HIDDEN ON
95+ )
96+
8397# Install rules
8498install (TARGETS _simple_ans LIBRARY DESTINATION simple_ans)
0 commit comments