-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
9 changed files
with
256 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
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,78 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(name svgren) | ||
|
||
project(${name}) | ||
|
||
find_package(utki CONFIG REQUIRED) | ||
find_package(papki CONFIG REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
find_package(PNG REQUIRED) | ||
find_package(JPEG REQUIRED) | ||
find_package(r4 CONFIG REQUIRED) | ||
find_package(rasterimage CONFIG REQUIRED) | ||
find_package(agg CONFIG REQUIRED) | ||
find_package(veg CONFIG REQUIRED) | ||
find_package(svgdom CONFIG REQUIRED) | ||
find_package(mikroxml CONFIG REQUIRED) | ||
find_package(cssom CONFIG REQUIRED) | ||
|
||
file(GLOB_RECURSE srcs "../src/${name}/*.cpp") | ||
|
||
add_library( | ||
${name} | ||
STATIC | ||
${srcs} | ||
) | ||
|
||
target_compile_features(${name} PUBLIC cxx_std_17) | ||
set_target_properties(${name} PROPERTIES CXX_STANDARD_REQUIRED ON) | ||
set_target_properties(${name} PROPERTIES CXX_EXTENSIONS OFF) | ||
|
||
target_include_directories( | ||
${name} | ||
INTERFACE | ||
$<BUILD_INTERFACE:> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
target_link_libraries( | ||
${name} | ||
PUBLIC | ||
utki::utki | ||
veg::veg | ||
svgdom::svgdom | ||
r4::r4 | ||
papki::papki | ||
) | ||
|
||
# install library header files preserving directory hierarchy | ||
install( | ||
DIRECTORY | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../src/${name}" | ||
DESTINATION | ||
"${CMAKE_INSTALL_INCLUDEDIR}" | ||
FILES_MATCHING PATTERN | ||
"*.hpp" | ||
) | ||
|
||
install( | ||
TARGETS | ||
${name} | ||
EXPORT # generate cmake configs | ||
${name}-config | ||
) | ||
|
||
# install cmake configs | ||
install( | ||
EXPORT | ||
${name}-config | ||
FILE | ||
${name}-config.cmake | ||
DESTINATION | ||
${CMAKE_INSTALL_DATAROOTDIR}/${name} | ||
NAMESPACE | ||
${name}:: | ||
) |
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,26 @@ | ||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO cppfw/${PORT} | ||
REF $(git_ref) | ||
SHA512 $(archive_hash) | ||
HEAD_REF main | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}/cmake" | ||
) | ||
|
||
vcpkg_cmake_install() | ||
|
||
vcpkg_cmake_config_fixup() | ||
|
||
# Delete the include directory from the debug installation to prevent overlap. | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
|
||
# Install the LICENSE file to the package's share directory and rename it to copyright. | ||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) | ||
|
||
# Copy the usage instruction file to the package's share directory. | ||
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY) |
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,23 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) | ||
|
||
project(test) | ||
|
||
find_package(utki CONFIG REQUIRED) | ||
find_package(papki CONFIG REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
find_package(PNG REQUIRED) | ||
find_package(JPEG REQUIRED) | ||
find_package(r4 CONFIG REQUIRED) | ||
find_package(rasterimage CONFIG REQUIRED) | ||
find_package(agg CONFIG REQUIRED) | ||
find_package(veg CONFIG REQUIRED) | ||
find_package(svgdom CONFIG REQUIRED) | ||
find_package(mikroxml CONFIG REQUIRED) | ||
find_package(cssom CONFIG REQUIRED) | ||
find_package(svgren CONFIG REQUIRED) | ||
|
||
add_executable(test main.cpp) | ||
|
||
target_link_libraries(test PRIVATE svgren::svgren) |
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,16 @@ | ||
#include <svgren/render.hpp> | ||
|
||
int main(int argc, const char** argv){ | ||
auto dom = svgdom::load(R"qwertyuiop( | ||
<svg xmlns="http://www.w3.org/2000/svg" width="57.126" height="57.126"> | ||
<path d="M28.563 0a28.563 28.563 0 100 57.126 28.563 28.563 0 100-57.126z" fill="#010101"/> | ||
<path d="M32.7 21.183c-.16-1.6-1.2-2.72-3.28-2.72-3.64 0-4.48 4.16-4.68 7.84l.08.08c.76-1.04 2.16-2.36 5.32-2.36 5.88 0 8.681 4.52 8.681 8.76 0 6.199-3.801 10.359-9.28 10.359-8.6 0-10.28-7.2-10.28-14.279 0-5.4.72-14.88 10.56-14.88 1.161 0 4.4.44 5.8 1.84 1.56 1.52 2.12 2.36 2.64 5.36h32.7zm-3.56 7.32c-2.12 0-4.28 1.32-4.28 4.88 0 3.08 1.76 5.28 4.44 5.28 2.04 0 3.92-1.561 3.92-5.4-.001-3.6-2.32-4.76-4.08-4.76z" fill="#fff"/> | ||
</svg> | ||
)qwertyuiop"sv); | ||
|
||
auto im = svgren::rasterize(*dom); | ||
|
||
std::cout << "im.dims() = " << im.dims() << std::endl; | ||
|
||
return 0; | ||
} |
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,19 @@ | ||
{ | ||
"default-registry": { | ||
"kind": "git", | ||
"baseline": "5e5d0e1cd7785623065e77eff011afdeec1a3574", | ||
"repository": "https://github.com/microsoft/vcpkg" | ||
}, | ||
"registries": [ | ||
{ | ||
"kind": "git", | ||
"repository": "https://github.com/cppfw/vcpkg-repo/", | ||
"baseline": "", | ||
"reference": "main", | ||
"packages": [ "utki", "papki", "mikroxml", "cssom", "svgdom", "r4", "rasterimage", "agg", "veg" ] | ||
} | ||
], | ||
"overlay-ports": [ | ||
"../overlay" | ||
] | ||
} |
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,5 @@ | ||
{ | ||
"dependencies": [ | ||
"svgren" | ||
] | ||
} |
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,17 @@ | ||
svgren provides CMake targets: | ||
|
||
find_package(utki CONFIG REQUIRED) | ||
find_package(papki CONFIG REQUIRED) | ||
find_package(ZLIB REQUIRED) | ||
find_package(PNG REQUIRED) | ||
find_package(JPEG REQUIRED) | ||
find_package(r4 CONFIG REQUIRED) | ||
find_package(rasterimage CONFIG REQUIRED) | ||
find_package(agg CONFIG REQUIRED) | ||
find_package(veg CONFIG REQUIRED) | ||
find_package(svgdom CONFIG REQUIRED) | ||
find_package(mikroxml CONFIG REQUIRED) | ||
find_package(cssom CONFIG REQUIRED) | ||
find_package(svgren CONFIG REQUIRED) | ||
|
||
target_link_libraries(main PRIVATE svgren::svgren) |
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,20 @@ | ||
{ | ||
"name": "svgren", | ||
"version": "$(version)", | ||
"homepage": "https://github.com/cppfw/svgren", | ||
"description": "SVG resterization library in C++", | ||
"license": "MIT", | ||
"dependencies": [ | ||
{ | ||
"name" : "vcpkg-cmake", | ||
"host" : true | ||
}, | ||
{ | ||
"name" : "vcpkg-cmake-config", | ||
"host" : true | ||
}, | ||
"utki", | ||
"svgdom", | ||
"veg" | ||
] | ||
} |