-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
103 lines (81 loc) · 3.06 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
cmake_minimum_required(VERSION 3.10)
set(_project_version 0.0.0)
set(LPD8EDITOR_QAPPLICATION_VERSION ${_project_version})
find_package(Git)
if (GIT_EXECUTABLE)
message(STATUS "Trying to get a version from git describe")
execute_process(
COMMAND
${GIT_EXECUTABLE} describe --tags --long --dirty --always
WORKING_DIRECTORY
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE
LPD8EDITOR_QAPPLICATION_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
message(STATUS "Git describe version: ${LPD8EDITOR_QAPPLICATION_VERSION}")
if (LPD8EDITOR_QAPPLICATION_VERSION)
string(REGEX MATCH [0-9]+[.][0-9]+[.][0-9]+
_parsed_git_describe_version
${LPD8EDITOR_QAPPLICATION_VERSION}
)
message(STATUS "Parsed git describe version: ${_parsed_git_describe_version}")
if (_parsed_git_describe_version VERSION_GREATER _project_version)
message(STATUS "Found a valid version from git describe")
set(_project_version ${_parsed_git_describe_version})
endif()
else()
message(STATUS "Could not find a version from git describe")
endif()
endif()
if (NOT LPD8EDITOR_QAPPLICATION_VERSION)
message(STATUS "Trying to get a version from source folder name ${CMAKE_SOURCE_DIR}")
string(REGEX MATCH [0-9]+[.][0-9]+[.][0-9]+$
_parsed_source_folder_name_version
${CMAKE_SOURCE_DIR}
)
if (_parsed_source_folder_name_version VERSION_GREATER _project_version)
set(_project_version ${_parsed_source_folder_name_version})
else()
message(STATUS "Could not find a version from source folder name ${CMAKE_SOURCE_DIR}")
endif()
set(LPD8EDITOR_QAPPLICATION_VERSION ${_project_version})
endif()
project(lpd8editor
VERSION ${_project_version}
HOMEPAGE_URL https://github.com/charlesfleche/lpd8editor
DESCRIPTION "A linux editor for the Akai LPD8"
LANGUAGES CXX
)
message(STATUS "Project version: ${CMAKE_PROJECT_VERSION}")
message(STATUS "QApplication version: ${LPD8EDITOR_QAPPLICATION_VERSION}")
enable_testing()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(GNUInstallDirs)
find_package(ALSA REQUIRED)
find_package(Git REQUIRED)
find_package(Qt5 COMPONENTS LinguistTools Sql Svg Test Widgets REQUIRED)
add_subdirectory(translations)
add_subdirectory(src)
add_custom_target(github
SOURCES
.github/workflows/test.yml
.github/workflows/release.yml
)
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
set(CPACK_PACKAGE_CONTACT "Charles Flèche <charles.fleche@free.fr>")
set(CPACK_PACKAGE_VENDOR "charlesfleche")
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/lpd8editor.svg)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.md)
set(CPACK_GENERATOR "DEB;TGZ")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_SECTION sound)
include(CPack)