-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
532 lines (477 loc) · 18.3 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
#
# Copyright (C) 2021 magicxqq <xqq@xqq.im>. All rights reserved.
#
# This file is part of libaribcaption.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
cmake_minimum_required(VERSION 3.11)
project(libaribcaption
VERSION
1.1.1
DESCRIPTION
"Portable ARIB STD-B24 Caption Decoder/Renderer"
HOMEPAGE_URL
"https://github.com/xqq/libaribcaption"
LANGUAGES
C CXX
)
# main project detecting
# avoid building test subdirectory if used as subproject (e.g. add_subdirectory)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(ARIBCC_IS_MAIN_PROJECT TRUE)
endif()
# Release build by default
if(NOT CMAKE_BUILD_TYPE)
message("Build type will be Release. Set CMAKE_BUILD_TYPE to indicate other types.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default to Release build" FORCE)
endif()
# Indicate -DARIBCC_BUILD_TESTS:BOOL=ON to build tests
option(ARIBCC_BUILD_TESTS "Build libaribcaption tests" OFF)
# Indicate -DARIBCC_SHARED_LIBRARY:BOOL=ON to build as shared library
option(ARIBCC_SHARED_LIBRARY "Build libaribcaption as shared library" OFF)
# Indicate -DARIBCC_NO_EXCEPTIONS:BOOL=ON to disable C++ exceptions
option(ARIBCC_NO_EXCEPTIONS "Disable C++ Exceptions" OFF)
# Indicate -DARIBCC_NO_RTTI:BOOL=ON to disable C++ RTTI
option(ARIBCC_NO_RTTI "Disable C++ RTTI" OFF)
# Indicate -DARIBCC_NO_RENDERER:BOOL=ON to disable renderer
option(ARIBCC_NO_RENDERER "Disable Renderer" OFF)
if(ARIBCC_NO_RENDERER)
# Renderer is disabled
message(STATUS "Renderer has been disabled by ARIBCC_NO_RENDERER")
elseif(WIN32)
# Windows, use DirectWrite by default
option(ARIBCC_USE_DIRECTWRITE "Enable DirectWrite text rendering backend" ON)
option(ARIBCC_USE_GDI_FONT "Enable Win32 GDI font provider" OFF)
elseif(APPLE)
# macOS or iOS, use CoreText by default
option(ARIBCC_USE_CORETEXT "Enable CoreText text rendering backend" ON)
elseif(ANDROID OR (${CMAKE_SYSTEM_NAME} STREQUAL "Android") OR ARIBCC_IS_ANDROID)
# Android, FreeType required
set(ARIBCC_IS_ANDROID TRUE CACHE BOOL "Specify target OS is Android")
option(ARIBCC_USE_FREETYPE "Enable FreeType text rendering backend" ON)
else()
# Linux or other Unix systems, requires Fontconfig & FreeType
option(ARIBCC_USE_FONTCONFIG "Enable Fontconfig font provider" ON)
option(ARIBCC_USE_FREETYPE "Enable FreeType text rendering backend" ON)
endif()
option(ARIBCC_USE_EMBEDDED_FREETYPE "Use embedded FreeType instead of find_package from system" OFF)
if(ARIBCC_USE_CORETEXT)
find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
find_library(COREGRAPHICS_FRAMEWORK CoreGraphics)
find_library(CORETEXT_FRAMEWORK CoreText)
endif()
if(ARIBCC_USE_FONTCONFIG)
find_package(Fontconfig REQUIRED)
endif()
function(import_embedded_freetype)
include(FetchContent)
FetchContent_Declare(freetype
GIT_REPOSITORY https://github.com/freetype/freetype.git
GIT_TAG VER-2-11-1
GIT_SHALLOW TRUE # Get only target tag version
GIT_PROGRESS TRUE # Show download progress
USES_TERMINAL_DOWNLOAD TRUE # show download progress in ninja
USES_TERMINAL_CONFIGURE TRUE # show configure progress in ninja
USES_TERMINAL_BUILD TRUE # show build progress in ninja
)
FetchContent_GetProperties(freetype)
if(NOT freetype_POPULATED)
# Fetch the content
FetchContent_Populate(freetype)
# Set variables for FreeType
set(FT_DISABLE_ZLIB ON CACHE BOOL "Disable zlib for embedded Freetype" FORCE)
set(FT_DISABLE_BZIP2 ON CACHE BOOL "Disable bzip2 for embedded Freetype" FORCE)
set(FT_DISABLE_PNG ON CACHE BOOL "Disable libpng for embedded Freetype" FORCE)
set(FT_DISABLE_HARFBUZZ ON CACHE BOOL "Disable harfbuzz for embedded Freetype" FORCE)
set(FT_DISABLE_BROTLI ON CACHE BOOL "Disable brotli for embedded Freetype" FORCE)
set(BUILD_SHARED_LIBS OFF) # Force static link
# Suppress CMake Policy CMP0048 warning
set(CMAKE_PROJECT_INCLUDE_BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/EnableCMP0048.cmake")
# Import FreeType directory
add_subdirectory(${freetype_SOURCE_DIR} ${freetype_BINARY_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
set(FREETYPE_INCLUDE_DIRS "${freetype_BINARY_DIR}/include;${freetype_SOURCE_DIR}/include" PARENT_SCOPE)
set(FREETYPE_LIBRARIES freetype PARENT_SCOPE)
endif()
endfunction()
if(ARIBCC_USE_FREETYPE AND (NOT ARIBCC_USE_EMBEDDED_FREETYPE))
# Try Use system-wide installed freetype
find_package(Freetype)
if(NOT FREETYPE_FOUND)
# System-wide freetype not found, use FetchContent to import embedded freetype
message(STATUS "System-wide installed FreeType not found, fallback to use embedded FreeType")
set(ARIBCC_USE_EMBEDDED_FREETYPE ON CACHE BOOL "Force embedded FreeType" FORCE)
else()
message(STATUS "Use system-wide installed FreeType library from find_package")
endif()
endif()
if(ARIBCC_USE_EMBEDDED_FREETYPE)
set(ARIBCC_USE_FREETYPE ON CACHE BOOL "Enable Freetype by ARIBCC_USE_EMBEDDED_FREETYPE" FORCE)
message(STATUS "Use static-linked embedded FreeType library")
import_embedded_freetype()
endif()
if(ARIBCC_SHARED_LIBRARY AND (NOT BUILD_SHARED_LIBS))
set(BUILD_SHARED_LIBS ON)
endif()
if(BUILD_SHARED_LIBS AND (NOT ARIBCC_SHARED_LIBRARY))
set(ARIBCC_SHARED_LIBRARY ON CACHE BOOL "Indicate built as shared library" FORCE)
endif()
# Generate config header
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/aribcc_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/aribcc_config.h"
)
### Source files
add_library(aribcaption
include/aribcaption/aligned_alloc.hpp
include/aribcaption/aribcaption.h
include/aribcaption/aribcaption.hpp
include/aribcaption/aribcc_export.h
include/aribcaption/caption.h
include/aribcaption/caption.hpp
include/aribcaption/color.h
include/aribcaption/color.hpp
include/aribcaption/context.h
include/aribcaption/context.hpp
include/aribcaption/decoder.h
include/aribcaption/decoder.hpp
src/base/aligned_alloc.cpp
src/base/always_inline.hpp
src/base/cfstr_helper.hpp
src/base/floating_helper.hpp
src/base/language_code.hpp
src/base/logger.cpp
src/base/logger.hpp
src/base/md5.c
src/base/md5.h
src/base/md5_helper.hpp
src/base/result.hpp
src/base/scoped_cfref.hpp
src/base/scoped_com_initializer.hpp
src/base/scoped_holder.hpp
src/base/unicode_helper.hpp
src/base/utf_helper.hpp
src/base/wchar_helper.hpp
src/common/caption_capi.cpp
src/common/context.cpp
src/common/context_capi.cpp
src/decoder/b24_codesets.cpp
src/decoder/b24_codesets.hpp
src/decoder/b24_colors.cpp
src/decoder/b24_colors.hpp
src/decoder/b24_controlsets.hpp
src/decoder/b24_conv_tables.hpp
src/decoder/b24_drcs_conv.cpp
src/decoder/b24_drcs_conv.hpp
src/decoder/b24_gaiji_table.hpp
src/decoder/b24_macros.hpp
src/decoder/decoder.cpp
src/decoder/decoder_capi.cpp
src/decoder/decoder_impl.cpp
src/decoder/decoder_impl.hpp
)
# Append renderer-related sources if renderer not disabled
if(NOT ARIBCC_NO_RENDERER)
target_sources(aribcaption PRIVATE
include/aribcaption/image.h
include/aribcaption/image.hpp
include/aribcaption/renderer.h
include/aribcaption/renderer.hpp
$<$<BOOL:${ARIBCC_IS_ANDROID}>:src/base/tinyxml2.cpp>
$<$<BOOL:${ARIBCC_IS_ANDROID}>:src/base/tinyxml2.h>
src/renderer/alphablend.hpp
src/renderer/alphablend_generic.hpp
src/renderer/alphablend_x86.hpp
src/renderer/bitmap.cpp
src/renderer/bitmap.hpp
src/renderer/canvas.cpp
src/renderer/canvas.hpp
src/renderer/drcs_renderer.cpp
src/renderer/drcs_renderer.hpp
src/renderer/font_provider.cpp
src/renderer/font_provider.hpp
$<$<BOOL:${ARIBCC_IS_ANDROID}>:src/renderer/font_provider_android.cpp>
$<$<BOOL:${ARIBCC_IS_ANDROID}>:src/renderer/font_provider_android.hpp>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:src/renderer/font_provider_coretext.cpp>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:src/renderer/font_provider_coretext.hpp>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:src/renderer/font_provider_directwrite.cpp>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:src/renderer/font_provider_directwrite.hpp>
$<$<BOOL:${ARIBCC_USE_FONTCONFIG}>:src/renderer/font_provider_fontconfig.cpp>
$<$<BOOL:${ARIBCC_USE_FONTCONFIG}>:src/renderer/font_provider_fontconfig.hpp>
$<$<BOOL:${ARIBCC_USE_GDI_FONT}>:src/renderer/font_provider_gdi.cpp>
$<$<BOOL:${ARIBCC_USE_GDI_FONT}>:src/renderer/font_provider_gdi.hpp>
src/renderer/image_capi.cpp
src/renderer/rect.hpp
src/renderer/region_renderer.cpp
src/renderer/region_renderer.hpp
src/renderer/renderer.cpp
src/renderer/renderer_capi.cpp
src/renderer/renderer_impl.cpp
src/renderer/renderer_impl.hpp
src/renderer/text_renderer.cpp
src/renderer/text_renderer.hpp
$<$<BOOL:${ARIBCC_USE_FREETYPE}>:src/renderer/open_type_gsub.cpp>
$<$<BOOL:${ARIBCC_USE_FREETYPE}>:src/renderer/open_type_gsub.hpp>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:src/renderer/text_renderer_coretext.cpp>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:src/renderer/text_renderer_coretext.hpp>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:src/renderer/text_renderer_directwrite.cpp>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:src/renderer/text_renderer_directwrite.hpp>
$<$<BOOL:${ARIBCC_USE_FREETYPE}>:src/renderer/text_renderer_freetype.cpp>
$<$<BOOL:${ARIBCC_USE_FREETYPE}>:src/renderer/text_renderer_freetype.hpp>
)
endif()
add_library(aribcaption::aribcaption ALIAS aribcaption)
target_compile_features(aribcaption
PRIVATE
cxx_std_17
)
# Indicate `-fvisibility=hidden` to hide non-export symbols
set_target_properties(aribcaption
PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
)
# Enable /utf-8 for MSVC
target_compile_options(aribcaption
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
)
# Disable C++ exceptions, if required
if(ARIBCC_NO_EXCEPTIONS)
if(MSVC)
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
target_compile_options(aribcaption
PRIVATE
/EHs-c-
)
target_compile_definitions(aribcaption
PRIVATE
_HAS_EXCEPTIONS=0
)
else()
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
target_compile_options(aribcaption
PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
)
endif()
endif()
# Disable C++ RTTI, if required
if(ARIBCC_NO_RTTI)
if(MSVC)
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
target_compile_options(aribcaption
PUBLIC
/GR-
)
else()
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
target_compile_options(aribcaption
PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
)
endif()
endif()
# Enable necessary SSE instruction sets for x86/x64 build on gcc/clang
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)" AND CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|X86|x64|X64|amd64|AMD64|i386|i686)")
target_compile_options(aribcaption
PRIVATE
-msse
-msse2
)
endif()
# Disable aligned allocation on Apple platforms, which is only supported on macOS 10.14 / iOS 11 or newer
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(aribcaption
PRIVATE
-fno-aligned-allocation
)
endif()
target_compile_definitions(aribcaption
PRIVATE
ARIBCC_IMPLEMENTATION
$<$<BOOL:${WIN32}>:
NOMINMAX
UNICODE
_UNICODE
_CRT_SECURE_NO_WARNINGS
>
)
### Includes
target_include_directories(aribcaption
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
$<$<BOOL:${ARIBCC_USE_FONTCONFIG}>:${Fontconfig_INCLUDE_DIRS}>
$<$<BOOL:${ARIBCC_USE_FREETYPE}>:${FREETYPE_INCLUDE_DIRS}>
)
### Linking
target_link_libraries(aribcaption
PRIVATE
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:${COREFOUNDATION_FRAMEWORK}>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:${COREGRAPHICS_FRAMEWORK}>
$<$<BOOL:${ARIBCC_USE_CORETEXT}>:${CORETEXT_FRAMEWORK}>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:ole32>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:d2d1>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:dwrite>
$<$<BOOL:${ARIBCC_USE_DIRECTWRITE}>:windowscodecs>
$<$<BOOL:${ARIBCC_USE_GDI_FONT}>:gdi32>
)
# vcpkg uses optimized/debug keyword in XXXXX_LIBRARIES variables
# which is incompatible with generator expressions
if(ARIBCC_USE_FONTCONFIG)
target_link_libraries(aribcaption
PRIVATE
${Fontconfig_LIBRARIES}
)
endif()
if(ARIBCC_USE_FREETYPE)
target_link_libraries(aribcaption
PRIVATE
${FREETYPE_LIBRARIES}
)
endif()
### Installing
include(GNUInstallDirs)
# Install generated config header
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/include/aribcc_config.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/aribcaption
)
# Install decoder-related public headers
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/aribcc_export.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/aribcaption.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/aribcaption.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/caption.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/caption.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/color.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/color.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/context.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/context.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/decoder.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/decoder.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/aribcaption
)
# Install renderer-related public headers, if not disabled
if(NOT ARIBCC_NO_RENDERER)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/aligned_alloc.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/image.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/image.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/renderer.h
${CMAKE_CURRENT_SOURCE_DIR}/include/aribcaption/renderer.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/aribcaption
)
endif()
# Install
install(
TARGETS aribcaption
EXPORT aribcaption-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION Library/Frameworks
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Export targets to cmake script
install(
EXPORT
aribcaption-targets
FILE
aribcaption-targets.cmake
NAMESPACE
aribcaption::
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/aribcaption
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/aribcaption-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/aribcaption-config.cmake
INSTALL_DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/aribcaption
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/aribcaption-config-version.cmake
VERSION
${PROJECT_VERSION}
COMPATIBILITY
SameMajorVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/aribcaption-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/aribcaption-config-version.cmake
DESTINATION
${CMAKE_INSTALL_LIBDIR}/cmake/aribcaption
)
## Generate pkg-config config file (.pc)
include(cmake/GeneratePkgConfig.cmake)
generate_pkg_config_pc_file(aribcaption
TEMPLATE
${CMAKE_CURRENT_SOURCE_DIR}/libaribcaption.pc.in
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/libaribcaption.pc
)
## Install pkg-config config file (.pc)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libaribcaption.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
### Testing (if enabled)
if(ARIBCC_IS_MAIN_PROJECT AND ARIBCC_BUILD_TESTS)
add_subdirectory(test EXCLUDE_FROM_ALL)
endif()
### Packaging
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "magicxqq")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
if(WIN32)
set(CPACK_GENERATOR ZIP)
set(CPACK_SOURCE_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
set(CPACK_SOURCE_GENERATOR TGZ)
endif()
set(CPACK_SOURCE_IGNORE_FILES
/.idea
/.vs
/.vscode
/.git
/.*build.*
/out
/screenshots
/\\\\.DS_Store
CMakeSettings.json
compile_commands.json
)
include(CPack)