forked from McStasMcXtrace/McCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (47 loc) · 1.69 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
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.17.0)
cmake_policy(VERSION 3.17.0)
# This file will build McStas and/or McXtrace
project(mccode C)
# Set module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
#Ensure various variables are set to sensible default values for the target
#platform (if not already set by a toolchain file):
# Setup McCode values (from mkdist or defaults)
include(MCUtil)
option( BUILD_MCSTAS "Build McStas" OFF )
option( BUILD_MCXTRACE "Build McXtrace" OFF )
option( BUILD_TOOLS "Include tools" ON )
if (${BUILD_MCSTAS} AND ${BUILD_MCXTRACE})
message(WARNING "Configuration requests building both McStas and McXtrace which is likely to fail.")
elseif(NOT (${BUILD_MCSTAS} OR ${BUILD_MCXTRACE}))
message(FATAL_ERROR "Configuration requires building one of McStas or McXtrace via -DBUILD_MCXTRACE=ON or -DBUILD_MCSTAS=ON")
endif()
if(${BUILD_MCSTAS})
setupMCCODE("mcstas")
message(STATUS "Configuring McStas build ${FLAVOR}")
add_subdirectory(mcstas)
add_subdirectory(mcstas-comps)
if ( BUILD_TOOLS )
add_subdirectory(tools)
endif()
endif()
if (${BUILD_MCXTRACE})
setupMCCODE("mcxtrace")
message(STATUS "Configuring McXtrace build ${FLAVOR}")
add_subdirectory(mcxtrace)
add_subdirectory(mcxtrace-comps)
if ( BUILD_TOOLS )
add_subdirectory(tools)
endif()
endif()
# Find/Fetch dependencies:
option( ENSURE_MCPL "Build Third Party code MCPL if not already available" ON )
if( ENSURE_MCPL )
include( MCPL )
endif()
if ( BUILD_MCSTAS )
option( ENSURE_NCRYSTAL "Build Third Party code NCrystal if not already available" ON )
if( ENSURE_NCRYSTAL )
include( NCrystal )
endif()
endif()