-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
CMakeLists.txt
484 lines (405 loc) · 15.7 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
SET(CMAKE_C_STANDARD 11)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_C_EXTENSIONS on)
OPTION (VKVG_BUILD_SHARED_LIB "Build using shared libraries" ON)
PROJECT(vkvg VERSION 0.3.0 DESCRIPTION "Vulkan Vector Graphic")
ADD_COMPILE_DEFINITIONS(
"VKVG_VERSION_MAJOR=${vkvg_VERSION_MAJOR}"
"VKVG_VERSION_MINOR=${vkvg_VERSION_MINOR}"
"VKVG_VERSION_REVISION=${vkvg_VERSION_PATCH}"
)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckIncludeFile)
INCLUDE(GNUInstallDirs)
INCLUDE(CMakeDependentOption)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()
IF (UNIX)
ADD_COMPILE_OPTIONS(-lm)
ENDIF()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS (-DDEBUG)
OPTION(ENABLE_VALIDATION "enable vulkan validation layer" ON)
OPTION(VKVG_USE_MESA_OVERLAY "enable VK_LAYER_MESA_overlay if present." OFF)
IF (VKVG_USE_MESA_OVERLAY)
ADD_DEFINITIONS (-DVKVG_USE_MESA_OVERLAY)
ENDIF ()
OPTION(ENABLE_DBG_UTILS "enable VK_EXT_debug_utils extension" ON)
OPTION(VKVG_WIRED_FILL "enable wired polygon draw to check vertices and primitives" OFF)
IF (UNIX)
ADD_COMPILE_OPTIONS(-Wall -Wno-extra -Wno-unknown-pragmas -Wno-missing-braces -Wno-unused-variable -Wno-switch -Wno-unused-value)
ELSEIF(MSVC)
ADD_COMPILE_OPTIONS(/TC /W4 /wd4201 /wd4204 /wd4221 /wd4100) # c11 compliant
ENDIF()
ELSE()
UNSET(ENABLE_VALIDATION CACHE)
UNSET(ENABLE_DBG_UTILS CACHE)
UNSET(VKVG_WIRED_FILL CACHE)
UNSET(VKVG_USE_MESA_OVERLAY CACHE)
IF (ANDROID)
ADD_COMPILE_OPTIONS(-O3 -w -ansi -pedantic)
ELSEIF (UNIX)
ADD_COMPILE_OPTIONS(-O3 -w -ansi -pedantic -fvisibility=hidden -fno-rtti)
#ADD_COMPILE_OPTIONS(-flto -pthread -lpthread -Wl,--no-as-needed)
ELSEIF(MSVC)
ADD_COMPILE_OPTIONS(/O2 /TC /W0 /Od)
ENDIF()
ENDIF()
OPTION(ENABLE_PROFILING "compile with the -pg options..." OFF)
IF (ENABLE_PROFILING)
ADD_COMPILE_OPTIONS(
-pg -fno-reorder-functions -fno-inline
-O1
-fthread-jumps
-falign-functions -falign-jumps
-falign-loops -falign-labels)
ENDIF()
OPTION(VKVG_RECORDING "enable experimental recording functions" ON)
OPTION(VKVG_PREMULT_ALPHA "use premultiplied alpha for internal rendering" ON)
IF (VKVG_PREMULT_ALPHA)
ADD_DEFINITIONS (-DVKVG_PREMULT_ALPHA)
SET(GLSLDEFS ${GLSLDEFS} -DVKVG_PREMULT_ALPHA)
ENDIF ()
OPTION(VKVG_DBG_STATS "record contexts statistics in the device" OFF)
IF (VKVG_DBG_STATS)
ADD_DEFINITIONS (-DVKVG_DBG_STATS)
ENDIF ()
OPTION(VKVG_USE_GLUTESS "Fill non-zero with glu tesselator" ON)
CMAKE_DEPENDENT_OPTION(VKVG_SVG "render svg with vkvg-svg library" ON "UNIX" OFF)
INCLUDE ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/GitSubmoduleUpdate.cmake")
IF(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
OPTION(GIT_SUBMODULE "Check submodules during build" OFF)
IF(GIT_SUBMODULE)
updateGitSubmodule(vkh)
IF (VKVG_USE_GLUTESS)
updateGitSubmodule(external/glutess)
ENDIF ()
IF (VKVG_SVG)
updateGitSubmodule(external/vkvg-svg)
ENDIF ()
endif()
ENDIF ()
IF (NOT TARGET vkh)
ADD_SUBDIRECTORY (vkh)
ENDIF()
#use c++ vulkan memory allocator library (https://gpuopen.com/vulkan-memory-allocator/)
IF (VKH_USE_VMA)
ADD_DEFINITIONS (-DVKH_USE_VMA)
ENDIF()
IF (ENABLE_VALIDATION)
ADD_DEFINITIONS (-DVKVG_USE_VALIDATION)
OPTION(ENABLE_RENDERDOC "enable renderdoc" OFF)
IF (ENABLE_RENDERDOC)
ADD_DEFINITIONS (-DVKVG_USE_RENDERDOC)
ENDIF ()
ENDIF ()
IF (VKVG_WIRED_FILL)
ADD_DEFINITIONS (-DVKVG_WIRED_DEBUG)
ENDIF ()
FIND_PACKAGE(Vulkan REQUIRED)
FIND_PACKAGE(Freetype QUIET)
FIND_PACKAGE(Fontconfig QUIET)
FIND_PACKAGE(HarfBuzz QUIET)
FIND_PACKAGE(glfw3 CONFIG QUIET)
if (glfw3_FOUND)
set(GLFW3_FOUND TRUE)
set(GLFW3_LIBRARY glfw)
else()
FIND_PACKAGE(GLFW3 QUIET)
endif()
FIND_PACKAGE(Doxygen QUIET)
CMAKE_DEPENDENT_OPTION(VKVG_USE_FREETYPE "use freetype to load and render font glyphs" ON "Freetype_FOUND" OFF)
CMAKE_DEPENDENT_OPTION(VKVG_USE_FONTCONFIG "use FontConfig to resolve font names" ON "Fontconfig_FOUND" OFF)
CMAKE_DEPENDENT_OPTION(VKVG_USE_HARFBUZZ "use Harbuzz for text layouting" ON "HarfBuzz_FOUND" OFF)
CMAKE_DEPENDENT_OPTION(VKVG_BUILD_TESTS "build tests with glfw" ON "GLFW3_FOUND" OFF)
CMAKE_DEPENDENT_OPTION(VKVG_BUILD_DOCS "build documentation" OFF "DOXYGEN_FOUND" OFF)
CMAKE_DEPENDENT_OPTION(VKVG_LCD_FONT_FILTER "enable freetype lcd font filtering" OFF "VKVG_USE_FONTCONFIG" OFF)
# todo if cmake vers >= 3.23: make dependent option on Vulkan_VERSION >= 1_2:
OPTION(VKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT "Enable scalar block layout support." ON)
IF (VKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
ADD_DEFINITIONS (-DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
SET(GLSLDEFS ${GLSLDEFS} -DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT)
ENDIF ()
OPTION(VKVG_ENABLE_VK_TIMELINE_SEMAPHORE "Enable vulkan TimelineSemaphore support." OFF)
IF (VKVG_ENABLE_VK_TIMELINE_SEMAPHORE)
ADD_DEFINITIONS (-DVKVG_ENABLE_VK_TIMELINE_SEMAPHORE)
ENDIF ()
IF (ENABLE_DBG_UTILS)
ADD_DEFINITIONS (-DVKVG_DBG_UTILS)
ENDIF ()
IF (VKVG_USE_FREETYPE)
ADD_DEFINITIONS (-DVKVG_USE_FREETYPE)
ENDIF ()
IF (VKVG_USE_FONTCONFIG)
ADD_DEFINITIONS (-DVKVG_USE_FONTCONFIG)
ENDIF ()
IF (VKVG_USE_HARFBUZZ)
ADD_DEFINITIONS (-DVKVG_USE_HARFBUZZ)
ENDIF ()
IF (VKVG_LCD_FONT_FILTER)
ADD_DEFINITIONS (-DVKVG_LCD_FONT_FILTER)
ENDIF ()
# Find glslc shader compiler.
# On Android, the NDK includes the binary, so no external dependency.
IF(ANDROID)
FILE(GLOB glslc-folders ${ANDROID_NDK}/shader-tools/*)
ELSE()
FILE(GLOB glslc-folders ${VULKAN_SDK}/bin)
ENDIF()
FIND_PROGRAM(GLSLC glslc HINTS ${glslc-folders})
FIND_PROGRAM(XXD xxd)
IF(GLSLC AND XXD)
SET(SHADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/src/shaders.h")
SET(SHADER_DIR "shaders")
SET(SHADER_FILES ${SHADER_DIR}/*.frag ${SHADER_DIR}/*.vert ${SHADER_DIR}/*.geom ${SHADER_DIR}/*.comp)
FILE(GLOB_RECURSE SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SHADER_FILES})
FOREACH(SHADER ${SHADERS})
SET(shader-input ${CMAKE_CURRENT_SOURCE_DIR}/${SHADER})
SET(shader-output ${CMAKE_CURRENT_BINARY_DIR}/${SHADER}.spv)
ADD_CUSTOM_COMMAND (
OUTPUT ${shader-output}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${SHADER_DIR}"
COMMAND ${GLSLC} ${GLSLDEFS} ${shader-input} -o ${shader-output}# --target-env=vulkan1.2
COMMENT "Compiling ${shader-input}"
DEPENDS ${SHADER}
VERBATIM
)
SET(SHADER_OUTPUTS ${SHADER_OUTPUTS} ${shader-output})
ENDFOREACH()
ADD_CUSTOM_TARGET(BuildShaders ALL DEPENDS ${SHADER_OUTPUTS})
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
ADD_CUSTOM_TARGET(ClearShadersHeader
COMMAND ${CMAKE_COMMAND} -E rm -f ${SHADERS_H}
)
else()
ADD_CUSTOM_TARGET(ClearShadersHeader
COMMAND ${CMAKE_COMMAND} -E remove -f ${SHADERS_H}
)
endif()
ADD_CUSTOM_TARGET(BuildShadersHeader
DEPENDS ClearShadersHeader ${SHADER_OUTPUTS}
)
FOREACH(shad_spv ${SHADER_OUTPUTS})
GET_FILENAME_COMPONENT(SPV ${shad_spv} NAME)
ADD_CUSTOM_COMMAND (
TARGET BuildShadersHeader
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${SHADER_DIR}
COMMAND ${XXD} -i ${SPV} >> ${SHADERS_H}
)
ENDFOREACH()
SET_SOURCE_FILES_PROPERTIES(${SHADERS_H} PROPERTIES GENERATED 1)
#add_definitions( -DDEBUG_VK_PERF=true )
ENDIF()
IF (VKVG_USE_GLUTESS)
ADD_DEFINITIONS (-DVKVG_FILL_NZ_GLUTESS)
ADD_SUBDIRECTORY (external/glutess)
ENDIF ()
FILE(GLOB VKVG_SRC src/*.c src/deps/*.c)
SET (VKVG_PUBLIC_HEADERS "include/vkvg.h;include/vkvg-svg.h")
IF (VKVG_SVG)
ADD_DEFINITIONS (-DVKVG_SVG)
FILE(GLOB SVG_SRC external/vkvg-svg/src/*.c)
ELSE()
FILE(GLOB SVG_SRC src/nsvg/*.c)
ENDIF()
LIST (APPEND VKVG_SRC ${SVG_SRC})
IF (VKVG_RECORDING)
ADD_DEFINITIONS (-DVKVG_RECORDING)
FILE(GLOB RECORDING_SRC src/recording/*.c)
LIST (APPEND VKVG_SRC ${RECORDING_SRC})
ENDIF()
CONFIGURE_FILE(vkvg.pc.in vkvg.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/vkvg.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
FUNCTION (setup_lib LibName)
LIST (APPEND VKVG_TARGETS ${LibName})
SET_TARGET_PROPERTIES(${LibName} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
VERSION ${vkvg_VERSION_MAJOR}.${vkvg_VERSION_MINOR}
SOVERSION ${vkvg_VERSION_MAJOR}
C_STANDARD 11
PUBLIC_HEADER "${VKVG_PUBLIC_HEADERS}"
)
TARGET_INCLUDE_DIRECTORIES("${LibName}"
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/vkh/src
$<$<BOOL:${VKVG_USE_FREETYPE}>:${FREETYPE_INCLUDE_DIRS}>
$<$<BOOL:${VKVG_USE_HARFBUZZ}>:${HarfBuzz_INCLUDE_DIRS}>
$<$<BOOL:${VKVG_USE_FONTCONFIG}>:${Fontconfig_INCLUDE_DIRS}>
$<$<NOT:$<BOOL:${VKVG_SVG}>>:${CMAKE_CURRENT_SOURCE_DIR}/src/nsvg>
PUBLIC
${Vulkan_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/vkh/include
)
get_target_property(libtype "${LibName}" TYPE)
IF (UNIX)# AND ($libtype STREQUAL "SHARED_LIBRARY"))
TARGET_LINK_LIBRARIES("${LibName}" PUBLIC m)
ENDIF()
IF(VKVG_USE_FREETYPE)
TARGET_LINK_LIBRARIES("${LibName}" PRIVATE ${FREETYPE_LIBRARIES})
ENDIF()
IF(VKVG_USE_FONTCONFIG)
TARGET_LINK_LIBRARIES("${LibName}" PRIVATE ${Fontconfig_LIBRARIES})
ENDIF()
IF(VKVG_USE_HARFBUZZ)
TARGET_LINK_LIBRARIES("${LibName}" PRIVATE ${HarfBuzz_LIBRARIES})
ENDIF()
IF(VKVG_USE_GLUTESS)
TARGET_LINK_LIBRARIES("${LibName}" PRIVATE glutess)
ENDIF()
TARGET_LINK_LIBRARIES("${LibName}"
PUBLIC
${Vulkan_LIBRARIES}
vkh
)
IF (SHADERS_H)
ADD_DEPENDENCIES("${LibName}" BuildShadersHeader)
ENDIF()
ENDFUNCTION(setup_lib)
GET_DIRECTORY_PROPERTY (vkvg_has_root_project PARENT_DIRECTORY)
# TARGET_INCLUDE_DIRECTORIES("${PROJECT_NAME}_obj"
# PRIVATE
# ${CMAKE_CURRENT_SOURCE_DIR}/src
# ${CMAKE_CURRENT_SOURCE_DIR}/vkh/src
# $<$<BOOL:${VKVG_USE_FREETYPE}>:${FREETYPE_INCLUDE_DIRS}>
# $<$<BOOL:${VKVG_USE_HARFBUZZ}>:${HarfBuzz_INCLUDE_DIRS}>
# $<$<BOOL:${VKVG_USE_FONTCONFIG}>:${Fontconfig_INCLUDE_DIRS}>
# $<$<NOT:$<BOOL:${VKVG_SVG}>>:${CMAKE_CURRENT_SOURCE_DIR}/src/nsvg>
# $<$<BOOL:${VKVG_USE_GLUTESS}>:${CMAKE_CURRENT_SOURCE_DIR}/external/glutess/include>
# PUBLIC
# ${Vulkan_INCLUDE_DIRS}
# ${CMAKE_CURRENT_SOURCE_DIR}/include
# ${CMAKE_CURRENT_SOURCE_DIR}/vkh/include
# )
LIST(APPEND ${VKVG_SRC} ${SHADERS} ${SHADERS_H})
IF (vkvg_has_root_project)
IF (VKVG_BUILD_SHARED_LIB)
ADD_LIBRARY("${PROJECT_NAME}" SHARED ${VKVG_SRC})
SET_PROPERTY(TARGET "${PROJECT_NAME}" PROPERTY POSITION_INDEPENDENT_CODE ON)
SET_PROPERTY(TARGET vkh PROPERTY POSITION_INDEPENDENT_CODE ON)
TARGET_COMPILE_DEFINITIONS("${PROJECT_NAME}" PUBLIC -DVKVG_SHARED_LINKING)
IF (TARGET glutess)
SET_PROPERTY(TARGET glutess PROPERTY POSITION_INDEPENDENT_CODE ON)
ENDIF()
setup_lib ("${PROJECT_NAME}")
ELSE()
ADD_LIBRARY("${PROJECT_NAME}" STATIC ${VKVG_SRC})
SET_PROPERTY(TARGET "${PROJECT_NAME}" PROPERTY POSITION_INDEPENDENT_CODE OFF)
SET_PROPERTY(TARGET vkh PROPERTY POSITION_INDEPENDENT_CODE OFF)
IF (TARGET glutess)
SET_PROPERTY(TARGET glutess PROPERTY POSITION_INDEPENDENT_CODE OFF)
ENDIF()
setup_lib ("${PROJECT_NAME}")
ENDIF()
ELSE()
SET_PROPERTY(TARGET vkh PROPERTY POSITION_INDEPENDENT_CODE ON)
IF (TARGET glutess)
SET_PROPERTY(TARGET glutess PROPERTY POSITION_INDEPENDENT_CODE ON)
ENDIF()
ADD_LIBRARY("${PROJECT_NAME}_shared" SHARED ${VKVG_SRC})
SET_PROPERTY(TARGET "${PROJECT_NAME}_shared" PROPERTY POSITION_INDEPENDENT_CODE ON)
TARGET_COMPILE_DEFINITIONS("${PROJECT_NAME}_shared" PUBLIC -DVKVG_SHARED_BUILD)
setup_lib ("${PROJECT_NAME}_shared")
ADD_LIBRARY("${PROJECT_NAME}_static" STATIC ${VKVG_SRC})
target_compile_definitions("${PROJECT_NAME}_static" PUBLIC -DVKVG_STATIC_BUILD)
SET_PROPERTY(TARGET "${PROJECT_NAME}_static" PROPERTY POSITION_INDEPENDENT_CODE OFF)
setup_lib ("${PROJECT_NAME}_static")
INSTALL(TARGETS "${PROJECT_NAME}_shared" "${PROJECT_NAME}_static"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
IF (VKVG_BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ELSEIF (VKVG_BUILD_OFFSCREEN_TEST)
ADD_EXECUTABLE(test_offscreen "${CMAKE_CURRENT_SOURCE_DIR}/tests/offscreen.c")
TARGET_INCLUDE_DIRECTORIES(test_offscreen PRIVATE
${Vulkan_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/include
)
TARGET_LINK_LIBRARIES(test_offscreen
${Vulkan_LIBRARIES}
)
IF (TARGET vkvg_static)
TARGET_LINK_LIBRARIES(${TEST_NAME} PUBLIC vkvg_static)
ELSEIF (TARGET vkvg_shared)
TARGET_LINK_LIBRARIES(${TEST_NAME} PUBLIC vkvg_shared)
ELSEIF (TARGET vkvg)
TARGET_LINK_LIBRARIES(${TEST_NAME} PUBLIC vkvg)
ENDIF()
ENDIF (VKVG_BUILD_TESTS)
IF (VKVG_BUILD_DOCS)
set(DOXYGEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doc)
set(DOXYGEN_INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(DOXYGEN_IMAGE_DIR "${DOXYGEN_DIR}/images")
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc)
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html)
set(DOXYFILE_IN ${DOXYGEN_DIR}/Doxygen.in)
set(DOXYFILE_OUT ${DOXYGEN_OUTPUT_DIR}/Doxyfile)
#configure_file(${DOXYGEN_DIR}/dox_layout.xml ${DOXYGEN_OUTPUT_DIR}/dox_layout.xml @ONLY)
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
add_custom_target(copy-doc-files ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${DOXYGEN_DIR}/doxy_theme" ${DOXYGEN_OUTPUT_DIR})
add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}
DEPENDS "${VKVG_PUBLIC_HEADERS}" copy-doc-files
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating docs")
add_custom_target(doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})
find_package(Sphinx)
IF (Sphinx_FOUND)
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/doc)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/doc/sphinx)
set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html)
add_custom_command(OUTPUT ${SPHINX_INDEX_FILE}
COMMAND
${SPHINX_EXECUTABLE} -b html
-Dbreathe_projects.VKVG=${DOXYGEN_OUTPUT_DIR}/xml
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
doxygen
# Other docs files you want to track should go here (or in some variable)
${SPHINX_SOURCE}/index.rst
${DOXYGEN_INDEX_FILE}
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
COMMENT "Generating documentation with Sphinx")
add_custom_target(sphinx ALL DEPENDS ${SPHINX_INDEX_FILE})
ENDIF ()
ENDIF (VKVG_BUILD_DOCS)
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
SET(CPACK_PACKAGE_DESCRIPTION "Vulkan vector graphic library")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "2d vector drawing library using vulkan")
SET(CPACK_PACKAGE_VENDOR "jp Bruyere")
SET(CPACK_PACKAGE_CONTACT "jp_bruyere@hotmail.com")
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
INCLUDE(InstallRequiredSystemLibraries)
#SET(CPACK_COMPONENTS_ALL Libraries ApplicationData)
#dependencies for this service menu
IF(UNIX)
SET(CPACK_PACKAGING_INSTALL_PREFIX "/tmp")
SET(CPACK_SET_DESTDIR "on")
SET(CPACK_ADD_LDCONFIG_CALL 1)
SET(CPACK_DEBIAN_PACKAGE_DEPENDS " libharfbuzz-gobject0 , libfontconfig1 , libfreetype6 ")
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_PACKAGE_SECTION "libraries")
SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
ELSEIF (MSVC)
SET(CPACK_GENERATOR NSIS)
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${PROJECT_NAME})
SET(CPACK_NSIS_MODIFY_PATH "ON")
ENDIF ()
INCLUDE(CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
ENDIF()