-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (96 loc) · 3.62 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
cmake_minimum_required(VERSION 3.20)
project(recs VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 20)
# configuration file for project name and version
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories(${PROJECT_BINARY_DIR})
# gui asset files
include_directories(assets)
if (UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED)
# GTK4
pkg_check_modules(GTK4 REQUIRED gtk4)
include_directories(${GTK4_INCLUDE_DIRS})
link_directories(${GTK4_LIBRARY_DIRS})
add_definitions(${GTK4_CFLAGS_OTHER})
# lib
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
elseif (WIN32)
find_package(GTK REQUIRED)
set(VCPKG_INCLUDE_PATH C:/src/vcpkg/installed/x64-windows)
set(GTK4_INCLUDE_DIRS "${VCPKG_INCLUDE_PATH}/include/gtk-4.0"
"${VCPKG_INCLUDE_PATH}/include/gio-unix-2.0"
"${VCPKG_INCLUDE_PATH}/include/cairo"
"${VCPKG_INCLUDE_PATH}/include/pango-1.0"
"${VCPKG_INCLUDE_PATH}/include/harfbuzz"
"${VCPKG_INCLUDE_PATH}/include/fribidi"
"${VCPKG_INCLUDE_PATH}/include/harfbuzz"
"${VCPKG_INCLUDE_PATH}/include/gdk-pixbuf-2.0"
"${VCPKG_INCLUDE_PATH}/include/pixman-1"
"${VCPKG_INCLUDE_PATH}/include/uuid"
"${VCPKG_INCLUDE_PATH}/include/freetype2"
"${VCPKG_INCLUDE_PATH}/include/libpng16"
"${VCPKG_INCLUDE_PATH}/include/graphene-1.0"
"${VCPKG_INCLUDE_PATH}/include/glib-2.0"
"${VCPKG_INCLUDE_PATH}/lib/glib-2.0/include"
"${VCPKG_INCLUDE_PATH}/lib/graphene-1.0/include")
set(GTK4_LIBRARIES "gtk-4"
"cairo"
"pangocairo-1.0"
"pango-1.0"
"harfbuzz"
"gdk_pixbuf-2.0"
"cairo-gobject"
"graphene-1.0"
"gio-2.0"
"gobject-2.0"
"glib-2.0")
include_directories(${GTK4_INCLUDE_DIRS})
link_directories("${VCPKG_INCLUDE_PATH}/lib" "${VCPKG_INCLUDE_PATH}/bin")
find_package(FFMPEG REQUIRED)
include_directories(${FFMPEG_INCLUDE_DIRS})
else()
find_package(PkgConfig REQUIRED)
# GTK4
pkg_check_modules(GTK4 REQUIRED gtk4)
include_directories(${GTK4_INCLUDE_DIRS})
link_directories(${GTK4_LIBRARY_DIRS})
add_definitions(${GTK4_CFLAGS_OTHER})
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
include_directories(${FFMPEG_INCLUDE_DIRS})
link_directories(${FFMPEG_LIBRARY_DIRS})
endif ()
# include lib
add_subdirectory(src/lib)
if(UNIX AND NOT APPLE)
add_executable(${PROJECT_NAME} src/main.cpp src/Interface.cpp src/Interface.h)
target_link_libraries(${PROJECT_NAME} ${GTK4_LIBRARIES} PkgConfig::LIBAV lib)
elseif(WIN32)
add_executable(${PROJECT_NAME} src/main.cpp src/Interface.cpp src/Interface.h assets/appicon.rc)
target_link_libraries(${PROJECT_NAME} ${GTK4_LIBRARIES} ${FFMPEG_LIBRARIES} lib)
else()
add_executable(${PROJECT_NAME} src/main.cpp src/Interface.cpp src/Interface.h)
target_link_libraries(${PROJECT_NAME} PkgConfig::FFMPEG ${GTK4_LIBRARIES} lib)
endif()