diff --git a/CMakeLists.txt b/CMakeLists.txt index 5271236b..b95eae2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,6 @@ if(NOT DEFINED QULACS_USE_EXE) set(QULACS_USE_EXE ON) endif(NOT DEFINED QULACS_USE_EXE) -set(BUILD_SHARED_LIBS ON CACHE BOOL "Build project as a shared library for dynamic linking") - message(STATUS "SKBUILD = ${SKBUILD}") message(STATUS "QULACS_USE_TEST = ${QULACS_USE_TEST}") @@ -52,6 +50,7 @@ if(NOT kokkos_fetch_POPULATED) message(STATUS "Fetch Kokkos for parallel execution") FetchContent_Populate(kokkos_fetch) add_subdirectory(${kokkos_fetch_SOURCE_DIR}) + set_property(TARGET kokkoscore PROPERTY POSITION_INDEPENDENT_CODE ON) endif(NOT kokkos_fetch_POPULATED) # Eigen @@ -102,6 +101,7 @@ else() endif(QULACS_USE_TEST) add_library(qulacs) +set_property(TARGET qulacs PROPERTY POSITION_INDEPENDENT_CODE ON) ### Compiler options ### if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")) diff --git a/pyproject.toml b/pyproject.toml index 797f6c0d..a88581c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,3 @@ doc = [ "ipykernel == 6.17.*", "sphinx-autoapi == 2.0.*" ] - -[tool.setuptools] -include-package-data = true -zip-safe = false diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 146181f1..62242de1 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.21) message(STATUS "Building library for python...") nanobind_add_module(qulacs_core STABLE_ABI binding.cpp) -target_link_libraries(qulacs_core PRIVATE Kokkos::kokkos) -target_link_libraries(qulacs_core PUBLIC qulacs) +target_link_libraries(qulacs_core PRIVATE qulacs Kokkos::kokkos) target_include_directories(qulacs_core PRIVATE ${PROJECT_SOURCE_DIR}/qulacs) install(TARGETS qulacs_core LIBRARY DESTINATION qulacs2023) diff --git a/python/binding.cpp b/python/binding.cpp index 8f830fa6..ef641fc4 100644 --- a/python/binding.cpp +++ b/python/binding.cpp @@ -35,4 +35,6 @@ NB_MODULE(qulacs_core, m) { m.def("Haar_random_state", static_cast(&StateVector::Haar_random_state)); m.def("Haar_random_state", static_cast(&StateVector::Haar_random_state)); + m.def("initialize", [] { Kokkos::initialize(); }); + m.def("finialize", &Kokkos::finalize); }