Skip to content

Commit

Permalink
static library, PIC
Browse files Browse the repository at this point in the history
  • Loading branch information
KowerKoint committed Feb 1, 2024
1 parent 043974c commit de5ca61
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"))
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,3 @@ doc = [
"ipykernel == 6.17.*",
"sphinx-autoapi == 2.0.*"
]

[tool.setuptools]
include-package-data = true
zip-safe = false
3 changes: 1 addition & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions python/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ NB_MODULE(qulacs_core, m) {
m.def("Haar_random_state",
static_cast<StateVector (*)(UINT, UINT)>(&StateVector::Haar_random_state));
m.def("Haar_random_state", static_cast<StateVector (*)(UINT)>(&StateVector::Haar_random_state));
m.def("initialize", [] { Kokkos::initialize(); });
m.def("finialize", &Kokkos::finalize);
}

0 comments on commit de5ca61

Please sign in to comment.