Browse Source

build: optimize python ffi packing

master
Dnomd343 1 month ago
parent
commit
f2492e3ce3
  1. 3
      src/core/main.cc
  2. 4
      src/core_ffi/py_ffi/CMakeLists.txt
  3. 7
      src/core_ffi/py_ffi/packing/CMakeLists.txt
  4. 1
      src/core_ffi/py_ffi/packing/CMakeLists.txt
  5. 20
      src/core_ffi/py_ffi/packing/MANIFEST.in
  6. 1
      src/core_ffi/py_ffi/packing/setup.py
  7. 1
      src/core_ffi/py_ffi/packing/src/CMakeLists.txt
  8. 1
      src/core_ffi/py_ffi/packing/src/core
  9. 1
      src/core_ffi/py_ffi/packing/src/core_ffi
  10. 1
      src/core_ffi/py_ffi/packing/src/project
  11. 1
      src/core_ffi/py_ffi/packing/third_party
  12. 2
      third_party/ThirdParty.cmake

3
src/core/main.cc

@ -1,5 +1,4 @@
#include <algorithm>
#include <thread>
#include <iostream>
#include <format>
#include <map>
@ -16,8 +15,6 @@
#include <parallel_hashmap/phmap.h>
#include "../../third_party/thread-pool/include/BS_thread_pool.hpp"
using klotski::mover::MaskMover;
using klotski::fast_cal::FastCal;

4
src/core_ffi/py_ffi/CMakeLists.txt

@ -23,3 +23,7 @@ pybind11_add_module(klotski_py
target_include_directories(klotski_py PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(klotski_py PRIVATE klotski::core)
set_target_properties(klotski_py PROPERTIES OUTPUT_NAME _klotski)
if (SKBUILD)
install(TARGETS klotski_py DESTINATION .)
endif()

7
src/core_ffi/py_ffi/packing/CMakeLists.txt

@ -1,7 +0,0 @@
cmake_minimum_required(VERSION 3.12)
project(klotski_py_demo VERSION "0.0.1")
add_subdirectory(src/project)
install(TARGETS klotski_py DESTINATION .)

1
src/core_ffi/py_ffi/packing/CMakeLists.txt

@ -0,0 +1 @@
../../../../CMakeLists.txt

20
src/core_ffi/py_ffi/packing/MANIFEST.in

@ -1,8 +1,18 @@
include CMakeLists.txt
include README.md
include pyproject.toml
include setup.py
include src/klotski/__init__.py
recursive-include src/project *
recursive-exclude src/project/src/core_ffi/py_ffi/packing *
include README.md
exclude MANIFEST.in
include src/klotski/*.py
include CMakeLists.txt
include src/CMakeLists.txt
include src/core_ffi/CMakeLists.txt
recursive-include src/core *
recursive-include src/core_ffi/py_ffi *
recursive-exclude src/core_ffi/py_ffi/packing *
include third_party/ThirdParty.cmake
recursive-include third_party/pybind11 *
recursive-include third_party/parallel-hashmap *

1
src/core_ffi/py_ffi/packing/setup.py

@ -9,5 +9,6 @@ setup(
packages=["klotski"],
package_dir={"": "src"},
cmake_install_dir="src/klotski",
cmake_args=['-DKLSK_ENABLE_TESTING=OFF', '-DKLSK_ENABLE_BENCHMARK=OFF', '-DKLSK_C_FFI=OFF', '-DKLSK_RUST_FFI=OFF', '-DKLSK_PYTHON_FFI=ON'],
python_requires=">=3.9",
)

1
src/core_ffi/py_ffi/packing/src/CMakeLists.txt

@ -0,0 +1 @@
../../../../CMakeLists.txt

1
src/core_ffi/py_ffi/packing/src/core

@ -0,0 +1 @@
../../../../core

1
src/core_ffi/py_ffi/packing/src/core_ffi

@ -0,0 +1 @@
../../../../core_ffi/

1
src/core_ffi/py_ffi/packing/src/project

@ -1 +0,0 @@
../../../../../../klotski/

1
src/core_ffi/py_ffi/packing/third_party

@ -0,0 +1 @@
../../../../third_party/

2
third_party/ThirdParty.cmake

@ -9,6 +9,8 @@ if (KLSK_ENABLE_BENCHMARK)
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_EXCEPTIONS OFF)
add_subdirectory(${KLSK_THIRD_PARTY}/benchmark EXCLUDE_FROM_ALL)
# TODO: enable bs::thread_pool
endif()
if (KLSK_ENABLE_TESTING)

Loading…
Cancel
Save