add nanovg port (#4667)

This commit is contained in:
Oscar Morante 2018-11-08 20:53:06 +02:00 committed by Robert Schumacher
parent 7bb03fd2fc
commit 1d7fa4c74a
4 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.11)
project(nanovg C)
set(NANOVG_SOURCES src/nanovg.c)
set(NANOVG_HEADERS src/nanovg.h src/nanovg_gl.h src/nanovg_gl_utils.h)
add_library(nanovg STATIC ${NANOVG_SOURCES} ${NANOVG_HEADERS})
set_target_properties(nanovg PROPERTIES PUBLIC_HEADER "${NANOVG_HEADERS}")
target_include_directories(nanovg PRIVATE 3rdparty/nanovg/src)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(nanovg PRIVATE DEBUG)
else()
target_compile_definitions(nanovg PRIVATE NDEBUG)
endif()
install(TARGETS nanovg
EXPORT nanovgTargets
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include)
install(EXPORT nanovgTargets
FILE nanovgTargets.cmake
NAMESPACE nanovg::
DESTINATION share/nanovg)
include(CMakePackageConfigHelpers)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/nanovgConfig.cmake
DESTINATION share/nanovg)

3
ports/nanovg/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: nanovg
Version: master
Description: NanoVG is small antialiased vector graphics rendering library for OpenGL.

View File

@ -0,0 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/nanovgTargets.cmake)

View File

@ -0,0 +1,41 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO memononen/nanovg
REF f4069e6a1ad5da430fb0a9c57476d5ddc2ff89b2
SHA512 5f2313be939478d40e52c74e3935cbae91277be5c0e466a6d303e8d80e7bf0781288cb319b2e8cec5c7d6fc991be16bec6e0f5228153895ff7fe3abdffe5320e
HEAD_REF master
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/nanovgConfig.cmake DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/nanovg RENAME copyright)