forked from sorayuki/obs-multi-rtmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (62 loc) · 2.17 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
cmake_minimum_required(VERSION 3.16)
project(obs-multi-rtmp VERSION 0.2.3.1)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set (AUTOMOC ON)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set (QTDIR "" CACHE PATH "Directory of Qt 5, example D:/dev/qt5/5.10.1/msvc2017")
set (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR})
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(PLAT "32bit")
set(LINK_PLAT "x86")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PLAT "64bit")
set(LINK_PLAT "x64")
else ()
message(FATAL_ERROR "?")
endif ()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/obs-bin" CACHE PATH "" FORCE)
endif()
# build obs lib
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/pexports.exe"
"${CMAKE_CURRENT_SOURCE_DIR}/obs-bin/bin/${PLAT}/obs.dll"
OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/libobs.def"
COMMAND_ECHO STDOUT
)
execute_process(COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/pexports.exe"
"${CMAKE_CURRENT_SOURCE_DIR}/obs-bin/bin/${PLAT}/obs-frontend-api.dll"
OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/obs-frontend-api.def"
COMMAND_ECHO STDOUT
)
execute_process(COMMAND ${CMAKE_LINKER}
"/lib" "/MACHINE:${LINK_PLAT}"
"/def:${CMAKE_CURRENT_BINARY_DIR}/libobs.def"
"/out:${CMAKE_CURRENT_BINARY_DIR}/libobs.lib")
execute_process(COMMAND ${CMAKE_LINKER}
"/lib" "/MACHINE:${LINK_PLAT}"
"/def:${CMAKE_CURRENT_BINARY_DIR}/obs-frontend-api.def"
"/out:${CMAKE_CURRENT_BINARY_DIR}/obs-frontend-api.lib")
find_package(Qt5 COMPONENTS Widgets REQUIRED)
configure_file(src/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
add_library(obs-multi-rtmp SHARED
src/obs-multi-rtmp.cpp
src/obs-multi-rtmp.h
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)
target_include_directories(obs-multi-rtmp PRIVATE
obs-src/libobs
obs-src/UI/obs-frontend-api
)
target_link_directories(obs-multi-rtmp PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(obs-multi-rtmp PRIVATE
Qt5::Widgets
libobs
obs-frontend-api
)
install(TARGETS obs-multi-rtmp
DESTINATION obs-plugins/${PLAT}
)
install(DIRECTORY locale
DESTINATION data/obs-plugins/obs-multi-rtmp)