Browse Source

build: rename `klotski` to `klotski_core`

master
Dnomd343 2 years ago
parent
commit
31cb0a9246
  1. 2
      .gitignore
  2. 3
      CMakeLists.txt
  3. 5
      src/CMakeLists.txt
  4. 2
      src/demo.py
  5. 13
      src/klotski_core/CMakeLists.txt
  6. 1
      src/klotski_core/all_cases/CMakeLists.txt
  7. 0
      src/klotski_core/all_cases/all_cases.cc
  8. 0
      src/klotski_core/all_cases/all_cases.h
  9. 0
      src/klotski_core/all_cases/basic_ranges.cc
  10. 0
      src/klotski_core/all_cases/basic_ranges.h
  11. 1
      src/klotski_core/analyse/CMakeLists.txt
  12. 0
      src/klotski_core/analyse/analyse.cc
  13. 0
      src/klotski_core/analyse/analyse.h
  14. 0
      src/klotski_core/analyse/backtrack.cc
  15. 0
      src/klotski_core/analyse/backtrack_legacy.cc
  16. 1
      src/klotski_core/benchmark/CMakeLists.txt
  17. 0
      src/klotski_core/benchmark/benchmark.cc
  18. 0
      src/klotski_core/benchmark/benchmark.h
  19. 0
      src/klotski_core/benchmark/chore.cc
  20. 1
      src/klotski_core/common_code/CMakeLists.txt
  21. 0
      src/klotski_core/common_code/common_code.cc
  22. 0
      src/klotski_core/common_code/common_code.h
  23. 0
      src/klotski_core/common_code/convert.cc
  24. 0
      src/klotski_core/common_code/serialize.cc
  25. 0
      src/klotski_core/core/CMakeLists.txt
  26. 0
      src/klotski_core/core/core.cc
  27. 0
      src/klotski_core/core/core.h
  28. 1
      src/klotski_core/fast_cal/CMakeLists.txt
  29. 0
      src/klotski_core/fast_cal/cal_core.cc
  30. 0
      src/klotski_core/fast_cal/fast_cal.cc
  31. 0
      src/klotski_core/fast_cal/fast_cal.h
  32. 0
      src/klotski_core/ffi/all_cases.cc
  33. 0
      src/klotski_core/ffi/codec.cc
  34. 0
      src/klotski_core/ffi/metadata.cc
  35. 0
      src/klotski_core/ffi/tmain.cc
  36. 3
      src/klotski_core/graph/CMakeLists.txt
  37. 0
      src/klotski_core/graph/case.cc
  38. 0
      src/klotski_core/graph/graph.cc
  39. 0
      src/klotski_core/graph/graph.h
  40. 0
      src/klotski_core/graph/svg/svg.cc
  41. 0
      src/klotski_core/graph/svg/svg.h
  42. 0
      src/klotski_core/klotski.h
  43. 1
      src/klotski_core/raw_code/CMakeLists.txt
  44. 0
      src/klotski_core/raw_code/convert.cc
  45. 0
      src/klotski_core/raw_code/raw_code.cc
  46. 0
      src/klotski_core/raw_code/raw_code.h
  47. 1
      src/klotski_core/short_code/CMakeLists.txt
  48. 0
      src/klotski_core/short_code/convert.cc
  49. 0
      src/klotski_core/short_code/offset/all_cases_offset.h
  50. 0
      src/klotski_core/short_code/offset/basic_ranges_offset.h
  51. 0
      src/klotski_core/short_code/offset/range_prefix_offset.h
  52. 0
      src/klotski_core/short_code/serialize.cc
  53. 0
      src/klotski_core/short_code/serialize_chars.h
  54. 0
      src/klotski_core/short_code/short_code.cc
  55. 0
      src/klotski_core/short_code/short_code.h
  56. 0
      src/klotski_core/utils/CMakeLists.txt
  57. 0
      src/klotski_core/utils/common.cc
  58. 0
      src/klotski_core/utils/common.h
  59. 8
      src/klotski_core/utils/version.h.in
  60. 4
      src/rust_ffi/build.rs
  61. 2
      src/rust_ffi/wrapper.h
  62. 5
      test/CMakeLists.txt

2
.gitignore

@ -5,4 +5,4 @@
/src/cli/target/
/src/rust_ffi/target/
/src/klotski/utils/version.h
/src/klotski_core/utils/version.h

3
CMakeLists.txt

@ -9,6 +9,9 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
# TODO: only in libklotski.so
add_compile_options(-fPIC)

5
src/CMakeLists.txt

@ -2,9 +2,8 @@ cmake_minimum_required(VERSION 3.0)
project(klotski-cli LANGUAGES C)
include_directories(klotski/ffi)
add_subdirectory(klotski)
add_subdirectory(klotski_core)
include_directories(klotski_core)
add_executable(cli main.c)
target_link_libraries(cli PRIVATE klotski)

2
src/demo.py

@ -2,6 +2,6 @@
import ctypes
lib = ctypes.CDLL('../cmake-build-release/src/klotski/libklotski.so')
lib = ctypes.CDLL('../cmake-build-release/src/klotski_core/libklotski.so')
lib.tmain()

13
src/klotski/CMakeLists.txt → src/klotski_core/CMakeLists.txt

@ -23,6 +23,10 @@ git_commit_id(GIT_COMMIT_ID)
string(TIMESTAMP BUILD_TIME "%Y-%m-%d %H:%M:%S")
set(VERSION_MAJOR ${klotski-core_VERSION_MAJOR})
set(VERSION_MINOR ${klotski-core_VERSION_MINOR})
set(VERSION_PATCH ${klotski-core_VERSION_PATCH})
set(SYSTEM_INFO "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}")
set(COMPILER_INFO "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
@ -63,6 +67,7 @@ add_subdirectory(benchmark)
################################################################################
include_directories(.)
set(FFI_SRC codec.cc all_cases.cc tmain.cc metadata.cc)
list(TRANSFORM FFI_SRC PREPEND "ffi/")
add_library(klotski-ffi OBJECT ${FFI_SRC})
@ -84,11 +89,11 @@ list(APPEND OBJS $<TARGET_OBJECTS:benchmark>)
################################################################################
option(STATIC_LIB "build static library" ON)
if (STATIC_LIB)
add_library(klotski STATIC ${OBJS})
else()
option(BUILD_DYN "build shared klotski core library" OFF)
if (BUILD_DYN)
add_library(klotski SHARED ${OBJS})
else()
add_library(klotski STATIC ${OBJS})
endif()
################################################################################

1
src/klotski/all_cases/CMakeLists.txt → src/klotski_core/all_cases/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(all_cases OBJECT all_cases.cc basic_ranges.cc)
#target_link_libraries(all_cases PUBLIC utils)

0
src/klotski/all_cases/all_cases.cc → src/klotski_core/all_cases/all_cases.cc

0
src/klotski/all_cases/all_cases.h → src/klotski_core/all_cases/all_cases.h

0
src/klotski/all_cases/basic_ranges.cc → src/klotski_core/all_cases/basic_ranges.cc

0
src/klotski/all_cases/basic_ranges.h → src/klotski_core/all_cases/basic_ranges.h

1
src/klotski/analyse/CMakeLists.txt → src/klotski_core/analyse/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(analyse OBJECT analyse.cc backtrack.cc)
#target_link_libraries(analyse PUBLIC core)

0
src/klotski/analyse/analyse.cc → src/klotski_core/analyse/analyse.cc

0
src/klotski/analyse/analyse.h → src/klotski_core/analyse/analyse.h

0
src/klotski/analyse/backtrack.cc → src/klotski_core/analyse/backtrack.cc

0
src/klotski/analyse/backtrack_legacy.cc → src/klotski_core/analyse/backtrack_legacy.cc

1
src/klotski/benchmark/CMakeLists.txt → src/klotski_core/benchmark/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(benchmark OBJECT chore.cc benchmark.cc)
#target_link_libraries(benchmark PUBLIC all_cases)

0
src/klotski/benchmark/benchmark.cc → src/klotski_core/benchmark/benchmark.cc

0
src/klotski/benchmark/benchmark.h → src/klotski_core/benchmark/benchmark.h

0
src/klotski/benchmark/chore.cc → src/klotski_core/benchmark/chore.cc

1
src/klotski/common_code/CMakeLists.txt → src/klotski_core/common_code/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(common_code OBJECT convert.cc serialize.cc common_code.cc)
#target_link_libraries(common_code PUBLIC utils)

0
src/klotski/common_code/common_code.cc → src/klotski_core/common_code/common_code.cc

0
src/klotski/common_code/common_code.h → src/klotski_core/common_code/common_code.h

0
src/klotski/common_code/convert.cc → src/klotski_core/common_code/convert.cc

0
src/klotski/common_code/serialize.cc → src/klotski_core/common_code/serialize.cc

0
src/klotski/core/CMakeLists.txt → src/klotski_core/core/CMakeLists.txt

0
src/klotski/core/core.cc → src/klotski_core/core/core.cc

0
src/klotski/core/core.h → src/klotski_core/core/core.h

1
src/klotski/fast_cal/CMakeLists.txt → src/klotski_core/fast_cal/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(fast_cal OBJECT cal_core.cc fast_cal.cc)
#target_link_libraries(fast_cal PUBLIC core)

0
src/klotski/fast_cal/cal_core.cc → src/klotski_core/fast_cal/cal_core.cc

0
src/klotski/fast_cal/fast_cal.cc → src/klotski_core/fast_cal/fast_cal.cc

0
src/klotski/fast_cal/fast_cal.h → src/klotski_core/fast_cal/fast_cal.h

0
src/klotski/ffi/all_cases.cc → src/klotski_core/ffi/all_cases.cc

0
src/klotski/ffi/codec.cc → src/klotski_core/ffi/codec.cc

0
src/klotski/ffi/metadata.cc → src/klotski_core/ffi/metadata.cc

0
src/klotski/ffi/tmain.cc → src/klotski_core/ffi/tmain.cc

3
src/klotski/graph/CMakeLists.txt → src/klotski_core/graph/CMakeLists.txt

@ -8,3 +8,6 @@ add_subdirectory(svg)
# TODO: STATIC flag
add_library(graph case.cc graph.cc)
target_link_libraries(graph PUBLIC analyse svg)
# TODO: using OBJECT instead of STATIC
# TODO: remove `target_link_libraries`

0
src/klotski/graph/case.cc → src/klotski_core/graph/case.cc

0
src/klotski/graph/graph.cc → src/klotski_core/graph/graph.cc

0
src/klotski/graph/graph.h → src/klotski_core/graph/graph.h

0
src/klotski/graph/svg/svg.cc → src/klotski_core/graph/svg/svg.cc

0
src/klotski/graph/svg/svg.h → src/klotski_core/graph/svg/svg.h

0
src/klotski/ffi/klotski.h → src/klotski_core/klotski.h

1
src/klotski/raw_code/CMakeLists.txt → src/klotski_core/raw_code/CMakeLists.txt

@ -1,4 +1,3 @@
cmake_minimum_required(VERSION 3.0)
add_library(raw_code OBJECT convert.cc raw_code.cc)
#target_link_libraries(raw_code PUBLIC utils)

0
src/klotski/raw_code/convert.cc → src/klotski_core/raw_code/convert.cc

0
src/klotski/raw_code/raw_code.cc → src/klotski_core/raw_code/raw_code.cc

0
src/klotski/raw_code/raw_code.h → src/klotski_core/raw_code/raw_code.h

1
src/klotski/short_code/CMakeLists.txt → src/klotski_core/short_code/CMakeLists.txt

@ -3,4 +3,3 @@ cmake_minimum_required(VERSION 3.0)
include_directories(offset)
add_library(short_code OBJECT convert.cc serialize.cc short_code.cc)
#target_link_libraries(short_code PUBLIC utils all_cases)

0
src/klotski/short_code/convert.cc → src/klotski_core/short_code/convert.cc

0
src/klotski/short_code/offset/all_cases_offset.h → src/klotski_core/short_code/offset/all_cases_offset.h

0
src/klotski/short_code/offset/basic_ranges_offset.h → src/klotski_core/short_code/offset/basic_ranges_offset.h

0
src/klotski/short_code/offset/range_prefix_offset.h → src/klotski_core/short_code/offset/range_prefix_offset.h

0
src/klotski/short_code/serialize.cc → src/klotski_core/short_code/serialize.cc

0
src/klotski/short_code/serialize_chars.h → src/klotski_core/short_code/serialize_chars.h

0
src/klotski/short_code/short_code.cc → src/klotski_core/short_code/short_code.cc

0
src/klotski/short_code/short_code.h → src/klotski_core/short_code/short_code.h

0
src/klotski/utils/CMakeLists.txt → src/klotski_core/utils/CMakeLists.txt

0
src/klotski/utils/common.cc → src/klotski_core/utils/common.cc

0
src/klotski/utils/common.h → src/klotski_core/utils/common.h

8
src/klotski/utils/version.h.in → src/klotski_core/utils/version.h.in

@ -1,9 +1,9 @@
#pragma once
#define VERSION_MAJOR (@klotski-core_VERSION_MAJOR@)
#define VERSION_MINOR (@klotski-core_VERSION_MINOR@)
#define VERSION_PATCH (@klotski-core_VERSION_PATCH@)
#define VERSION_STR "v@klotski-core_VERSION_MAJOR@.@klotski-core_VERSION_MINOR@.@klotski-core_VERSION_PATCH@"
#define VERSION_MAJOR (@VERSION_MAJOR@)
#define VERSION_MINOR (@VERSION_MINOR@)
#define VERSION_PATCH (@VERSION_PATCH@)
#define VERSION_STR "v@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
#define AUTHOR "dnomd343"
#define SYSTEM "@SYSTEM_INFO@"

4
src/rust_ffi/build.rs

@ -3,11 +3,11 @@ extern crate bindgen;
use std::env;
use std::path::PathBuf;
const RELEASE_DIR: &str = "../../cmake-build-release/src/klotski";
const LIB_CORE_DIR: &str = "../../bin";
fn main() {
// basic compile options
println!("cargo:rustc-link-search={}", RELEASE_DIR);
println!("cargo:rustc-link-search={}", LIB_CORE_DIR);
println!("cargo:rustc-link-lib=static=klotski");
println!("cargo:rerun-if-changed=wrapper.h");
println!("cargo:rustc-link-lib=stdc++");

2
src/rust_ffi/wrapper.h

@ -1,3 +1,3 @@
#pragma once
#include "../klotski/ffi/klotski.h"
#include "../klotski_core/klotski.h"

5
test/CMakeLists.txt

@ -6,12 +6,13 @@ enable_testing()
################################################################
unset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
include_directories(../third_party/md5)
add_library(md5 STATIC ../third_party/md5/md5.cpp)
################################################################
include_directories(../src/klotski/utils)
include_directories(../src/klotski_core/utils)
add_executable(test_utils utils.cc)
target_link_libraries(test_utils PUBLIC gtest gtest_main)
target_link_libraries(test_utils PUBLIC klotski)
@ -19,7 +20,7 @@ add_test(NAME utils COMMAND test_utils)
################################################################
include_directories(../src/klotski/all_cases)
include_directories(../src/klotski_core/all_cases)
add_executable(test_all_cases all_cases.cc)
target_link_libraries(test_all_cases PUBLIC gtest gtest_main)
target_link_libraries(test_all_cases PUBLIC klotski md5)

Loading…
Cancel
Save