Skip to content

Commit 06304b4

Browse files
committed
[cmake] Change directory structure for cpp2py library to match app4triqs
1 parent 9a6e011 commit 06304b4

28 files changed

+42
-19
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ MESSAGE(STATUS "LibClang additional flags: ${LIBCLANG_CXX_FLAGS}")
5151
set(LIBCLANG_CXX_FLAGS "${LIBCLANG_CXX_FLAGS}" CACHE STRING "Additional flags to be passed to libclang when parsing with clang")
5252
set(LIBCLANG_LOCATION "${LIBCLANG_LOCATION}" CACHE STRING "Location of the libclang library")
5353

54-
# Detect Python
54+
# --- Python ---
55+
5556
find_package(Python)
57+
add_library(cpp2py::python_and_numpy ALIAS python_and_numpy)
5658
install(TARGETS python_and_numpy EXPORT cpp2py-targets)
5759

5860
# find_package(Python3 COMPONENTS Development Interpreter)
@@ -74,8 +76,7 @@ install(TARGETS python_and_numpy EXPORT cpp2py-targets)
7476
# subdirs
7577
add_subdirectory(bin) # Executables
7678
add_subdirectory(cmake) # Exported Cpp2Py-Config
77-
add_subdirectory(include)
78-
add_subdirectory(lib)
79+
add_subdirectory(c++/cpp2py)
7980

8081
# The python modules
8182
add_subdirectory(cpp2py)

c++/cpp2py/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
add_library(cpp2py signal_handler.cpp exceptions.cpp)
2+
add_library(cpp2py::cpp2py ALIAS cpp2py)
3+
4+
target_compile_options(cpp2py PRIVATE -std=c++14 -fPIC)
5+
target_include_directories(cpp2py
6+
PUBLIC
7+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/c++>
8+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/c++>
9+
)
10+
11+
# Install the library in lib and export the cpp2py target
12+
install(TARGETS cpp2py EXPORT cpp2py-targets DESTINATION lib)
13+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" PATTERN "*.hxx")
14+
15+
# --- Python ---
16+
17+
target_link_libraries(cpp2py PUBLIC python_and_numpy)
18+
19+
# ---------------
20+
21+
# Install the exported targets
22+
install(EXPORT cpp2py-targets NAMESPACE cpp2py:: DESTINATION lib/cmake/cpp2py)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)