mirror of https://github.com/dnomd343/klotski.git
Dnomd343
1 month ago
38 changed files with 66 additions and 47 deletions
@ -1,31 +1,14 @@ |
|||||
cmake_minimum_required(VERSION 3.12) |
cmake_minimum_required(VERSION 3.12) |
||||
project(core_ffi) |
project(core_ffi) |
||||
|
|
||||
set(CMAKE_CXX_STANDARD 23) |
|
||||
|
|
||||
if (KLSK_C_FFI) |
if (KLSK_C_FFI) |
||||
add_library(klotski_c c_ffi/all_cases.cc) |
add_subdirectory(c_ffi) |
||||
target_include_directories(klotski_c PUBLIC c_ffi/include) |
|
||||
target_link_libraries(klotski_c PRIVATE klotski::core) |
|
||||
set_target_properties(klotski_c PROPERTIES OUTPUT_NAME klotski) |
|
||||
endif() |
endif() |
||||
|
|
||||
if (KLSK_PYTHON_FFI) |
if (KLSK_RUST_FFI) |
||||
add_subdirectory(py_ffi) |
add_subdirectory(rust_ffi) |
||||
endif() |
endif() |
||||
|
|
||||
if (KLSK_RUST_FFI) |
if (KLSK_PYTHON_FFI) |
||||
if (CARGO_BUILD) |
add_subdirectory(python_ffi) |
||||
install(TARGETS klotski_core DESTINATION .) |
|
||||
else() |
|
||||
# just for IDE highlight |
|
||||
add_library(klotski_rs |
|
||||
rust_ffi/adapter/short_code.cc |
|
||||
rust_ffi/adapter/common_code.cc |
|
||||
rust_ffi/target/cxxbridge/rust_ffi/src/bridge.rs.cc |
|
||||
) |
|
||||
target_include_directories(klotski_rs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) |
|
||||
target_include_directories(klotski_rs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/rust_ffi/target/cxxbridge) |
|
||||
target_link_libraries(klotski_rs PRIVATE klotski_core) |
|
||||
endif() |
|
||||
endif() |
endif() |
||||
|
@ -0,0 +1,16 @@ |
|||||
|
cmake_minimum_required(VERSION 3.12) |
||||
|
project(klotski_c LANGUAGES CXX) |
||||
|
|
||||
|
set(CMAKE_CXX_STANDARD 23) |
||||
|
|
||||
|
set(KLSK_C_FFI_SRC |
||||
|
all_cases.cc |
||||
|
) |
||||
|
|
||||
|
# TODO: add `-fno-rtti -fno-exceptions -fvisibility=hidden` |
||||
|
add_library(klotski_c STATIC ${KLSK_C_FFI_SRC}) # TODO: allow shared lib |
||||
|
target_include_directories(klotski_c PUBLIC include) |
||||
|
target_link_libraries(klotski_c PRIVATE klotski::core) |
||||
|
|
||||
|
set_target_properties(klotski_c PROPERTIES OUTPUT_NAME klotski) |
||||
|
add_library(klotski::c_ffi ALIAS klotski_c) |
@ -0,0 +1,23 @@ |
|||||
|
cmake_minimum_required(VERSION 3.12) |
||||
|
project(klotski_rs LANGUAGES CXX) |
||||
|
|
||||
|
set(CMAKE_CXX_STANDARD 23) |
||||
|
|
||||
|
if (KLSK_DEV_MODE) |
||||
|
set(KLSK_RUST_FFI_SRC |
||||
|
adapter/short_code.cc |
||||
|
adapter/common_code.cc |
||||
|
target/cxxbridge/rust_ffi/src/bridge.rs.cc |
||||
|
) |
||||
|
add_library(klotski_rs STATIC ${KLSK_RUST_FFI_SRC}) # just for IDE highlight |
||||
|
target_include_directories(klotski_rs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../) |
||||
|
target_include_directories(klotski_rs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/target/cxxbridge) |
||||
|
target_link_libraries(klotski_rs PRIVATE klotski::core) |
||||
|
|
||||
|
set_target_properties(klotski_rs PROPERTIES OUTPUT_NAME klotski) |
||||
|
add_library(klotski::rs_ffi ALIAS klotski_rs) |
||||
|
endif() |
||||
|
|
||||
|
if (CARGO_BUILD) |
||||
|
install(TARGETS klotski_core DESTINATION .) |
||||
|
endif() |
@ -0,0 +1 @@ |
|||||
|
../../../../CMakeLists.txt |
Loading…
Reference in new issue