diff --git a/.gitmodules b/.gitmodules index f48acab..708bae2 100644 --- a/.gitmodules +++ b/.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"] path = third_party/benchmark url = https://github.com/google/benchmark.git diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b9664fb..0808758 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,67 +1,69 @@ 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(KLOTSKI_CORE_SRC - all_cases/internal/basic_ranges.cc - all_cases/internal/all_cases.cc + ranges/internal/spawn.cc + ranges/internal/ranges.cc + ranges/internal/derive.cc - common_code/internal/common_code.cc - common_code/internal/serialize.cc - common_code/internal/mirror.cc + all_cases/internal/basic_ranges.cc + all_cases/internal/all_cases.cc - raw_code/internal/raw_code.cc - raw_code/internal/convert.cc - raw_code/internal/mirror.cc + common_code/internal/common_code.cc + common_code/internal/serialize.cc + common_code/internal/mirror.cc - short_code/internal/convert.cc - short_code/internal/serialize.cc + raw_code/internal/raw_code.cc + raw_code/internal/convert.cc + raw_code/internal/mirror.cc - mover/internal/mover.cc + short_code/internal/convert.cc + short_code/internal/serialize.cc - fast_cal/internal/fast_cal.cc + mover/internal/mover.cc - group/internal/group_union.cc - group/internal/group.cc - group/internal/group_cases.cc + group/internal/group_union.cc + group/internal/group.cc + group/internal/group_cases.cc - ranges/internal/spawn.cc - ranges/internal/ranges.cc - ranges/internal/derive.cc + fast_cal/internal/fast_cal.cc ) add_library(klotski_core STATIC ${KLOTSKI_CORE_SRC}) 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_link_libraries(klotski_core PRIVATE absl::flat_hash_map) -target_link_libraries(klotski_core PUBLIC phmap) +target_link_libraries(klotski_core PUBLIC phmap::phmap) add_library(klotski::core ALIAS klotski_core) # TODO: just for dev testing add_executable(klotski_core_bin main.cc) target_link_libraries(klotski_core_bin PRIVATE klotski_core) -add_executable(codec_benchmark benchmark/codec.cc) -target_compile_options(codec_benchmark PRIVATE -fno-rtti -fno-exceptions -fno-access-control) -target_link_libraries(codec_benchmark PRIVATE klotski::core benchmark::benchmark_main) +set(KLSK_BENCHMARK_OPTS -fno-rtti -fno-exceptions -fno-access-control) +set(KLSK_BENCHMARK_LIBS klotski::core benchmark::benchmark_main bs::thread_pool) -add_executable(group_benchmark benchmark/group.cc) -target_compile_options(group_benchmark PRIVATE -fno-rtti -fno-exceptions -fno-access-control) -target_link_libraries(group_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(bm_all_cases benchmark/all_cases.cc) -target_compile_options(bm_all_cases PRIVATE -fno-rtti -fno-exceptions -fno-access-control) -target_link_libraries(bm_all_cases PRIVATE klotski::core benchmark::benchmark_main bs::thread_pool) +add_executable(bm_klsk_group benchmark/group.cc) +target_compile_options(bm_klsk_group PRIVATE ${KLSK_BENCHMARK_OPTS}) +target_link_libraries(bm_klsk_group PRIVATE ${KLSK_BENCHMARK_LIBS}) -add_executable(bm_ranges benchmark/ranges.cc) -target_compile_options(bm_ranges PRIVATE -fno-rtti -fno-exceptions) -target_link_libraries(bm_ranges PRIVATE klotski::core benchmark::benchmark_main) +add_executable(bm_klsk_all_cases benchmark/all_cases.cc) +target_compile_options(bm_klsk_all_cases PRIVATE ${KLSK_BENCHMARK_OPTS}) +target_link_libraries(bm_klsk_all_cases PRIVATE ${KLSK_BENCHMARK_LIBS}) -add_executable(bm_utility benchmark/utility.cc) -target_compile_options(bm_utility PRIVATE -fno-rtti -fno-exceptions) -target_link_libraries(bm_utility PRIVATE klotski::core benchmark::benchmark_main) +add_executable(bm_klsk_ranges benchmark/ranges.cc) +target_compile_options(bm_klsk_ranges PRIVATE ${KLSK_BENCHMARK_OPTS}) +target_link_libraries(bm_klsk_ranges PRIVATE ${KLSK_BENCHMARK_LIBS}) -add_executable(bm_fast_cal benchmark/fast_cal.cc) -target_compile_options(bm_fast_cal PRIVATE -fno-rtti -fno-exceptions) -target_link_libraries(bm_fast_cal PRIVATE klotski::core benchmark::benchmark_main) +add_executable(bm_klsk_utility benchmark/utility.cc) +target_compile_options(bm_klsk_utility PRIVATE ${KLSK_BENCHMARK_OPTS}) +target_link_libraries(bm_klsk_utility PRIVATE ${KLSK_BENCHMARK_LIBS}) + +add_executable(bm_klsk_fast_cal benchmark/fast_cal.cc) +target_compile_options(bm_klsk_fast_cal PRIVATE ${KLSK_BENCHMARK_OPTS}) +target_link_libraries(bm_klsk_fast_cal PRIVATE ${KLSK_BENCHMARK_LIBS}) diff --git a/src/core/benchmark/ranges.cc b/src/core/benchmark/ranges.cc index 42a54f9..3c9cfc5 100644 --- a/src/core/benchmark/ranges.cc +++ b/src/core/benchmark/ranges.cc @@ -15,7 +15,7 @@ static void SpawnRanges(benchmark::State &state) { kk.reserve(7311921); // 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); } // } diff --git a/third_party/ThirdParty.cmake b/third_party/ThirdParty.cmake index 0aefb34..78e3af2 100644 --- a/third_party/ThirdParty.cmake +++ b/third_party/ThirdParty.cmake @@ -1,11 +1,8 @@ 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 add_subdirectory(${KLSK_THIRD_PARTY}/parallel-hashmap EXCLUDE_FROM_ALL) +add_library(phmap::phmap ALIAS phmap) if (KLSK_ENABLE_BENCHMARK) # google benchmark framework diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp deleted file mode 160000 index 2f9e432..0000000 --- a/third_party/abseil-cpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2f9e432cce407ce0ae50676696666f33a77d42ac