-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·92 lines (74 loc) · 2.41 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
cmake_minimum_required(VERSION 3.5)
project(CryliaPlayer VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set compiler flags
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# For GCC or G++
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif(MSVC)
# For Visual Studio
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall")
endif()
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Qml Svg Core Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Qml Svg Core Sql)
find_package(SDL2 QUIET)
if(NOT SDL2_FOUND)
message(STATUS "SDL2 not found. Fallback to SDL3.")
# Find SDL3 package
find_package(SDL3 REQUIRED CONFIG)
set(SDL_INCLUDE_DIRS ${SDL3_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL3_LIBRARIES})
else()
message(STATUS "SDL2 found.")
set(SDL_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL2_LIBRARIES})
endif()
find_library(SDL_MIXER_LIBRARY NAMES SDL2_mixer SDL3_mixer)
include_directories(${SDL_INCLUDE_DIRS})
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
file(GLOB_RECURSE PROJECT_SOURCES src/*.cpp)
file(GLOB_RECURSE PROJECT_HEADERS src/*.h)
file(GLOB_RECURSE PROJECT_RESOURCES assets/resources.qrc)
add_executable(CryliaPlayer
${PROJECT_SOURCES}
${PROJECT_HEADERS}
${PROJECT_RESOURCES}
)
target_link_libraries(CryliaPlayer PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Sql
${SDL_LIBRARIES}
${SDL_MIXER_LIBRARY}
PkgConfig::LIBAV
fmt
stdc++fs
#mavx
)
install(TARGETS CryliaPlayer
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
set(DESKTOP_FILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/CryliaPlayer.desktop.in)
set(DESKTOP_FILE ${CMAKE_CURRENT_BINARY_DIR}/CryliaPlayer.desktop)
configure_file(${DESKTOP_FILE_IN} ${DESKTOP_FILE} @ONLY)
install(FILES ${DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES assets/aqua.jpg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons)