-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
142 lines (120 loc) · 4.64 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
cmake_minimum_required(VERSION 3.21)
# Detect vcpkg ports
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
file(TO_CMAKE_PATH "$ENV{VCPKG_ROOT}" ENV_VCPKG_ROOT)
set(CMAKE_TOOLCHAIN_FILE "${ENV_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
endif()
# Import Qt6 dirctory if available
if(DEFINED ENV{Qt6_HOME})
set(CMAKE_PREFIX_PATH $ENV{Qt6_HOME})
endif()
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
project(ShiftIntrinsicGuide
LANGUAGES CXX
VERSION 1.0.6
DESCRIPTION "A GUI for viewing x86 intrinsics and associated performance data"
)
# Default to a release build if desired configuration is not specified
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()
# Set the install location to the source location if not currently specified
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
message("Installing into source folder")
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install CACHE PATH "..." FORCE)
endif()
# Use folder structure for arranging files within IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_package(Qt6 COMPONENTS Quick QML Network XML Concurrent REQUIRED)
qt_add_executable(ShiftIntrinsicGuide MANUAL_FINALIZATION)
if(WIN32)
set_target_properties(ShiftIntrinsicGuide PROPERTIES
WIN32_EXECUTABLE TRUE
)
target_sources(ShiftIntrinsicGuide PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/source/Resources.rc"
)
elseif(APPLE)
set_target_properties(ShiftIntrinsicGuide PROPERTIES
MACOSX_BUNDLE TRUE
)
endif()
configure_file(include/Version.h.in Version.h)
# Add in the executable code
target_sources(ShiftIntrinsicGuide PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/Application.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/InternalData.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/IntrinsicModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/IntrinsicProxyModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/TechnologyModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/TypeModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/CategoryModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/MeasurementModel.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Downloader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/DataProvider.h"
"${CMAKE_CURRENT_SOURCE_DIR}/source/main.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/Application.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/IntrinsicModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/IntrinsicProxyModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/TechnologyModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/TypeModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/CategoryModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/MeasurementModel.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/Downloader.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/DataProvider.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/source/Resources.qrc"
)
target_compile_features(ShiftIntrinsicGuide
INTERFACE cxx_std_17
)
target_include_directories(ShiftIntrinsicGuide
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${PROJECT_BINARY_DIR}"
)
target_link_libraries(ShiftIntrinsicGuide PRIVATE
Qt6::Quick
Qt6::Qml
Qt6::Network
Qt6::Xml
Qt6::Concurrent
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Header Files" REGULAR_EXPRESSION "*.h")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source Files" REGULAR_EXPRESSION "*.cpp")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source Files" REGULAR_EXPRESSION "*.qml")
qt_add_qml_module(ShiftIntrinsicGuide
URI qml
RESOURCE_PREFIX /
VERSION 1.0
QML_FILES
"source/main.qml"
"source/Page1.qml"
"source/MenuView.qml"
"source/IntrinsicView.qml"
)
include(InstallRequiredSystemLibraries)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
include(GNUInstallDirs)
install(TARGETS ShiftIntrinsicGuide
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
qt_import_qml_plugins(ShiftIntrinsicGuide)
qt_finalize_executable(ShiftIntrinsicGuide)
# Include Qt deployment helper function
include(DeployQt)
deployqt(ShiftIntrinsicGuide "${CMAKE_CURRENT_SOURCE_DIR}/source/")
set(CPACK_GENERATOR "ZIP")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
include(CPack)