Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
65 lines (59 loc) · 2.06 KB
/
Copy pathCMakeLists.txt
File metadata and controls
65 lines (59 loc) · 2.06 KB
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
cmake_minimum_required(VERSION 3.22...3.25)
project(flood-tuber VERSION 1.1.0)
# 1. Plugin Definition
add_library(flood-tuber MODULE)
set_target_properties_obs(flood-tuber PROPERTIES FOLDER plugins PREFIX "")
# Version passed to C++ code via compile define (single source of truth)
target_compile_definitions(flood-tuber PRIVATE
FLOOD_TUBER_VERSION="${PROJECT_VERSION}"
)
# 2. Dependencies (libwebp)
include(FetchContent)
FetchContent_Declare(
libwebp
GIT_REPOSITORY https://github.com/webmproject/libwebp.git
GIT_TAG v1.3.2
)
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_DWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_GIF2WEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_IMG2WEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_VWEBP OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_WEBPINFO OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_WEBPMUX OFF CACHE BOOL "" FORCE)
set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(libwebp)
# 3. Source Files
target_sources(flood-tuber PRIVATE
flood-tuber.cpp
flood-tuber.h
flood-tuber-props.cpp
flood-tuber-props.h
webp-decoder.cpp
webp-decoder.h
lodepng.cpp
lodepng.h
apng-decoder.cpp
apng-decoder.h
)
# 4. Libraries (Link OBS::libobs)
target_link_libraries(flood-tuber PRIVATE
OBS::libobs
webp
webpdemux
)
# 5. Data directory copy
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/data")
file(GLOB_RECURSE data_files "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
foreach(data_file ${data_files})
file(RELATIVE_PATH dest_file "${CMAKE_CURRENT_SOURCE_DIR}/data" "${data_file}")
get_filename_component(dest_dir "${dest_file}" DIRECTORY)
add_custom_command(
TARGET flood-tuber POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_BINARY_DIR}/data/obs-plugins/flood-tuber/${dest_dir}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${data_file}" "${CMAKE_BINARY_DIR}/data/obs-plugins/flood-tuber/${dest_file}"
VERBATIM
)
endforeach()
endif()