diff --git a/.gitmodules b/.gitmodules index ad5c136e..db27b12a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,3 +11,9 @@ [submodule "extlib/libdxfrw"] path = extlib/libdxfrw url = https://github.com/solvespace/libdxfrw.git +[submodule "extlib/pixman"] + path = extlib/pixman + url = https://github.com/solvespace/pixman +[submodule "extlib/cairo"] + path = extlib/cairo + url = https://github.com/solvespace/cairo diff --git a/.travis/install-debian.sh b/.travis/install-debian.sh index be6f9bab..1804276e 100755 --- a/.travis/install-debian.sh +++ b/.travis/install-debian.sh @@ -4,5 +4,5 @@ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update -qq sudo apt-get install -q -y \ cmake cmake-data libpng12-dev zlib1g-dev libjson0-dev libfontconfig1-dev \ - libgtkmm-2.4-dev libpangomm-1.4-dev libgl1-mesa-dev libglu-dev \ + libgtkmm-2.4-dev libpangomm-1.4-dev libcairo2-dev libgl1-mesa-dev libglu-dev \ libfreetype6-dev dpkg-dev gcc-5 g++-5 diff --git a/.travis/install-macos.sh b/.travis/install-macos.sh index 6fb5a4f7..43225b2f 100755 --- a/.travis/install-macos.sh +++ b/.travis/install-macos.sh @@ -2,3 +2,4 @@ brew update brew upgrade cmake libpng +brew install freetype cairo diff --git a/CMakeLists.txt b/CMakeLists.txt index 211cdda0..58ba9c8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ add_subdirectory(extlib/libdxfrw) if(WIN32) include(FindVendoredPackage) + include(AddVendoredSubdirectory) find_vendored_package(Freetype freetype WITH_ZLIB OFF @@ -92,6 +93,20 @@ if(WIN32) PNG_PNG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extlib/libpng) list(APPEND PNG_PNG_INCLUDE_DIR ${CMAKE_BINARY_DIR}/extlib/libpng) + message(STATUS "Using in-tree pixman") + add_vendored_subdirectory(extlib/pixman) + set(PIXMAN_FOUND YES) + set(PIXMAN_LIBRARY pixman) + set(PIXMAN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/pixman/pixman) + list(APPEND PIXMAN_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/extlib/pixman/pixman) + + message(STATUS "Using in-tree cairo") + add_vendored_subdirectory(extlib/cairo) + set(CAIRO_FOUND YES) + set(CAIRO_LIBRARY cairo) + set(CAIRO_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extlib/cairo/src) + list(APPEND CAIRO_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/extlib/cairo/src) + if(NOT MINGW) message(STATUS "Using prebuilt SpaceWare") set(SPACEWARE_FOUND TRUE) @@ -108,6 +123,8 @@ elseif(APPLE) find_package(Freetype REQUIRED) find_library(APPKIT_LIBRARY AppKit REQUIRED) + find_library(CAIRO_LIBRARY cairo REQUIRED) + find_path(CAIRO_INCLUDE_DIRS cairo.h PATH_SUFFIXES cairo) else() # Linux and compatible systems find_package(Backtrace) find_package(SpaceWare) diff --git a/cmake/AddVendoredSubdirectory.cmake b/cmake/AddVendoredSubdirectory.cmake new file mode 100644 index 00000000..9d2edf61 --- /dev/null +++ b/cmake/AddVendoredSubdirectory.cmake @@ -0,0 +1,10 @@ +# Equivalent to add_subdirectory(... EXCLUDE_FROM_ALL), but also disables +# all warnings. + +include(DisableWarnings) + +function(add_vendored_subdirectory PATH) + disable_warnings() + + add_subdirectory(${PATH} EXCLUDE_FROM_ALL) +endfunction() diff --git a/debian/control b/debian/control index 4e03aaed..3afd85d6 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: graphics Priority: optional Maintainer: whitequark Build-Depends: debhelper (>= 9), cmake, libpng-dev, zlib1g-dev, libjson-c-dev, - libfontconfig1-dev, libgtkmm-2.4-dev, libpangomm-1.4-dev, + libfontconfig1-dev, libgtkmm-2.4-dev, libpangomm-1.4-dev, libcairo2-dev, libgl-dev, libglu-dev Standards-Version: 3.9.5 Homepage: http://solvespace.com diff --git a/extlib/cairo b/extlib/cairo new file mode 160000 index 00000000..d4724ee9 --- /dev/null +++ b/extlib/cairo @@ -0,0 +1 @@ +Subproject commit d4724ee921c4fa399ccbd0019c3d6917452e0ffd diff --git a/extlib/pixman b/extlib/pixman new file mode 160000 index 00000000..54eee478 --- /dev/null +++ b/extlib/pixman @@ -0,0 +1 @@ +Subproject commit 54eee47843a147336c594b3213993b439fdf67ed diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72c5f620..8807360c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,7 +62,8 @@ include_directories( ${OPENGL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${PNG_PNG_INCLUDE_DIR} - ${FREETYPE_INCLUDE_DIRS}) + ${FREETYPE_INCLUDE_DIRS} + ${CAIRO_INCLUDE_DIRS}) if(SPACEWARE_FOUND) include_directories( @@ -186,6 +187,7 @@ target_link_libraries(solvespace ${ZLIB_LIBRARY} ${PNG_LIBRARY} ${FREETYPE_LIBRARY} + ${CAIRO_LIBRARY} ${platform_LIBRARIES}) if(WIN32 AND NOT MINGW)