-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "plutovg"] | ||
path = plutovg | ||
url = https://github.com/sammycage/plutovg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
set(LUNASVG_VERSION_MAJOR 3) | ||
set(LUNASVG_VERSION_MINOR 0) | ||
set(LUNASVG_VERSION_MICRO 0) | ||
|
||
project(lunasvg LANGUAGES CXX VERSION ${LUNASVG_VERSION_MAJOR}.${LUNASVG_VERSION_MINOR}.${LUNASVG_VERSION_MICRO}) | ||
|
||
set(lunasvg_sources | ||
source/lunasvg.cpp | ||
source/graphics.cpp | ||
source/svgelement.cpp | ||
source/svggeometryelement.cpp | ||
source/svglayoutstate.cpp | ||
source/svgpaintelement.cpp | ||
source/svgparser.cpp | ||
source/svgproperty.cpp | ||
source/svgrenderstate.cpp | ||
source/svgtextelement.cpp | ||
) | ||
|
||
set(lunasvg_headers | ||
include/lunasvg.h | ||
source/graphics.h | ||
source/svgelement.h | ||
source/svggeometryelement.h | ||
source/svglayoutstate.h | ||
source/svgpaintelement.h | ||
source/svgparserutils.h | ||
source/svgproperty.h | ||
source/svgrenderstate.h | ||
source/svgtextelement.h | ||
) | ||
|
||
find_package(plutovg 0.0.1 QUIET) | ||
if(NOT plutovg_FOUND) | ||
add_subdirectory(plutovg) | ||
endif() | ||
|
||
add_library(lunasvg ${lunasvg_sources} ${lunasvg_headers}) | ||
add_library(lunasvg::lunasvg ALIAS lunasvg) | ||
|
||
set_target_properties(lunasvg PROPERTIES | ||
SOVERSION ${LUNASVG_VERSION_MAJOR} | ||
CXX_VISIBILITY_PRESET hidden | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_STANDARD 17 | ||
) | ||
|
||
target_include_directories(lunasvg PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
${CMAKE_CURRENT_SOURCE_DIR}/source | ||
) | ||
|
||
target_include_directories(lunasvg PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include/lunasvg> | ||
) | ||
|
||
target_link_libraries(lunasvg PRIVATE plutovg::plutovg) | ||
target_compile_definitions(lunasvg PRIVATE LUNASVG_BUILD) | ||
if(NOT BUILD_SHARED_LIBS) | ||
target_compile_definitions(lunasvg PUBLIC LUNASVG_BUILD_STATIC) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/lunasvg.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lunasvg) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lunasvgConfig.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/lunasvgConfig.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lunasvg | ||
) | ||
|
||
write_basic_package_version_file(lunasvgConfigVersion.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
install(TARGETS lunasvg | ||
EXPORT lunasvgTargets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
|
||
install(EXPORT lunasvgTargets | ||
FILE lunasvgTargets.cmake | ||
NAMESPACE lunasvg:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lunasvg | ||
) | ||
|
||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/lunasvgConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/lunasvgConfigVersion.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lunasvg | ||
) | ||
|
||
export(EXPORT lunasvgTargets | ||
FILE ${CMAKE_CURRENT_BINARY_DIR}/lunasvgTargets.cmake | ||
NAMESPACE lunasvg:: | ||
) | ||
|
||
option(LUNASVG_BUILD_EXAMPLES "Build examples" ON) | ||
if(LUNASVG_BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/lunasvgTargets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_executable(svg2png svg2png.cpp) | ||
target_link_libraries(svg2png lunasvg) |