-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
135 lines (132 loc) · 5.02 KB
/
CMakeLists.txt
File metadata and controls
135 lines (132 loc) · 5.02 KB
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
#===============================================================================
# Basic Setup
#===============================================================================
cmake_minimum_required(VERSION 3.20)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
#===============================================================================
# Dependencies
#===============================================================================
#-------------------------------------------------------------------------------
# Fetch
#-------------------------------------------------------------------------------
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
# Logging
FetchContent_Declare(spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog
GIT_TAG v1.12.0)
# GUI
set(FLTK_BUILD_TEST OFF CACHE BOOL " " FORCE)
# Doesn't work on GitHub
#if(UNIX AND NOT APPLE)
# set(OPTION_USE_PANGO ON CACHE BOOL " " FORCE)
#endif()
FetchCOntent_Declare(fltk
GIT_REPOSITORY https://github.com/fltk/fltk
# v1.4.0, doesn't have a release tag yet
GIT_TAG ed5ee81ccd042f08373da1f49486075ec0e40480)
FetchContent_MakeAvailable(spdlog fltk)
#===============================================================================
# PsSp project
#===============================================================================
project(PsSp
LANGUAGES CXX
DESCRIPTION "Passive-source Seismic-processing"
HOMEPAGE_URL https://arbCoding.github.io/PsSp
VERSION 0.2.0)
include_directories(${PsSp_SOURCE_DIR}/src)
#-------------------------------------------------------------------------------
# PsSp program
#-------------------------------------------------------------------------------
add_executable(PsSp WIN32 MACOSX_BUNDLE
src/main.cpp
src/Windows/About.cpp
src/Windows/Main.cpp
src/Windows/Welcome.cpp
src/Application/Application.cpp
)
if (APPLE)
target_link_libraries(PsSp PRIVATE "-framework cocoa")
endif()
# System prevents warnings from fltk!
target_include_directories(PsSp SYSTEM PRIVATE ${fltk_BINARY_DIR}
${fltk_SOURCE_DIR} ${fltk_INCLUDE_DIRS})
target_link_libraries(PsSp PRIVATE
fltk
spdlog::spdlog_header_only)
# If (macOS or Linux) and Release build
# then strip the binary of debug symbols to make it smaller
# Windows doesn't need this
if (UNIX AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
add_custom_command(TARGET PsSp
COMMAND strip "$<TARGET_FILE:PsSp>"
VERBATIM)
endif()
#===============================================================================
# macOS Bundle
#===============================================================================
#set(MACOSX_BUNDLE_BUNDLE_NAME "PsSp")
#set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
#set(MACOSX_BUNDLE_COPYRIGHT
# "2023 Alexander R. Blanchette <arbCoding@gmail.com>")
#===============================================================================
# CPack Installation
#===============================================================================
install(TARGETS PsSp
RUNTIME DESTINATION .
BUNDLE DESTINATION ${CMAKE_SOURCE_DIR})
# In the future I want to build a app-directory that this then installs in
# /Applications
if(CPACK_GENERATOR MATCHES "productbuild")
# macOS
set(CPACK_RESOURCE_FILE_README
${PsSp_SOURCE_DIR}/installers/macOS/Readme.txt)
set(CPACK_RESOURCE_FILE_WELCOME
${PsSp_SOURCE_DIR}/installers/macOS/Welcome.txt)
install(FILES ${PsSp_SOURCE_DIR}/License.txt DESTINATION .
COMPONENT license)
set(CPACK_RESOURCE_FILE_LICENSE ${PsSp_SOURCE_DIR}/License2.txt)
set(CPACK_SET_DESTDIR "ON")
else()
# Windows/Linux
install(FILES ${PsSp_SOURCE_DIR}/LICENSE DESTINATION .
COMPONENT license)
set(CPACK_RESOURCE_FILE_LICENSE ${PsSp_SOURCE_DIR}/LICENSE)
endif()
set(CPACK_COMPONENT_license_HIDDEN TRUE)
set(CPACK_COMPONENT_license_REQUIRED TRUE)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "PsSp")
set(CPACK_PACKAGE_VENDOR "Alexander R. Blanchette <arbCoding@gmail.com>")
# Allow separating components instead of monolithic
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
# Meta-data
set(CPACK_PACKAGE_NAME "PsSp")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDER "https://arbCoding.github.io/PsSp/")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://arbCoding.github.io/PsSp/")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Passive-source Seismic Processing")
# Filename/installation directory
set(CPACK_PACKAGE_FILE_NAME "PsSp")
# Archive filename
set(CPACK_ARCHIVE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-\
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
# Make checksum
set(CPACK_PACKAGE_CHECKSUM SHA512)
# Windows Specific NSIS installer
set(CPACK_NSIS_HELP_LINK "https://arbCoding.github.io/PsSp/")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
# Debian Specific
# Installs into /usr/bin
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEB_COMPONENT_INSTALL OFF)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Alexander R. Blanchette \
<arbCoding@gmail.com>")
# RedHat Specific
# Installs into /usr/bin
set(CPACK_RPM_COMPONENT_INSTALL OFF)
# Don't strip binaries
set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
include(CPack)