mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 04:48:23 +01:00
Added "STRICT_R_HEADERS" to CMake
This commit is contained in:
parent
ee75a8fc8e
commit
a018d574c2
@ -1,21 +1,24 @@
|
||||
# this is the current cmake version distributed by debian stable (buster)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
# Version 3.9+ offers new MPI package variables
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
project(Poet VERSION 0.0)
|
||||
project(POET VERSION 0.1)
|
||||
|
||||
add_executable(poet kin.cpp)
|
||||
|
||||
# Not needed until now
|
||||
# specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
#set(CMAKE_CXX_STANDARD 11)
|
||||
#set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
find_package(MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
|
||||
list(APPEND R_DEPS "Rcpp" "RInside")
|
||||
set(GCC_CXX_FLAGS "-D STRICT_R_HEADERS -Wall -O3")
|
||||
add_definitions(${GCC_CXX_FLAGS})
|
||||
|
||||
# prepare R environment (Rcpp + RInside)
|
||||
find_program(R_EXE "R")
|
||||
|
||||
# search for R executable, R header file and library path
|
||||
if(R_EXE)
|
||||
execute_process(COMMAND ${R_EXE} RHOME
|
||||
OUTPUT_VARIABLE R_ROOT_DIR
|
||||
@ -24,7 +27,7 @@ if(R_EXE)
|
||||
|
||||
find_path(R_INCLUDE_DIR R.h
|
||||
HINTS ${R_ROOT_DIR}
|
||||
PATHS /usr/inlcude /usr/local/include
|
||||
PATHS /usr/inlcude /usr/local/include /usr/share
|
||||
PATH_SUFFIXES include/R R/include
|
||||
)
|
||||
|
||||
@ -38,34 +41,8 @@ endif()
|
||||
set(R_LIBRARIES ${R_LIBRARY})
|
||||
set(R_INCLUDE_DIRS ${R_INCLUDE_DIR})
|
||||
|
||||
#foreach(_r_deps ${R_DEPS})
|
||||
# execute_process(COMMAND echo "cat(find.package('${_r_deps}'))"
|
||||
# COMMAND ${R_EXE} --vanilla --slave
|
||||
# RESULT_VARIABLE _rd
|
||||
# ERROR_QUIET
|
||||
# OUTPUT_VARIABLE _r_deps_path
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
# )
|
||||
#
|
||||
# if(_rd)
|
||||
# message(FATAL_ERROR "${_r_deps} not found!")
|
||||
# endif()
|
||||
#
|
||||
# find_library(R_${_r_deps}_LIBRARY
|
||||
# lib${_r_deps}.so
|
||||
# HINTS ${_r_deps_path}/lib
|
||||
# )
|
||||
#
|
||||
# if(R_${_r_deps}_LIBRARY)
|
||||
# list(APPEND R_LIBRARIES ${R_${_r_deps}_LIBRARY})
|
||||
# else()
|
||||
# message(STATUS "lol")
|
||||
# unset(${R_${_r_deps}_LIBRARY})
|
||||
# endif()
|
||||
#
|
||||
#endforeach()
|
||||
|
||||
|
||||
# find Rcpp include directory
|
||||
execute_process(COMMAND echo "cat(find.package('Rcpp'))"
|
||||
COMMAND ${R_EXE} --vanilla --slave
|
||||
RESULT_VARIABLE RCPP_NOT_FOUND
|
||||
@ -84,6 +61,8 @@ find_path(R_Rcpp_INCLUDE_DIR Rcpp.h
|
||||
|
||||
list(APPEND R_INCLUDE_DIRS ${R_Rcpp_INCLUDE_DIR})
|
||||
|
||||
|
||||
# find RInside libraries and include path
|
||||
execute_process(COMMAND echo "cat(find.package('RInside'))"
|
||||
COMMAND ${R_EXE} --vanilla --slave
|
||||
RESULT_VARIABLE RINSIDE_NOT_FOUND
|
||||
@ -107,30 +86,16 @@ find_path(R_RInside_INCLUDE_DIR RInside.h
|
||||
|
||||
list(APPEND R_INCLUDE_DIRS ${R_RInside_INCLUDE_DIR})
|
||||
|
||||
#execute_process(
|
||||
# COMMAND ${R_EXE} "--slave" "--vanilla" "-e" "stopifnot(require('Rcpp'));cat(Rcpp:::Rcpp.system.file('include'))"
|
||||
# OUTPUT_VARIABLE LIBRCPP_INCLUDE_DIRS
|
||||
#)
|
||||
#
|
||||
#execute_process(
|
||||
# COMMAND ${R_EXE} "--slave" "--vanilla" "-e" "stopifnot(require('RInside'));cat(RInside:::RInsideCFlags())"
|
||||
# OUTPUT_VARIABLE LIBRINSIDE_INCLUDE_DIRS
|
||||
#)
|
||||
#
|
||||
#message(STATUS ${LIBRCPP_INCLUDE_DIRS})
|
||||
#message(STATUS ${LIBRINSIDE_INCLUDE_DIRS})
|
||||
|
||||
# may find a better way ...
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBRINSIDE_INCLUDE_DIRS}")
|
||||
|
||||
include_directories(${R_INCLUDE_DIRS})
|
||||
include_directories(${MPI_INCLUDE_PATH})
|
||||
#include found directories for the whole scope (will be changed with modularization)
|
||||
include_directories(${R_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_DIRS})
|
||||
|
||||
#define program libraries
|
||||
add_library(Worker STATIC worker.cpp)
|
||||
target_link_libraries(Worker MPI::MPI_CXX)
|
||||
|
||||
add_library(DHT STATIC DHT.cpp dht_wrapper.cpp)
|
||||
target_link_libraries(DHT crypto)
|
||||
|
||||
add_library(R_UTILS STATIC r_utils.cpp)
|
||||
|
||||
target_link_libraries(poet PUBLIC Worker DHT R_UTILS ${MPI_C_LIBRARIES} ${R_LIBRARIES})
|
||||
target_link_libraries(poet PUBLIC Worker DHT R_UTILS ${R_LIBRARIES} MPI::MPI_CXX)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user