Browse Source

build: add abseil as submodule

legacy
Dnomd343 2 years ago
parent
commit
f1215ee9f6
  1. 3
      .gitmodules
  2. 11
      CMakeLists.txt
  3. 4
      src/CMakeLists.txt
  4. 14
      src/klotski_core/CMakeLists.txt
  5. 1
      third_party/abseil-cpp

3
.gitmodules

@ -7,3 +7,6 @@
[submodule "third_party/tiny_thread_pool"] [submodule "third_party/tiny_thread_pool"]
path = third_party/tiny_thread_pool path = third_party/tiny_thread_pool
url = https://github.com/dnomd343/tiny_thread_pool.git url = https://github.com/dnomd343/tiny_thread_pool.git
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git

11
CMakeLists.txt

@ -19,6 +19,17 @@ file(
FOLLOW_SYMLINK_CHAIN FOLLOW_SYMLINK_CHAIN
) )
################################################################################
option(BUILD_DYN "build shared klotski core library" OFF)
if (BUILD_DYN)
add_compile_options(-fPIC)
endif()
set(ABSL_PROPAGATE_CXX_STD ON)
include_directories(third_party/abseil-cpp)
add_subdirectory(third_party/abseil-cpp)
add_subdirectory(src) add_subdirectory(src)
################################################################################ ################################################################################

4
src/CMakeLists.txt

@ -6,4 +6,6 @@ add_subdirectory(klotski_core)
include_directories(klotski_core) include_directories(klotski_core)
add_executable(cli main.c) add_executable(cli main.c)
target_link_libraries(cli PRIVATE klotski) target_link_libraries(cli PRIVATE klotski absl::flat_hash_map)
# -labsl_hash -labsl_city -labsl_low_level_hash -labsl_raw_hash_set

14
src/klotski_core/CMakeLists.txt

@ -6,13 +6,6 @@ project(klotski-core VERSION 0.1.2 LANGUAGES CXX)
################################################################################ ################################################################################
option(BUILD_DYN "build shared klotski core library" OFF)
if (BUILD_DYN)
add_compile_options(-fPIC)
endif()
################################################################################
macro(git_tag _tag) macro(git_tag _tag)
find_package(Git QUIET) find_package(Git QUIET)
if (GIT_FOUND) if (GIT_FOUND)
@ -104,10 +97,6 @@ include_directories(group)
################################################################################ ################################################################################
find_package(absl REQUIRED)
################################################################################
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(all_cases) add_subdirectory(all_cases)
@ -151,10 +140,9 @@ list(APPEND OBJS $<TARGET_OBJECTS:group>)
if (BUILD_DYN) if (BUILD_DYN)
add_library(klotski SHARED ${OBJS}) add_library(klotski SHARED ${OBJS})
target_link_libraries(klotski absl::flat_hash_map)
else() else()
add_library(klotski STATIC ${OBJS}) add_library(klotski STATIC ${OBJS})
endif() endif()
target_link_libraries(klotski absl::flat_hash_map)
################################################################################ ################################################################################

1
third_party/abseil-cpp

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