Skip to content

Commit

Permalink
Bind xtal_tdzdd as static library
Browse files Browse the repository at this point in the history
Shared libraries are localted under site-packages which is not usually
in LD_LIBRARY_PATH. Thus, this commit makes internal `xtal_tdzdd` as
static library and position independent.
See pybind/cmake_example#11 (comment)
  • Loading branch information
lan496 committed Jun 15, 2022
1 parent a2953e7 commit 66dae7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ message(STATUS ${pybind11_SOURCE_DIR})

add_subdirectory(${pybind11_SOURCE_DIR})
pybind11_add_module(pyzdd_ ./xtal_tdzdd/wrapper.cpp)
target_link_libraries(pyzdd_ PUBLIC xtal_tdzdd)
target_link_libraries(pyzdd_ PRIVATE xtal_tdzdd)
4 changes: 2 additions & 2 deletions xtal_tdzdd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ project(xtal_tdzdd CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Fetch TdZdd
include(FetchContent)
Expand All @@ -23,7 +22,8 @@ endif()

add_compile_options(-O3 -Wall -Winit-self -Wlogical-op)

add_library(xtal_tdzdd SHARED
add_library(xtal_tdzdd STATIC
iterator.cpp)
set_target_properties(xtal_tdzdd PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(xtal_tdzdd PRIVATE ./)
target_include_directories(xtal_tdzdd PRIVATE ${tdzdd_SOURCE_DIR}/include)

0 comments on commit 66dae7f

Please sign in to comment.