forked from Stremio/stremio-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
164 lines (138 loc) · 4.61 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
cmake_minimum_required(VERSION 3.13)
# set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Minimum OS X deployment version")
set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
endif()
project(stremio VERSION "4.4.168")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
add_definitions(-DSTREMIO_SHELL_VERSION="${PROJECT_VERSION}" -DUNICODE -D_UNICODE)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
list(APPEND WEBENGINE_CONFIG use_proprietary_codecs)
set(SOURCES
main.cpp
mpv.cpp
stremioprocess.cpp
screensaver.cpp
systemtray.cpp
razerchroma.cpp
qclipboardproxy.cpp
verifysig.c
mainapplication.h
autoupdater.cpp
qml.qrc
)
set(MPV_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/libmpv/include)
if(WIN32)
list(APPEND SOURCES deps/chroma/chroma stremio.rc)
set(QT_DEFAULT_MAJOR_VERSION 5)
set(ENV{Qt5_DIR} $ENV{QTDIR})
set(MPV_LIBRARY_mpv ${CMAKE_CURRENT_SOURCE_DIR}/deps/libmpv/win32/mpv.lib)
endif()
if(APPLE)
list(APPEND SOURCES images/stremio.icns)
set_source_files_properties(images/stremio.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(MPV_LIBRARY_mpv ${CMAKE_CURRENT_SOURCE_DIR}/deps/lib/libmpv.dylib)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@executable_path/../Frameworks")
add_definitions("-pipe")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -arch x86_64")
set(ENV{OPENSSL_ROOT_DIR} $ENV{OPENSSL_BIN_PATH})
endif()
set(QAPPLICATION_CLASS QApplication)
add_subdirectory(deps/singleapplication)
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Widgets Network Qml Quick WebEngine WebChannel DBus OpenGL REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(MPV REQUIRED)
if(APPLE)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES
BUNDLE True
MACOSX_BUNDLE_ICON_FILE ${PROJECT_NAME}.icns
MACOSX_BUNDLE_GUI_IDENTIFIER com.smartcodeltd.${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_EXECUTABLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist
)
find_package(OpenGL)
if(NOT OPENGL_FOUND)
find_package(GLES2)
if(NOT GLES2_FOUND)
message(FATAL_ERROR "OpenGL or GLES2 is required")
else(NOT GLES2_FOUND)
set(OPENGL_LIBS ${GLES2_LIBRARY})
endif(NOT GLES2_FOUND)
else(NOT OPENGL_FOUND)
set(OPENGL_LIBS ${OPENGL_gl_LIBRARY})
endif(NOT OPENGL_FOUND)
find_library(C_LIBRARY NAMES c REQUIRED)
find_library(COREFOUNDATION_LIBRARY NAMES CoreFoundation REQUIRED)
find_library(DISKARBITRATION_LIBRARY DiskArbitration REQUIRED)
find_library(IOKIT_LIBRARY NAMES IOKit REQUIRED)
find_library(AGL_LIBRARY NAMES AGL REQUIRED)
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC
${C_LIBRARY}
${COREFOUNDATION_LIBRARY}
${DISKARBITRATION_LIBRARY}
${IOKIT_LIBRARY}
${OPENGL_LIBS}
${AGL_LIBRARY}
)
else()
add_executable(${PROJECT_NAME} ${SOURCES})
endif()
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Release")
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
endif()
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${MPV_INCLUDE_DIR}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/chroma>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/deps/chroma/ChromaSDK/inc>
)
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC
Qt5::Qml
Qt5::Quick
Qt5::Network
Qt5::Widgets
Qt5::WebEngine
Qt5::WebChannel
Qt5::DBus
Qt5::OpenGL
SingleApplication::SingleApplication
OpenSSL::Crypto
${MPV_LIBRARY}
)
if(UNIX AND NOT APPLE)
if(DEFINED ENV{DH_BUILD})
set(BIN_INSTALL_TARGET ${CMAKE_INSTALL_BINDIR})
else()
set(BIN_INSTALL_TARGET opt/stremio)
endif()
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_INSTALL_TARGET})
endif()
#
# icons
#
set(ICONS_DIR ${CMAKE_CURRENT_BINARY_DIR}/icons)
add_custom_command(OUTPUT ${ICONS_DIR}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dist-utils/generate-icons.sh
ARGS ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating icons"
)
add_custom_target(icons ALL DEPENDS ${ICONS_DIR})
install(DIRECTORY ${ICONS_DIR} DESTINATION share/icons/stremio)
#
# server.js
#
set(SERVER ${CMAKE_CURRENT_BINARY_DIR}/server.js)
add_custom_command(OUTPUT ${SERVER}
COMMAND wget -O ${SERVER} -i ${CMAKE_CURRENT_SOURCE_DIR}/server-url.txt
COMMENT "Downloading server"
)
add_custom_target(server ALL DEPENDS ${SERVER})
install(FILES ${SERVER} DESTINATION share/stremio)