-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
CMakeLists.txt
180 lines (143 loc) · 4.84 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
cmake_minimum_required( VERSION 3.16 )
# Target platform is Windows 10
if( CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017" OR
CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015" )
set(CMAKE_SYSTEM_VERSION 10.0)
endif()
cmake_policy(SET CMP0091 NEW)
project( scidavis
VERSION 2.3.0
DESCRIPTION "SciDAVis is a free application for Scientific Data Analysis and Visualization."
HOMEPAGE_URL "https://scidavis.sourceforge.net"
LANGUAGES CXX C )
set( CMAKE_CXX_STANDARD 17)
set( CMAKE_CXX_STANDARD_REQUIRED TRUE )
set( CMAKE_CXX_EXTENSIONS OFF )
set( CMAKE_C_STANDARD 11)
set( CMAKE_C_STANDARD_REQUIRED TRUE )
set( CMAKE_C_EXTENSIONS OFF )
get_property( MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH} )
# Target platform is Windows 10
if( CMAKE_GENERATOR STREQUAL "Visual Studio 15 2017" OR
CMAKE_GENERATOR STREQUAL "Visual Studio 14 2015" )
if (CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS 10)
message(SEND_ERROR "Windows 10 SDK is not found! Please, install one or set \
a CMAKE_WINDOWS_KITS_10_DIR environment variable to an absolute path to look \
for Windows 10 SDKs. The directory is expected to contain Include/10.0.* directories.")
else()
message(STATUS "Use Windows 10 SDK version ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
endif()
endif()
find_package( Qt5
COMPONENTS
Core
Gui
Widgets
Svg
PrintSupport
Xml
OpenGL
LinguistTools
REQUIRED
)
set( CMAKE_AUTOMOC ON )
set( CMAKE_AUTOUIC ON )
set( CMAKE_AUTORCC ON )
if( MSVC )
# /wd4456 /wd4457 /wd4458 Silent "declaration of %1 hides %2 ..."
# /wd4251 Silent dll-related warnings
# /wd4127 Silent conditional expression is constant (Qt headers)
# /wd4310 Silent cast truncates constant value (muParser headers)
# /wd4996 strcpy is unsafe warnings, equiv to #define _SCL_SECURE_NO_WARNINGS
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /W4 /permissive- \
/wd4456 /wd4457 /wd4458 /wd4251 /wd4127 /wd4310 /wd4996" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /permissive-" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nonportable-include-path" )
else()
add_compile_options( "/MP" )
endif()
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -Wall -Wextra -pedantic" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic" )
endif()
if( APPLE )
add_compile_definitions( GL_SILENCE_DEPRECATION )
endif()
# Searching for updates
option( SEARCH_FOR_UPDATES "Enable Searching for updates" ON )
# Download links
option( DOWNLOAD_LINKS "Enable Download links" ON )
if( SEARCH_FOR_UPDATES OR DOWNLOAD_LINKS )
find_package( Qt5 COMPONENTS Network REQUIRED )
endif()
option( SCRIPTING_MUPARSER "Enable muParser Scripting" ON )
option( SCRIPTING_PYTHON "Enable Python Scripting" OFF )
option( BUILD_TESTS "Build tests" OFF )
if( SCRIPTING_PYTHON )
if( MINGW )
set( Python3_FIND_REGISTRY LAST )
endif()
find_package( Python3 COMPONENTS Interpreter Development REQUIRED )
find_package( SIP REQUIRED )
find_package( PyQt REQUIRED )
endif()
option( ORIGIN_IMPORT "Enable importing OriginLab project files" OFF )
# GSL
find_package( GSL REQUIRED )
# ZLIB
find_package( ZLIB "1.2.11" REQUIRED )
# OpenGL
find_package( OpenGL COMPONENTS OpenGL REQUIRED )
# muParser
find_library( MUPARSER_LIB
NAMES muparser
REQUIRED
)
find_path( MUPARSER_INCLUDE_DIR
NAMES "muParser.h"
REQUIRED
)
message( STATUS "Found muParser : ${MUPARSER_LIB} include: ${MUPARSER_INCLUDE_DIR}" )
add_subdirectory( 3rdparty )
add_subdirectory( libscidavis )
add_subdirectory( scidavis )
add_subdirectory( fitPlugins )
if( BUILD_TESTS )
enable_testing()
add_subdirectory( test )
endif()
# Documentation
set( DOC_FILES
ChangeLog.md
README.md
gpl.txt
license.rtf
)
if( WIN32 )
install( FILES ${DOC_FILES} DESTINATION . )
else()
install( FILES ${DOC_FILES} DESTINATION share/doc/scidavis )
endif()
if( MSVC )
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "scidavis")
endif()
set( CPACK_PACKAGE_NAME "SciDAVis" )
set( CPACK_PACKAGE_VENDOR "High Performance Coders" )
set( CPACK_PACKAGE_DESCRIPTION "SciDAVis Installer" )
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/gpl.txt" )
set( CPACK_PACKAGE_EXECUTABLES "scidavis;SciDAVis" )
set( CPACK_CREATE_DESKTOP_LINKS "scidavis" )
set( CPACK_STRIP_FILES ON )
# Source packaging
set( CPACK_SOURCE_IGNORE_FILES "/build/;CMakeLists\.txt\.user*;/\.git/" )
# WIX
set( CPACK_WIX_UPGRADE_GUID "d6f4ef98-3744-47a2-b581-d789db8a4d63" )
set( CPACK_WIX_LICENSE_RTF "${CMAKE_SOURCE_DIR}/license.rtf" )
set( CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/scidavis/icons/scidavis.ico" )
# NSIS
set( CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/scidavis/icons/scidavis.ico" )
set( CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON )
set( CPACK_NSIS_EXECUTABLES_DIRECTORY . )
include(CPack)