CMakeLists.txt 1.08 KB
Newer Older
1
project(PyleneTest)
Edwin Carlinet's avatar
Edwin Carlinet committed
2
cmake_minimum_required(VERSION 3.11)
3

4
5
# Conan's 'cmake' generator is used only for pybind11. Will be remove
# when the cmake_find_package generator will work for pybind11
Baptiste Esteban's avatar
Baptiste Esteban committed
6
7
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake")
  include("${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake")
8
  conan_set_rpath()
Baptiste Esteban's avatar
Baptiste Esteban committed
9
10
endif()

11
find_package(Pylene REQUIRED COMPONENTS Pylene)
12
13

add_executable(main main.cpp)
Edwin Carlinet's avatar
Edwin Carlinet committed
14
target_link_libraries(main Pylene::Pylene)
Baptiste Esteban's avatar
Baptiste Esteban committed
15

16
17
18
19
20
21
22
23
if (WITH_PYLENE_NUMPY)
  set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CONAN_BUILD_DIRS_PYBIND11}") # TO REMOVE WHEN cmake_find_package FOR PYBIND11 WORKS
  include(pybind11Install) # TO REMOVE WHEN cmake_find_package FOR PYBIND11 WORKS
  find_package(Pylene REQUIRED COMPONENTS Pylene-numpy)

  pybind11_add_module(pylene_extension)
  target_sources(pylene_extension PRIVATE pylene_extension.cpp)
  target_link_libraries(pylene_extension PRIVATE Pylene::Pylene-numpy) # CONAN_LIBS_PYBIND11 TO REMOVE WHEN cmake_find_package FOR PYBIND11 WORKS
Baptiste Esteban's avatar
Baptiste Esteban committed
24
  file(COPY ${CMAKE_SOURCE_DIR}/main.py DESTINATION ${CMAKE_BINARY_DIR})
25
endif(WITH_PYLENE_NUMPY)