CMakeLists.txt 1.66 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
#
# @author Tobias Weber
# @date jan-2019
# @license GPLv3, see 'LICENSE' file
#

cmake_minimum_required(VERSION 3.0)
project(magstructfact)

set(CMAKE_VERBOSE_MAKEFILE TRUE)
Tobias WEBER's avatar
Tobias WEBER committed
11
option(BUILD_LIB "build as dynamic library" FALSE)
12

13
14
15
16
17
18
19
20
21
22
# system specific settings
message("Building for ${CMAKE_SYSTEM_NAME} systems.")

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	# pass linker --subsystem option
	add_compile_options(-Wl,--subsystem,windows)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
	add_compile_options(-mmacosx-version-min=10.10)
endif()

23
24
25
26
27
28
find_package(Boost REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL)

set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTOMOC TRUE)

Tobias WEBER's avatar
Tobias WEBER committed
29
30
set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++20)
31
32
add_definitions(${Boost_CXX_FLAGS})

Tobias WEBER's avatar
Tobias WEBER committed
33
34
35
36
37
include_directories(
	"${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../.."
	"ext" "ext/gemmi/include" "ext/gemmi/third_party"
	"../../ext/gemmi/include" "../../ext/gemmi/third_party"
)
38
39
40
41
42

if(BUILD_LIB)
	set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

	add_definitions(-DBUILD_LIB)
Tobias WEBER's avatar
Tobias WEBER committed
43
	add_library(takin_magstructfact SHARED
44
		magstructfact.cpp magstructfact.h
45
		../../tlibs2/libs/glplot.cpp ../../tlibs2/libs/glplot.h)
46
else()
Tobias WEBER's avatar
Tobias WEBER committed
47
	add_executable(takin_magstructfact
48
		magstructfact.cpp magstructfact.h
49
		../../tlibs2/libs/glplot.cpp ../../tlibs2/libs/glplot.h)
50
51
endif()

52
53
54
55
56
57
58
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
	target_link_options(takin_magstructfact
		# create an __info_plist section in the binary
		PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,${PROJECT_SOURCE_DIR}/../../../core/setup_mac/InfoBundle.plist
	)
endif()

Tobias WEBER's avatar
Tobias WEBER committed
59
60
target_link_libraries(takin_magstructfact ${Boost_LIBRARIES})
qt5_use_modules(takin_magstructfact Core Gui Widgets OpenGL)