Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake support #43

Open
gdorion opened this issue Jan 2, 2018 · 3 comments
Open

CMake support #43

gdorion opened this issue Jan 2, 2018 · 3 comments
Labels

Comments

@gdorion
Copy link

gdorion commented Jan 2, 2018

Hi,

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

Thanks!

@igagis
Copy link
Member

igagis commented Jan 2, 2018

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 ;)

@JaimeIvanCervantes
Copy link
Contributor

JaimeIvanCervantes commented Jan 2, 2018

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.

@igagis
Copy link
Member

igagis commented May 19, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants