-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
119 lines (109 loc) · 4.31 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
cmake_minimum_required(VERSION 3.18)
project("big-launcher"
LANGUAGES CXX
VERSION 0.2.1
)
set(CMAKE_CXX_STANDARD 20)
set(EXECUTABLE_TITLE "big-launcher")
add_compile_definitions("$<$<CONFIG:DEBUG>:DEBUG>")
if (WIN32)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:MULTIPLE") # Workaround for Nanosvg and SDL_image header conflicts
endif ()
option(EXTRA_WARNINGS "Enable extra compiler warnings" OFF)
if (EXTRA_WARNINGS)
if (MSVC)
add_compile_options(/W4 /WX)
else ()
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion)
endif ()
endif ()
# Find dependencies
if (UNIX)
find_package(PkgConfig MODULE REQUIRED)
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)
pkg_check_modules(SDL2_IMAGE REQUIRED IMPORTED_TARGET SDL2_image)
pkg_check_modules(SDL2_TTF REQUIRED IMPORTED_TARGET SDL2_ttf)
pkg_check_modules(SDL2_MIXER REQUIRED IMPORTED_TARGET SDL2_mixer)
pkg_check_modules(LIBXML2 REQUIRED IMPORTED_TARGET libxml-2.0)
pkg_check_modules(INIH REQUIRED IMPORTED_TARGET inih)
pkg_check_modules(FMT REQUIRED IMPORTED_TARGET fmt)
pkg_check_modules(SPDLOG REQUIRED IMPORTED_TARGET spdlog)
elseif (WIN32)
find_package(SDL2 CONFIG REQUIRED)
find_package(sdl2_image CONFIG REQUIRED)
find_package(SDL2_ttf CONFIG REQUIRED)
find_package(SDL2_mixer CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(unofficial-inih CONFIG REQUIRED)
find_path(GETOPT_INCLUDE_DIR "getopt.h" REQUIRED)
find_library(GETOPT getopt REQUIRED)
add_compile_options("/utf-8")
endif()
include_directories(${PROJECT_BINARY_DIR})
# Config and Layout file generation
set(HTML_USERAGENT "Mozilla/5.0 (Linux; Tizen 2.3; SmartHub; SMART-TV; SmartTV; U; Maple2012) AppleWebKit/538.1+ (KHTML, like Gecko) TV Safari/538.1+")
if (UNIX)
set(BROWSER_COMMAND "chromium --start-fullscreen --kiosk")
set(BROWSER_COMMAND_SMARTTV "chromium --start-fullscreen --kiosk --user-agent=\"${HTML_USERAGENT}\"")
set(ICONS_DIR "assets/icons/")
set(CMD_KODI "kodi")
set(CMD_PLEX "plex-htpc")
set(CMD_NETFLIX "${BROWSER_COMMAND} netflix.com")
set(CMD_YOUTUBE "${BROWSER_COMMAND_SMARTTV} youtube.com/tv")
set(CMD_JELLYFIN "jellyfinmediaplayer")
set(CMD_DISNEYPLUS "${BROWSER_COMMAND} disneyplus.com")
set(CMD_STEAM "steam")
set(CMD_RETROARCH "retroarch")
set(CMD_MINECRAFT "minecraft")
elseif (WIN32)
set(BROWSER_COMMAND "\"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe\" --start-fullscreen --kiosk --user-agent=\"${HTML_USERAGENT}\"")
set(ICONS_DIR ".\\assets\\icons\\")
set(CMD_KODI "\"C:\\Program Files\\Kodi\\kodi.exe\"")
set(CMD_PLEX "\"C:\\Program Files\\Plex\\Plex Media Player\\PlexMediaPlayer.exe\"")
set(CMD_NETFLIX "${BROWSER_COMMAND} netflix.com")
set(CMD_YOUTUBE "${BROWSER_COMMAND_SMARTTV} youtube.com/tv")
set(CMD_JELLYFIN "jellyfinmediaplayer")
set(CMD_DISNEYPLUS "${BROWSER_COMMAND} disneyplus.com")
set(CMD_STEAM "\"C:\\Program Files (x86)\\Steam\\steam.exe\"")
set(CMD_RETROARCH "retroarch")
set(CMD_MINECRAFT "minecraft")
endif ()
configure_file(${PROJECT_SOURCE_DIR}/config/config.h.in ${PROJECT_BINARY_DIR}/lconfig.h)
configure_file(${PROJECT_SOURCE_DIR}/config/layout.xml.in ${PROJECT_BINARY_DIR}/layout.xml)
configure_file(${PROJECT_SOURCE_DIR}/config/config.ini.in ${PROJECT_BINARY_DIR}/config.ini)
# Generate Windows application manifest
if (WIN32)
set(VERSION_M ${PROJECT_VERSION_MAJOR})
if (PROJECT_VERSION_MINOR)
set(VERSION_N ${PROJECT_VERSION_MINOR})
else ()
set(VERSION_N 0)
endif()
if (PROJECT_VERSION_PATCH)
set(VERSION_O ${PROJECT_VERSION_PATCH})
else ()
set(VERSION_O 0)
endif()
if (PROJECT_VERSION_TWEAK)
set(VERSION_P ${PROJECT_VERSION_TWEAK})
else ()
set(VERSION_P 0)
endif()
configure_file(
"${PROJECT_SOURCE_DIR}/config/${EXECUTABLE_TITLE}.manifest.in"
"${PROJECT_BINARY_DIR}/${EXECUTABLE_TITLE}.manifest"
)
endif()
add_subdirectory(src)
# Installation
if (WIN32)
install(TARGETS ${EXECUTABLE_TITLE} DESTINATION ".")
install(FILES ${PROJECT_BINARY_DIR}/config.ini ${PROJECT_BINARY_DIR}/layout.xml DESTINATION ".")
install(DIRECTORY ${PROJECT_BINARY_DIR}/assets DESTINATION ".")
set(CPACK_PACKAGE_NAME ${EXECUTABLE_TITLE})
set(CPACK_GENERATOR "ZIP")
include(CPack)
endif ()