Browse Source

feat: short code speed up ffi

master
Dnomd343 2 years ago
parent
commit
1e736d4e72
  1. 3
      CMakeLists.txt
  2. 26
      src/CMakeLists.txt
  3. 25
      src/klotski/CMakeLists.txt
  4. 4
      src/klotski/ffi/klotski.h
  5. 11
      src/klotski/ffi/klotski_ffi.cc
  6. 0
      src/klotski/klotski_ffi.cc

3
CMakeLists.txt

@ -9,4 +9,7 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# TODO: only in libklotski.so
add_compile_options(-fPIC)
add_subdirectory(src)

26
src/CMakeLists.txt

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

25
src/klotski/CMakeLists.txt

@ -2,6 +2,19 @@ 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)
################################################
add_subdirectory(utils)
add_subdirectory(all_cases)
@ -13,14 +26,12 @@ add_subdirectory(core)
add_subdirectory(analyse)
add_subdirectory(fast_cal)
#add_subdirectory(graph)
#add_subdirectory(benchmark)
################################################
#add_library(klotski klotski_ffi.cc)
#add_library(klotski STATIC klotski_ffi.cc)
add_library(klotski SHARED klotski_ffi.cc)
add_library(klotski SHARED ffi/klotski_ffi.cc)
################################################
target_link_libraries(klotski utils)
target_link_libraries(klotski all_cases)
@ -34,7 +45,3 @@ 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)

4
src/klotski/ffi/klotski.h

@ -0,0 +1,4 @@
#pragma once
void short_code_speed_up_fast();
void short_code_speed_up_normal();

11
src/klotski/ffi/klotski_ffi.cc

@ -0,0 +1,11 @@
#include "klotski.h"
#include "short_code.h"
void short_code_speed_up_fast() {
ShortCode::speed_up(ShortCode::FAST);
}
void short_code_speed_up_normal() {
ShortCode::speed_up(ShortCode::NORMAL);
}

0
src/klotski/klotski_ffi.cc

Loading…
Cancel
Save