|
| 1 | +cmake_minimum_required(VERSION 3.16) |
| 2 | + |
| 3 | +set(CMAKE_CXX_STANDARD 17) |
| 4 | +set(CMAKE_CXX_STANDARD_REQUIRED True) |
| 5 | +set(CMAKE_CXX_EXTENSIONS OFF) |
| 6 | + |
| 7 | +project(smooth VERSION 0.0.1) |
| 8 | + |
| 9 | +if(SKBUILD) |
| 10 | + message(STATUS "The project is built using scikit-build") |
| 11 | + endif() |
| 12 | + |
| 13 | +# Pybind11 |
| 14 | +find_package(pybind11 REQUIRED) |
| 15 | + |
| 16 | +# CARMA |
| 17 | +ADD_SUBDIRECTORY(../src/libs/carma carma) |
| 18 | + |
| 19 | +# BLAS and LAPACK. Needed by Armadillo |
| 20 | +find_package(BLAS) |
| 21 | +find_package(LAPACK) |
| 22 | +if(LAPACK_FOUND AND BLAS_FOUND) |
| 23 | + set(lapackblas_libraries ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) |
| 24 | +else() |
| 25 | + # IS: This is where they are on my system. This might change from one OS to another |
| 26 | + set(lapackblas_libraries "/usr/lib/x86_64-linux-gnu/") |
| 27 | +endif() |
| 28 | + |
| 29 | +# Armadillo |
| 30 | +find_package(armadillo) |
| 31 | +IF(NOT ARMADILLO_FOUND) |
| 32 | + set(ARMADILLO_INCLUDE_DIRS "/usr/lib/") |
| 33 | +ENDIF() |
| 34 | +include_directories(${ARMADILLO_INCLUDE_DIRS}) |
| 35 | + |
| 36 | +# Adam General |
| 37 | +pybind11_add_module(_adam_general ../src/python_examples/adamGeneral.cpp) |
| 38 | +target_include_directories(_adam_general PRIVATE ../src/python_examples/.) |
| 39 | +target_link_libraries(_adam_general PRIVATE carma::carma ${ARMADILLO_LIBRARIES} ${lapackblas_libraries}) |
| 40 | +install(TARGETS _adam_general DESTINATION smooth/adam_general) |
| 41 | + |
| 42 | + |
| 43 | +# Old experimental stuff by Leo |
| 44 | +# code to add the pybind11 cpp module, look at demo project |
| 45 | +# (https://github.com/ltsaprounis/python-cpp-experiments/tree/main) for details. |
| 46 | +#pybind11_add_module(_my_linalg ../src/python_examples/my_linalg.cpp) |
| 47 | + |
| 48 | +# add CARMA as a subdirectory |
| 49 | +#add_subdirectory(../src/libs/carma build) |
| 50 | +#target_link_libraries(_my_linalg |
| 51 | +# PRIVATE carma::carma |
| 52 | +# ${ARMADILLO_LIBRARIES} |
| 53 | +#) |
| 54 | + |
| 55 | +# install(TARGETS _my_linalg DESTINATION smooth/my_linalg) |
| 56 | + |
0 commit comments