forked from Stremio/stremio-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
129 lines (112 loc) · 3.81 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
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 /opt/homebrew/opt/mpv/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 arm64")
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)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION opt/stremio)
endif()