-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.in.cmake
85 lines (57 loc) · 2.23 KB
/
config.in.cmake
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Directories
SET(PACKAGE_SRC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/package")
SET(RESOURCES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resources")
IF(NOT BUILD_PATH)
SET(BUILD_PATH "${CMAKE_CURRENT_SOURCE_DIR}/_build")
ENDIF()
SET(PACKAGE_BUILD_PATH "${BUILD_PATH}/ROpenFLUID")
SET(LIBR_BUILD_PATH "${BUILD_PATH}/_Rlibrary")
# Required R packages
SET(REQUIRED_R_PACKAGES "RUnit" "roxygen2")
IF(WIN32)
SET(REQUIRED_R_PACKAGES "RUnit")
ENDIF()
# Title and description
SET(OpenFLUID_R_TITLE "R Interface to OpenFLUID Platform Framework for Modelling and Simulation of Landscapes")
SET(OpenFLUID_R_DESC "Provides a collection of functions to load, parameterize, run and analyze OpenFLUID simulations within the GNU R environment.")
# ROpenFLUID Version
SET(OpenFLUID_R_VERSION_PATCH "20241120")
# Required OpenFLUID version
SET(REQUIRED_OPENFLUID_VERSION "2.2.0")
# ===========================================================================================
# Prefix
FIND_PATH(OpenFLUID_PREFIX
NAMES bin/openfluid bin/openfluid.exe
HINTS
$ENV{OPENFLUID_INSTALL_PREFIX}
/usr
/usr/local
/sw # Fink
/opt
/opt/local # DarwinPorts
PATH_SUFFIXES
)
SET(OpenFLUID_CMDCLI "${OpenFLUID_PREFIX}/bin/openfluid")
IF(WIN32)
SET(OpenFLUID_CMDCLI "${OpenFLUID_CMDCLI}.exe")
ENDIF()
EXECUTE_PROCESS(COMMAND "${OpenFLUID_CMDCLI}" "--version"
OUTPUT_VARIABLE OpenFLUID_VERSION
RESULT_VARIABLE OpenFLUID_VERSION_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(OpenFLUID_VERSION_RESULT)
MESSAGE(FATAL_ERROR "Error getting current openfluid version")
ENDIF()
STRING(REGEX REPLACE
"~[a-z,A-Z,0-9]*" ""
OpenFLUID_R_VERSION ${OpenFLUID_VERSION})
IF(OpenFLUID_R_VERSION_PATCH)
SET(OpenFLUID_R_VERSION "${OpenFLUID_R_VERSION}-${OpenFLUID_R_VERSION_PATCH}")
ENDIF()
IF(${OpenFLUID_VERSION} VERSION_LESS ${REQUIRED_OPENFLUID_VERSION})
MESSAGE(FATAL_ERROR " Required OpenFLUID version is ${REQUIRED_OPENFLUID_VERSION} or higher (found version ${OpenFLUID_VERSION})")
ENDIF()
# use R to get the current date
EXECUTE_PROCESS(COMMAND "R" "--vanilla" "--slave" "-e" "cat(format(Sys.time(),'%Y-%m-%d'))"
OUTPUT_VARIABLE OpenFLUID_R_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)