-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathCMakeLists.txt
135 lines (108 loc) · 4.23 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
cmake_minimum_required(VERSION 3.16)
project(green VERSION 2.0.18 LANGUAGES CXX)
option(GREEN_WAYLAND "Include Wayland support" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if(NOT GREEN_ENV)
set(GREEN_ENV Development)
set(GREEN_BUILD_ID -dev)
set(GREEN_LOG_FILE dev)
endif()
configure_file(config.h.in config.h @ONLY)
configure_file(installer.iss.in installer.iss @ONLY)
find_package(Qt6 6.7 COMPONENTS Concurrent Quick QuickControls2 Widgets QuickWidgets Xml Core5Compat Bluetooth SerialPort LinguistTools Multimedia REQUIRED)
find_package(hidapi REQUIRED)
find_package(KDSingleApplication-qt6 CONFIG REQUIRED)
find_package(gdk REQUIRED COMPONENT green_gdk_full)
find_package(ZXing REQUIRED)
include(CMakePrintHelpers)
cmake_print_properties(TARGETS gdk::green_gdk_full PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_LIBRARIES
IMPORTED_LOCATION_RELEASE
)
find_library(COUNTLY_LIB NAMES libcountly.a REQUIRED)
find_library(LIBSERIALPORT_LIB NAMES libserialport.a REQUIRED)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
if (WIN32)
find_library(HID_LIB NAMES libhid.a REQUIRED)
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libgcc -static-libstdc++ -fstack-protector")
elseif (APPLE)
find_library(SECURITY Security REQUIRED)
elseif (UNIX)
find_library(AVCODEC NAMES libavcodec.a REQUIRED)
find_library(AVDEVICE NAMES libavdevice.a REQUIRED)
find_library(AVFILTER NAMES libavfilter.a REQUIRED)
find_library(AVFORMAT NAMES libavformat.a REQUIRED)
find_library(AVUTIL NAMES libavutil.a REQUIRED)
find_library(SWSCALE NAMES libswscale.a REQUIRED)
find_library(SWRESAMPLE NAMES libswresample.a REQUIRED)
find_library(POSTPROC NAMES libpostproc.a REQUIRED)
set(FFMPEG_LIBRARIES /depends/linux-x86_64/plugins/multimedia/libffmpegmediaplugin.a ${AVDEVICE} ${AVFILTER} ${AVFORMAT} ${AVCODEC} ${POSTPROC} ${SWRESAMPLE} ${SWSCALE} ${AVUTIL} Xrandr Xrender)
message(STATUS "FFMPEG_LIBRARIES: ${FFMPEG_LIBRARIES}")
if (GREEN_WAYLAND)
find_package(Qt6 6.4 COMPONENTS WaylandClient REQUIRED)
endif()
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -fstack-protector -Wl,--wrap=__divmoddi4 -Wl,--wrap=log2f")
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-DNO_ICONV)
add_definitions(-DGDK_STATIC_DEFINE)
include(src.cmake)
set(app_icon_macos "${CMAKE_CURRENT_SOURCE_DIR}/assets/icons/green.icns")
set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
enable_language("RC")
set(app_icon_win "${CMAKE_CURRENT_SOURCE_DIR}/green.rc")
endif()
qt_add_executable(green WIN32 MACOSX_BUNDLE
${TARGET_SOURCES}
${app_icon_macos}
${app_icon_win}
)
set_target_properties(green PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/Info.plist.in
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
LINK_SEARCH_START_STATIC ON
LINK_SEARCH_END_STATIC ON
)
target_link_libraries(green
PRIVATE
ZXing::Core
gdk::green_gdk_full
${COUNTLY_LIB}
${LIBSERIALPORT_LIB}
Qt6::Concurrent Qt6::Quick Qt6::QuickControls2 Qt6::Widgets Qt6::QuickWidgets Qt6::Xml Qt6::Core5Compat Qt6::Bluetooth Qt6::SerialPort Qt6::Multimedia
${SECURITY}
hidapi::hidapi
${HID_LIB}
KDAB::kdsingleapplication
${FFMPEG_LIBRARIES}
)
if (WIN32)
elseif (APPLE)
set_target_properties(green PROPERTIES OUTPUT_NAME "Blockstream Green")
elseif (UNIX)
target_link_libraries(green PRIVATE dl Xrender)
qt_import_plugins(green INCLUDE Qt6::QXcbIntegrationPlugin Qt6::QFFmpegMediaPlugin)
if (GREEN_WAYLAND)
target_link_libraries(green PRIVATE Qt6::WaylandClient Xrender)
qt_import_plugins(green INCLUDE Qt6::QWaylandIntegrationPlugin Qt6::QFFmpegMediaPlugin)
endif()
endif()
install(TARGETS green
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
get_target_property(GDK_INCLUDE gdk::green_gdk_full INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(green PRIVATE
src src/jade src/resolvers src/controllers src/ledger src/handlers
${GDK_INCLUDE}/libwally-core/
"${CMAKE_CURRENT_BINARY_DIR}"
)
include(qml.cmake)
include(assets.cmake)
include(translations.cmake)