Browse Source

build: update cmake compile structure

master
Dnomd343 2 years ago
parent
commit
e5d2d97425
  1. 64
      src/CMakeLists.txt
  2. 1
      src/graph/svg/CMakeLists.txt
  3. 67
      src/klotski/CMakeLists.txt
  4. 3
      src/klotski/all_cases/CMakeLists.txt
  5. 0
      src/klotski/all_cases/all_cases.cc
  6. 0
      src/klotski/all_cases/all_cases.h
  7. 0
      src/klotski/all_cases/basic_ranges.cc
  8. 0
      src/klotski/all_cases/basic_ranges.h
  9. 0
      src/klotski/analyse/CMakeLists.txt
  10. 0
      src/klotski/analyse/analyse.cc
  11. 0
      src/klotski/analyse/analyse.h
  12. 0
      src/klotski/analyse/backtrack.cc
  13. 0
      src/klotski/analyse/backtrack_legacy.cc
  14. 0
      src/klotski/common_code/CMakeLists.txt
  15. 0
      src/klotski/common_code/common_code.cc
  16. 0
      src/klotski/common_code/common_code.h
  17. 0
      src/klotski/common_code/convert.cc
  18. 0
      src/klotski/common_code/serialize.cc
  19. 0
      src/klotski/core/CMakeLists.txt
  20. 0
      src/klotski/core/core.cc
  21. 0
      src/klotski/core/core.h
  22. 0
      src/klotski/fast_cal/CMakeLists.txt
  23. 0
      src/klotski/fast_cal/cal_core.cc
  24. 0
      src/klotski/fast_cal/fast_cal.cc
  25. 0
      src/klotski/fast_cal/fast_cal.h
  26. 0
      src/klotski/graph/CMakeLists.txt
  27. 0
      src/klotski/graph/case.cc
  28. 0
      src/klotski/graph/graph.cc
  29. 0
      src/klotski/graph/graph.h
  30. 0
      src/klotski/graph/svg/svg.cc
  31. 0
      src/klotski/graph/svg/svg.h
  32. 2
      src/klotski/klotski_ffi.cc
  33. 0
      src/klotski/raw_code/CMakeLists.txt
  34. 0
      src/klotski/raw_code/convert.cc
  35. 0
      src/klotski/raw_code/raw_code.cc
  36. 0
      src/klotski/raw_code/raw_code.h
  37. 0
      src/klotski/short_code/CMakeLists.txt
  38. 0
      src/klotski/short_code/convert.cc
  39. 0
      src/klotski/short_code/offset/all_cases_offset.h
  40. 0
      src/klotski/short_code/offset/basic_ranges_offset.h
  41. 0
      src/klotski/short_code/offset/range_prefix_offset.h
  42. 0
      src/klotski/short_code/serialize.cc
  43. 0
      src/klotski/short_code/serialize_chars.h
  44. 0
      src/klotski/short_code/short_code.cc
  45. 0
      src/klotski/short_code/short_code.h
  46. 0
      src/klotski/utils/CMakeLists.txt
  47. 0
      src/klotski/utils/common.cc
  48. 0
      src/klotski/utils/common.h
  49. 69
      src/main.cc

64
src/CMakeLists.txt

@ -1,60 +1,14 @@
cmake_minimum_required(VERSION 3.0)
################################################
include_directories(klotski)
include_directories(klotski/utils)
include_directories(klotski/all_cases)
include_directories(utils)
include_directories(all_cases)
include_directories(klotski/raw_code)
include_directories(klotski/short_code)
include_directories(klotski/common_code)
include_directories(raw_code)
include_directories(short_code)
include_directories(common_code)
add_subdirectory(klotski)
include_directories(core)
include_directories(analyse)
include_directories(fast_cal)
include_directories(graph)
include_directories(benchmark)
################################################
add_subdirectory(utils)
add_subdirectory(all_cases)
add_subdirectory(raw_code)
add_subdirectory(short_code)
add_subdirectory(common_code)
add_subdirectory(core)
add_subdirectory(analyse)
add_subdirectory(fast_cal)
add_subdirectory(graph)
add_subdirectory(benchmark)
################################################
add_executable(klotski main.cc)
################################################
target_link_libraries(klotski utils)
target_link_libraries(klotski all_cases)
target_link_libraries(klotski raw_code)
target_link_libraries(klotski short_code)
target_link_libraries(klotski common_code)
target_link_libraries(klotski core)
target_link_libraries(klotski analyse)
target_link_libraries(klotski fast_cal)
target_link_libraries(klotski graph)
target_link_libraries(klotski benchmark)
target_link_libraries(klotski pthread)
################################################
add_executable(klotski_bin main.cc)
target_link_libraries(klotski_bin klotski)

1
src/graph/svg/CMakeLists.txt

@ -1 +0,0 @@
add_library(svg svg.cc)

67
src/klotski/CMakeLists.txt

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.0)
################################################
include_directories(utils)
include_directories(all_cases)
include_directories(raw_code)
include_directories(short_code)
include_directories(common_code)
#include_directories(core)
#include_directories(analyse)
#include_directories(fast_cal)
#
#include_directories(graph)
#
#include_directories(benchmark)
################################################
add_subdirectory(utils)
add_subdirectory(all_cases)
add_subdirectory(raw_code)
add_subdirectory(short_code)
add_subdirectory(common_code)
#add_subdirectory(core)
#add_subdirectory(analyse)
#add_subdirectory(fast_cal)
#
#add_subdirectory(graph)
#
#add_subdirectory(benchmark)
################################################
add_library(klotski klotski_ffi.cc)
target_link_libraries(klotski utils)
target_link_libraries(klotski all_cases)
target_link_libraries(klotski raw_code)
target_link_libraries(klotski short_code)
target_link_libraries(klotski common_code)
################################################
#target_link_libraries(klotski utils)
#target_link_libraries(klotski all_cases)
#target_link_libraries(klotski raw_code)
#target_link_libraries(klotski short_code)
#target_link_libraries(klotski common_code)
#
#target_link_libraries(klotski core)
#target_link_libraries(klotski analyse)
#target_link_libraries(klotski fast_cal)
#
#target_link_libraries(klotski graph)
#
#target_link_libraries(klotski benchmark)
#
#target_link_libraries(klotski pthread)
################################################

3
src/all_cases/CMakeLists.txt → src/klotski/all_cases/CMakeLists.txt

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

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

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

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

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

0
src/analyse/CMakeLists.txt → src/klotski/analyse/CMakeLists.txt

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

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

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

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

0
src/common_code/CMakeLists.txt → src/klotski/common_code/CMakeLists.txt

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

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

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

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

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

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

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

0
src/fast_cal/CMakeLists.txt → src/klotski/fast_cal/CMakeLists.txt

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

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

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

0
src/graph/CMakeLists.txt → src/klotski/graph/CMakeLists.txt

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

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

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

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

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

2
src/klotski/klotski_ffi.cc

@ -0,0 +1,2 @@
#include <iostream>

0
src/raw_code/CMakeLists.txt → src/klotski/raw_code/CMakeLists.txt

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

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

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

0
src/short_code/CMakeLists.txt → src/klotski/short_code/CMakeLists.txt

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

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

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

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

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

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

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

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

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

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

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

69
src/main.cc

@ -1,16 +1,18 @@
#include <iostream>
#include "core.h"
//#include "core.h"
#include "all_cases.h"
#include "basic_ranges.h"
#include "common_code.h"
#include "short_code.h"
#include "raw_code.h"
#include "fast_cal.h"
#include "analyse.h"
#include "short_code.h"
#include "common_code.h"
//#include "fast_cal.h"
//#include "analyse.h"
#include "common.h"
#include "graph.h"
//#include "graph.h"
#include "benchmark.h"
//#include "benchmark.h"
#include <thread>
#include <algorithm>
@ -20,19 +22,42 @@
//int main(int argc, char *argv[]) {
int main() {
std::cout << "start test" << std::endl;
// std::cout << (uint32_t)Common::check_range(1, Common::range_reverse(0xA9BF0C00)) << std::endl;
// AllCases::build();
// for (const auto &a : AllCases::fetch()) {
// std::cout << a.size() << std::endl;
// }
std::cout << RawCode::from_common_code("1a9bf0c") << std::endl;
std::cout << RawCode::create(0x0603EDF5CAFFF5E2) << std::endl;
std::cout << CommonCode::create(0x1A9BF0C00) << std::endl;
std::cout << CommonCode::from_string("1a9bf0c") << std::endl;
std::cout << CommonCode::from_short_code(4091296) << std::endl;
std::cout << CommonCode::from_raw_code(0x0603EDF5CAFFF5E2) << std::endl;
std::cout << ShortCode::create(4091296) << std::endl;
std::cout << ShortCode::from_string("4WVE1") << std::endl;
std::cout << ShortCode::from_common_code(0x1A9BF0C00) << std::endl;
std::cout << "end test" << std::endl;
// BasicRanges::build();
// Benchmark::basic_ranges(std::cout);
// std::cout << std::endl;
Benchmark::all_cases(std::cout);
// Benchmark::all_cases(std::cout);
std::cout << std::endl;
Benchmark::basic_ranges(std::cout);
// std::cout << std::endl;
// Benchmark::basic_ranges(std::cout);
return 0;
BasicRanges::build();
// BasicRanges::build();
// AllCases::build();
@ -73,9 +98,9 @@ int main() {
// }
auto start_time = clock();
// auto start_time = clock();
auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
// auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
// auto a = Analyse(RawCode::from_common_code("4fea134"));
// auto a = Analyse(RawCode::from_common_code("A5D3AF"));
@ -84,23 +109,23 @@ int main() {
// auto ret = a.build_until([](uint64_t code) {
// return ((code >> (3 * 0xD)) & 0b111) == B_2x2;
// });
auto ret = a.build_resolve();
// auto ret = a.build_resolve();
// for (const auto &r : ret) {
// std::cout << r << std::endl;
// }
// std::cout << ret.size() << std::endl;
std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
// std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
start_time = clock();
auto svg_ret = a.backtrack(ret);
std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
// start_time = clock();
// auto svg_ret = a.backtrack(ret);
// std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
auto g = Graph();
auto svg_data = g.svg_demo(svg_ret);
// auto g = Graph();
// auto svg_data = g.svg_demo(svg_ret);
// std::cout << svg_data << std::endl;
@ -141,7 +166,7 @@ int main() {
// std::cerr << (clock() - start_time) / CLOCKS_PER_SEC << "s" << std::endl;
// std::cerr << (clock() - start_time) * 1000 / CLOCKS_PER_SEC << "ms" << std::endl;
std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
// std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
// std::cout << "complete benchmark" << std::endl;

Loading…
Cancel
Save