svgren icon indicating copy to clipboard operation
svgren copied to clipboard

CMake support

Open gdorion opened this issue 8 years ago • 3 comments

Hi,

Would you, by any chance, have a CMake script to build your library? Or planned to make one eventually?

Thanks!

gdorion avatar Jan 02 '18 20:01 gdorion

Hi! I don't use CMake and I'm not really familiar with it, so I can't create CMake scripts. But I accept patches ;)

igagis avatar Jan 02 '18 22:01 igagis

Hello @gdorion, I use CMake to compile svgren on my Mac, here are the contents of my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.6)
project(code)

include_directories(./
	./svgren/
        ./svgdom/
        ./svgdom/elements/
        ./utki/
        ./papki/
	/usr/local/Cellar/cairo/1.14.10/include
	/usr/local/Cellar/cairo/1.14.10/include/cairo)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -lcairo")

# Papki code
set(PAPKI_SOURCES
        papki/BufferFile.cpp
        papki/FSFile.cpp
        papki/File.cpp
        papki/MemoryFile.cpp)

# Mikroxml sources
set(MIKROXML_SOURCES
        mikroxml/mikroxml.cpp)
				
# Unikod source files
set(UNIKOD_SOURCES
        unikod/utf8.cpp)
				
# Svgren files
set(SVGREN_SOURCES
        svgren/render.cpp
	svgren/Renderer.cpp
	svgren/util.cpp
	svgren/FilterApplyer.cpp
	svgren/Surface.cpp
	svgren/CanvasRegion.cpp)

# Svgdom source files
set(SVGDOM_SOURCES
        svgdom/Length.cpp
        svgdom/Parser.cpp
        svgdom/StreamWriter.cpp
        svgdom/Visitor.cpp
        svgdom/dom.cpp
        svgdom/util.cpp
        svgdom/Finder.cpp
        svgdom/StyleStack.cpp
	svgdom/Cloner.cpp
        svgdom/elements/AspectRatioed.cpp
        svgdom/elements/ImageElement.cpp
        svgdom/elements/Element.cpp
        svgdom/elements/Gradients.cpp
        svgdom/elements/Rectangle.cpp
        svgdom/elements/Referencing.cpp
        svgdom/elements/Shapes.cpp
        svgdom/elements/Structurals.cpp
        svgdom/elements/Styleable.cpp
        svgdom/elements/Transformable.cpp
        svgdom/elements/ViewBoxed.cpp
        svgdom/elements/Filter.cpp)

# My main source file
set(MAIN_SOURCES
        main.cpp)

add_executable(code
        ${PAPKI_SOURCES}
        ${MIKROXML_SOURCES}
	${UNIKOD_SOURCES}
	${SVGREN_SOURCES}
        ${SVGDOM_SOURCES}
        ${MAIN_SOURCES})

As you can see, the only real dependency is cairo, all the other dependencies (utki, papki, mikroxml, unikod, and of course svgdom) are found on @igagis github repositories. I use this file only for debugging/testing, and have something more complicated for production, but you can easily adapt this to your requirements.

JaimeIvanCervantes avatar Jan 02 '18 22:01 JaimeIvanCervantes

Just FYI, svgren is now available as conan package for linux and macos, this might be easier to use along with CMake.

igagis avatar May 19 '21 10:05 igagis