forked from reboot/obs-text-pango
-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
138 lines (125 loc) · 3.47 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
cmake_minimum_required(VERSION 3.2.0)
project(text-pango)
# Standalone build
if(NOT OBS_OUTPUT_DIR)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
include(ObsHelpers)
set(CMAKE_C_STANDARD 11)
set(STANDALONE_PLUGIN TRUE)
find_path(OBS_INCLUDE_DIRS
obs-module.h
HINTS $ENV{OBS_DIR} ${OBS_DIR}
PATH_SUFFIXES
libobs)
find_library(OBS_LIBRARIES
NAMES obs libobs
HINTS $ENV{OBS_DIR} ${OBS_DIR}
PATH_SUFFIXES
install/lib
install/bin/64bit
libobs)
# Build as submodule of obs-studio
else()
set(OBS_INCLUDE_DIRS
../../libobs)
set(OBS_LIBRARIES
libobs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/plugins/obs-text-pango/cmake/")
endif()
find_package(Pango REQUIRED)
find_package(Cairo REQUIRED)
find_package(Pangocairo REQUIRED)
find_package(Pangoft2 REQUIRED)
if(WIN32)
find_package(Pangowin32 REQUIRED)
endif()
find_package(Fontconfig REQUIRED)
find_package(Freetype REQUIRED)
include_directories(
${OBS_INCLUDE_DIRS}
${PANGO_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}
${PANGOCAIRO_INCLUDE_DIRS}
${PANGOFT2_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS})
if(NOT WIN32)
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(GLIB glib-2.0 REQUIRED)
include_directories(${GLIB_INCLUDE_DIRS})
endif()
link_directories(
${PANGO_LIBRARY_DIRS}
${CAIRO_LIBRARY_DIRS}
${FONTCONFIG_LIBRARY_DIRS}
${FREETYPE_LIBRARY_DIRS})
set(text-pango_SOURCES
text-pango.c
text-pango.h
text-utilities.h)
set(win32_static_LIBRARIES
intl
mini-fribidi
pixman-1_static
zlib
harfbuzz
libpng16_static
expat
usp10)
if(WIN32)
set(PLATFORM_LIBRARIES ${win32_static_LIBRARIES})
endif()
add_library(text-pango MODULE
${text-pango_SOURCES})
target_link_libraries(text-pango
${OBS_LIBRARIES}
${CAIRO_LIBRARIES}
${PANGO_LIBRARIES}
${PANGOWIN32_LIBRARIES}
${PANGOCAIRO_LIBRARIES}
${PANGOFT2_LIBRARIES}
${FREETYPE_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${PLATFORM_LIBRARIES}) # win only currently
target_compile_definitions(text-pango PRIVATE ${CAIRO_C_FLAGS})
if(STANDALONE_PLUGIN)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_bit_suffix "64bit/")
else()
set(_bit_suffix "32bit/")
endif()
if(APPLE)
install(TARGETS text-pango
LIBRARY DESTINATION "Library/Application Support/obs-studio/plugins/libtext-pango/bin/")
install(DIRECTORY data/common/
DESTINATION "Library/Application Support/obs-studio/plugins/libtext-pango/data")
install(DIRECTORY data/apple/
DESTINATION "Library/Application Support/obs-studio/plugins/libtext-pango/data")
# for packaging, copy all dependencies, change dependency links
# run pkgbuild --identifier user.obsproject.kurufu.text-pango --root ./obs-text-pango-install/ text-pango-mac.pkg
elseif(UNIX AND NOT APPLE)
install(TARGETS text-pango
LIBRARY DESTINATION "bin/")
install(DIRECTORY data/common/
DESTINATION data/)
else() # Not apple so normal layout
install(TARGETS text-pango
LIBRARY DESTINATION "obs-plugins/${_bit_suffix}/")
install(DIRECTORY data/common/
DESTINATION data/obs-plugins/text-pango)
# Platform specific data, like fontconfig in win32
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION "obs-plugins/${_bit_suffix}/" OPTIONAL)
install(DIRECTORY data/win32/
DESTINATION data/obs-plugins/text-pango)
endif()
else()
install_obs_plugin_with_data(text-pango data/common)
# calling this twice might not work?
if(WIN32)
install_obs_plugin_with_data(text-pango data/win32)
endif()
if(APPLE)
install_obs_plugin_with_data(text-pango data/apple)
endif()
endif()