CMakeLists.txt 2.97 KB
Newer Older
Tobias WEBER's avatar
Tobias WEBER committed
1
2
3
4
5
6
#
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-2018
# @license see 'LICENSE' file
#

Tobias WEBER's avatar
Tobias WEBER committed
7
project(scanbrowser)
8
cmake_minimum_required(VERSION 3.0)
Tobias WEBER's avatar
Tobias WEBER committed
9

10
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../../../tlibs2/cmake")
Tobias WEBER's avatar
Tobias WEBER committed
11
12
13
14
15
16
17
18

message("Build type: ${CMAKE_BUILD_TYPE}")

if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
	set(CMAKE_VERBOSE_MAKEFILE TRUE)
endif()


Tobias WEBER's avatar
Tobias WEBER committed
19
set(CMAKE_CXX_STANDARD 20)
Tobias WEBER's avatar
Tobias WEBER committed
20
21
add_compile_options(-std=c++20)
add_compile_options(-Wall -Wextra)
Tobias WEBER's avatar
Tobias WEBER committed
22
23
24
25


# -----------------------------------------------------------------------------
# Boost
Tobias WEBER's avatar
Tobias WEBER committed
26
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
Tobias WEBER's avatar
Tobias WEBER committed
27
28
29
30
31
32
33
34
35
36
find_package(Boost REQUIRED COMPONENTS system filesystem iostreams REQUIRED)
add_definitions(${Boost_CXX_FLAGS})

# Qt
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
37
38
39
40
41

# Minuit
find_package(Minuit2 REQUIRED)
find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)
Tobias WEBER's avatar
Tobias WEBER committed
42
43
44
45
46
47
48
49
50
51
52
53
54
# -----------------------------------------------------------------------------



# -----------------------------------------------------------------------------
# Build parser
find_package(FLEX REQUIRED)
find_package(BISON 3.0 REQUIRED)

# temp dir for parser
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/parser)

# parser
Tobias WEBER's avatar
Tobias WEBER committed
55
BISON_TARGET(cliparser cli/cliparser.y ${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.cpp
Tobias WEBER's avatar
Tobias WEBER committed
56
57
58
	COMPILE_FLAGS "-S lalr1.cc --defines=${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.h")

# lexer
Tobias WEBER's avatar
Tobias WEBER committed
59
FLEX_TARGET(clilexer cli/clilexer.l ${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.cpp
Tobias WEBER's avatar
Tobias WEBER committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	COMPILE_FLAGS "--c++ --header-file=${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.h")
ADD_FLEX_BISON_DEPENDENCY(clilexer cliparser)

# let moc ignore the generated files
set_property(SOURCE
	parser/cliparser_impl.cpp parser/cliparser_impl.h parser/cliparser_impl.hpp
	parser/clilexer_impl.cpp parser/clilexer_impl.h parser/clilexer_impl.hpp
	PROPERTY SKIP_AUTOGEN ON)
# -----------------------------------------------------------------------------



include_directories(
	"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/ext"
	"${PROJECT_SOURCE_DIR}/../.." "${PROJECT_SOURCE_DIR}/../../ext"
Tobias WEBER's avatar
Tobias WEBER committed
75
	"${PROJECT_SOURCE_DIR}/cli"
Tobias WEBER's avatar
Tobias WEBER committed
76
77
78
79
80
	"${Boost_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}/.."
	"${PROJECT_BINARY_DIR}/parser"
)


Tobias WEBER's avatar
Tobias WEBER committed
81
add_executable(scanbrowser
Tobias WEBER's avatar
Tobias WEBER committed
82
83
84
85
86
87
	main.cpp mainwnd.cpp mainwnd.h
	filebrowser.cpp filebrowser.h
	workspace.cpp workspace.h
	data.cpp data.h plot.cpp plot.h
	command.cpp command.h
	globals.cpp globals.h
88
	hacks.cpp hacks.h
Tobias WEBER's avatar
Tobias WEBER committed
89
90
91

	${BISON_cliparser_OUTPUT_SOURCE} ${BISON_cliparser_OUTPUT_HEADER}
	${FLEX_clilexer_OUTPUTS} ${FLEX_clilexer_OUTPUT_HEADER}
Tobias WEBER's avatar
Tobias WEBER committed
92
93
94
	cli/cliparser.cpp cli/cliparser.h cli/cliparser_types.h
	cli/ast.cpp cli/sym.cpp
	cli/funcs.cpp cli/funcs.h
Tobias WEBER's avatar
Tobias WEBER committed
95
96
97
98
99
100
101

	../../libs/log.cpp

	../../ext/qcp/qcustomplot.cpp ../../ext/qcp/qcustomplot.h
)


Tobias WEBER's avatar
Tobias WEBER committed
102
target_link_libraries(scanbrowser
Tobias WEBER's avatar
Tobias WEBER committed
103
104
	${Boost_LIBRARIES}
	Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport
105
	${Minuit2_LIBRARIES} Threads::Threads OpenMP::OpenMP_CXX
Tobias WEBER's avatar
Tobias WEBER committed
106
107
	-ldl
)