Browse Source

chore: remove abseil deps

master
Dnomd343 2 weeks ago
parent
commit
f1e8c8dd78
  1. 3
      .gitmodules
  2. 54
      src/core/CMakeLists.txt
  3. 2
      src/core/benchmark/ranges.cc
  4. 5
      third_party/ThirdParty.cmake
  5. 1
      third_party/abseil-cpp

3
.gitmodules

@ -1,6 +1,3 @@
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
[submodule "third_party/benchmark"] [submodule "third_party/benchmark"]
path = third_party/benchmark path = third_party/benchmark
url = https://github.com/google/benchmark.git url = https://github.com/google/benchmark.git

54
src/core/CMakeLists.txt

@ -1,9 +1,13 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(core VERSION 0.2.1 LANGUAGES CXX) project(core VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(KLOTSKI_CORE_SRC set(KLOTSKI_CORE_SRC
ranges/internal/spawn.cc
ranges/internal/ranges.cc
ranges/internal/derive.cc
all_cases/internal/basic_ranges.cc all_cases/internal/basic_ranges.cc
all_cases/internal/all_cases.cc all_cases/internal/all_cases.cc
@ -20,48 +24,46 @@ set(KLOTSKI_CORE_SRC
mover/internal/mover.cc mover/internal/mover.cc
fast_cal/internal/fast_cal.cc
group/internal/group_union.cc group/internal/group_union.cc
group/internal/group.cc group/internal/group.cc
group/internal/group_cases.cc group/internal/group_cases.cc
ranges/internal/spawn.cc fast_cal/internal/fast_cal.cc
ranges/internal/ranges.cc
ranges/internal/derive.cc
) )
add_library(klotski_core STATIC ${KLOTSKI_CORE_SRC}) add_library(klotski_core STATIC ${KLOTSKI_CORE_SRC})
target_compile_options(klotski_core PRIVATE -fno-rtti -fno-exceptions) # option for `-fvisibility=hidden` target_compile_options(klotski_core PRIVATE -fno-rtti -fno-exceptions) # option for `-fvisibility=hidden`
target_include_directories(klotski_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(klotski_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(klotski_core PRIVATE absl::flat_hash_map) target_link_libraries(klotski_core PUBLIC phmap::phmap)
target_link_libraries(klotski_core PUBLIC phmap)
add_library(klotski::core ALIAS klotski_core) add_library(klotski::core ALIAS klotski_core)
# TODO: just for dev testing # TODO: just for dev testing
add_executable(klotski_core_bin main.cc) add_executable(klotski_core_bin main.cc)
target_link_libraries(klotski_core_bin PRIVATE klotski_core) target_link_libraries(klotski_core_bin PRIVATE klotski_core)
add_executable(codec_benchmark benchmark/codec.cc) set(KLSK_BENCHMARK_OPTS -fno-rtti -fno-exceptions -fno-access-control)
target_compile_options(codec_benchmark PRIVATE -fno-rtti -fno-exceptions -fno-access-control) set(KLSK_BENCHMARK_LIBS klotski::core benchmark::benchmark_main bs::thread_pool)
target_link_libraries(codec_benchmark PRIVATE klotski::core benchmark::benchmark_main)
add_executable(bm_klsk_codec benchmark/codec.cc)
target_compile_options(bm_klsk_codec PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(bm_klsk_codec PRIVATE ${KLSK_BENCHMARK_LIBS})
add_executable(group_benchmark benchmark/group.cc) add_executable(bm_klsk_group benchmark/group.cc)
target_compile_options(group_benchmark PRIVATE -fno-rtti -fno-exceptions -fno-access-control) target_compile_options(bm_klsk_group PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(group_benchmark PRIVATE klotski::core benchmark::benchmark_main) target_link_libraries(bm_klsk_group PRIVATE ${KLSK_BENCHMARK_LIBS})
add_executable(bm_all_cases benchmark/all_cases.cc) add_executable(bm_klsk_all_cases benchmark/all_cases.cc)
target_compile_options(bm_all_cases PRIVATE -fno-rtti -fno-exceptions -fno-access-control) target_compile_options(bm_klsk_all_cases PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(bm_all_cases PRIVATE klotski::core benchmark::benchmark_main bs::thread_pool) target_link_libraries(bm_klsk_all_cases PRIVATE ${KLSK_BENCHMARK_LIBS})
add_executable(bm_ranges benchmark/ranges.cc) add_executable(bm_klsk_ranges benchmark/ranges.cc)
target_compile_options(bm_ranges PRIVATE -fno-rtti -fno-exceptions) target_compile_options(bm_klsk_ranges PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(bm_ranges PRIVATE klotski::core benchmark::benchmark_main) target_link_libraries(bm_klsk_ranges PRIVATE ${KLSK_BENCHMARK_LIBS})
add_executable(bm_utility benchmark/utility.cc) add_executable(bm_klsk_utility benchmark/utility.cc)
target_compile_options(bm_utility PRIVATE -fno-rtti -fno-exceptions) target_compile_options(bm_klsk_utility PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(bm_utility PRIVATE klotski::core benchmark::benchmark_main) target_link_libraries(bm_klsk_utility PRIVATE ${KLSK_BENCHMARK_LIBS})
add_executable(bm_fast_cal benchmark/fast_cal.cc) add_executable(bm_klsk_fast_cal benchmark/fast_cal.cc)
target_compile_options(bm_fast_cal PRIVATE -fno-rtti -fno-exceptions) target_compile_options(bm_klsk_fast_cal PRIVATE ${KLSK_BENCHMARK_OPTS})
target_link_libraries(bm_fast_cal PRIVATE klotski::core benchmark::benchmark_main) target_link_libraries(bm_klsk_fast_cal PRIVATE ${KLSK_BENCHMARK_LIBS})

2
src/core/benchmark/ranges.cc

@ -15,7 +15,7 @@ static void SpawnRanges(benchmark::State &state) {
kk.reserve(7311921); kk.reserve(7311921);
// for (uint32_t type_id = 0; type_id < klotski::cases::TYPE_ID_LIMIT; ++type_id) { // for (uint32_t type_id = 0; type_id < klotski::cases::TYPE_ID_LIMIT; ++type_id) {
for (auto [n, n_2x1, n_1x1] : klotski::cases::BLOCK_NUM) { for (auto [n, n_2x1, n_1x1] : klotski::group::BLOCK_NUM) {
kk.spawn(n, n_2x1, n_1x1); kk.spawn(n, n_2x1, n_1x1);
} }
// } // }

5
third_party/ThirdParty.cmake

@ -1,11 +1,8 @@
set(KLSK_THIRD_PARTY ${KLSK_ROOT_DIR}/third_party) set(KLSK_THIRD_PARTY ${KLSK_ROOT_DIR}/third_party)
# abseil library
set(ABSL_PROPAGATE_CXX_STD ON)
add_subdirectory(${KLSK_THIRD_PARTY}/abseil-cpp EXCLUDE_FROM_ALL)
# parallel hashmap # parallel hashmap
add_subdirectory(${KLSK_THIRD_PARTY}/parallel-hashmap EXCLUDE_FROM_ALL) add_subdirectory(${KLSK_THIRD_PARTY}/parallel-hashmap EXCLUDE_FROM_ALL)
add_library(phmap::phmap ALIAS phmap)
if (KLSK_ENABLE_BENCHMARK) if (KLSK_ENABLE_BENCHMARK)
# google benchmark framework # google benchmark framework

1
third_party/abseil-cpp

@ -1 +0,0 @@
Subproject commit 2f9e432cce407ce0ae50676696666f33a77d42ac
Loading…
Cancel
Save