-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (40 loc) · 1.6 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
cmake_minimum_required(VERSION 3.4)
# Find packages
FIND_PACKAGE(deal.II 8.3.0 REQUIRED
HINTS ${deal.II_DIR} ${DEAL_II_DIR} /opt/dealii /usr $ENV{DEAL_II_DIR}
)
DEAL_II_INITIALIZE_CACHED_VARIABLES()
project(MBOX LANGUAGES CXX)
# Additional include dirs
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/common)
# Make directories for input and output
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/input)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/output)
# Copy input files (mesh etc.) to build directory
file(COPY ${CMAKE_SOURCE_DIR}/input DESTINATION ${CMAKE_BINARY_DIR})
set(MBOX_SOURCE mbox_main.cpp)
add_executable(mbox ${MBOX_SOURCE})
DEAL_II_SETUP_TARGET(mbox)
ADD_CUSTOM_TARGET(clear
COMMAND rm -rf ${CMAKE_BINARY_DIR}/output/*
COMMAND rm ${CMAKE_BINARY_DIR}/input/*.prm
COMMENT "Deleted all output stuff and generated parameter files"
)
ADD_CUSTOM_TARGET(debug
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
)
ADD_CUSTOM_TARGET(release
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Release"
)
ADD_CUSTOM_TARGET(run
COMMAND mbox
COMMENT "Run solver with ${CMAKE_BUILD_TYPE} configuration"
)
ADD_CUSTOM_TARGET(param
COMMAND parameter_gui ${CMAKE_BINARY_DIR}/output/parameters.xml
)