-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (97 loc) · 3.45 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
cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/external/cmake/")
project(Record)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -O2 -fpermissive")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
endif()
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DGLEW_STATIC)
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
find_package(OpenGL REQUIRED)
option(glew-cmake_BUILD_SHARED "Build the shared glew library" OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/external/glew-cmake)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
option(GLFW_INSTALL "Generate installation target" OFF)
add_subdirectory(${CMAKE_SOURCE_DIR}/external/glfw)
file(GLOB IMGUI_SRC
${CMAKE_SOURCE_DIR}/external/imgui/*.cpp
${CMAKE_SOURCE_DIR}/external/imgui/*.h
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_opengl3.h
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_opengl3.cpp
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_glfw.h
${CMAKE_SOURCE_DIR}/external/imgui/backends/imgui_impl_glfw.cpp
)
add_library(ImGui ${IMGUI_SRC})
target_include_directories(ImGui PRIVATE
${CMAKE_SOURCE_DIR}/external/glew-cmake/include
${CMAKE_SOURCE_DIR}/external/glfw/include
${CMAKE_SOURCE_DIR}/external/imgui
${CMAKE_SOURCE_DIR}/external/imgui/backends
)
find_package(Threads REQUIRED)
file(GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/src/*)
add_executable(recorder ${SRC_FILES})
set_target_properties(recorder
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/bin
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/bin
)
target_include_directories(recorder PRIVATE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/external/glew-cmake/include
${CMAKE_SOURCE_DIR}/external/glfw/include
${CMAKE_SOURCE_DIR}/external/imgui
${CMAKE_SOURCE_DIR}/external/imgui/backends
${CMAKE_SOURCE_DIR}/external/termcolor/include
)
target_link_libraries(recorder PRIVATE
libglew_static
glfw
ImGui
OpenGL::GL
Threads::Threads
)
if(WIN32)
target_include_directories(recorder PRIVATE
${CMAKE_SOURCE_DIR}/external/FFmpeg-Builds/windows/include
)
target_link_directories(recorder PRIVATE
${CMAKE_SOURCE_DIR}/external/FFmpeg-Builds/windows/lib
)
target_link_libraries(recorder PRIVATE
avcodec avdevice avfilter avformat avutil
swresample swscale
vpxmd zlibstatic
comdlg32 mfplat mfuuid strmiids
secur32 shlwapi vfw32 ws2_32 bcrypt
)
elseif(UNIX)
find_package(LibAV REQUIRED)
find_package(X11 REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(PulseAudio REQUIRED)
target_include_directories(recorder PRIVATE
${LIBAV_INCLUDE_DIRS}
${X11_INCLUDE_DIRS}
${PULSEAUDIO_INCLUDE_DIRS}
)
message(STATUS ${CMAKE_MODULE_PATH})
target_link_libraries(recorder PRIVATE
${LIBAV_LIBRARIES}
${X11_LIBRARIES}
${PULSEAUDIO_LIBRARIES}
)
else()
message(FATAL_ERROR "Unsupported platform for libav!")
endif()