CMakeLists.txt 1.22 KB
Newer Older
Baptiste Esteban's avatar
Baptiste Esteban committed
1
2
3
4
5
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
        message(WARNING "Building the Python components without POSITION_INDEPENDENT_CODE enabled. \
                         Build should fail during the linking part of the compilation of the pylena module.")
endif()

6
find_package(fmt 6.0 REQUIRED)
7
find_package(pybind11 REQUIRED)
8

9
10
11
add_library(Pylene-numpy)
add_library(Pylene::Pylene-numpy ALIAS Pylene-numpy)
target_include_directories(Pylene-numpy PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Baptiste Esteban's avatar
Baptiste Esteban committed
12
                                               $<INSTALL_INTERFACE:include>
13
)
14
target_sources(Pylene-numpy PRIVATE src/core/image_cast.cpp
Baptiste Esteban's avatar
Baptiste Esteban committed
15
                                    src/core/numpy_format.cpp)
16

Baptiste Esteban's avatar
Baptiste Esteban committed
17
target_link_libraries(Pylene-numpy PUBLIC Pylene ${PYTHON_LIBRARIES})
18
19
target_link_libraries(Pylene-numpy PRIVATE fmt::fmt)
target_include_directories(Pylene-numpy PRIVATE ${pybind11_INCLUDE_DIRS})
20

21
pybind11_add_module(pylena)
22
target_link_libraries(pylena PRIVATE Pylene Pylene-numpy)
23
target_include_directories(pylena PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
24
25
26
target_sources(pylena PRIVATE src/module.cpp)

include(GNUInstallDirs)
27
install(TARGETS Pylene-numpy
28
29
        EXPORT PyleneTargets)

30
31
install(DIRECTORY include/pln
        TYPE INCLUDE)