-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
50 lines (41 loc) · 1.43 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.15)
project(cmake_python_r_example)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (MSVC)
# warning level 4 and all warnings as errors
add_compile_options(/W4 /WX)
else ()
# lots of warnings and all warnings as errors
add_compile_options(-Wall -Wextra -Wold-style-cast -pedantic -Werror)
endif ()
option(BUILD_RPACKAGE "Build RPackage bindings" ON)
option(BUILD_PYPACKAGE "Build Python package bindings" ON)
INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(span HAS_SPAN)
if (NOT HAS_SPAN)
message(FATAL_ERROR "Could not find span header, but it is required for the numpy bindings")
endif ()
# version handling
set(CppLIB_VERSION "0.0.1")
add_subdirectory(src/CppLib)
define_property(TARGET PROPERTY Package_Name
BRIEF_DOCS "The name of R/Python package to be installed"
FULL_DOCS "The name of R/Python package to be installed"
)
enable_testing()
if (BUILD_RPACKAGE)
if(WIN32 AND NOT MINGW)
message(WARNING "R packages on Windows are only supported using MINGW as a compiler. "
"Disabling building R package.")
else()
add_subdirectory(src/RPackage)
add_subdirectory(tests/R)
endif()
endif ()
if (BUILD_PYPACKAGE)
add_subdirectory(src/Python)
add_subdirectory(tests/Python)
endif ()