From 0c481e12f150ef8dd57f3fd8fae4b19a52f46d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Tue, 7 Jan 2020 05:18:22 +0800 Subject: [PATCH] [nanovg] Add dependency port stb (#8813) * [nanovg]Add depends port stb. Do not install stb headers. * [nanovg] Remove stb files from source to ensure the vcpkg-packaged copies are preferred. * [nanovg]Disable build with uwp. Co-authored-by: Robert Schumacher --- ports/nanovg/CMakeLists.txt | 7 ++++--- ports/nanovg/CONTROL | 3 ++- ports/nanovg/portfile.cmake | 13 ++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ports/nanovg/CMakeLists.txt b/ports/nanovg/CMakeLists.txt index 16d7afa4bb..8caf73238e 100644 --- a/ports/nanovg/CMakeLists.txt +++ b/ports/nanovg/CMakeLists.txt @@ -1,11 +1,13 @@ cmake_minimum_required(VERSION 3.11) project(nanovg C) +find_path(STB_INCLUDES stb_image.h include) + set(NANOVG_SOURCES src/nanovg.c) -set(NANOVG_HEADERS src/nanovg.h src/nanovg_gl.h src/nanovg_gl_utils.h src/stb_image.h) +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) +target_include_directories(nanovg PRIVATE ${STB_INCLUDES}) if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_definitions(nanovg PRIVATE DEBUG) @@ -25,7 +27,6 @@ install(EXPORT nanovgTargets NAMESPACE nanovg:: DESTINATION share/nanovg) -include(CMakePackageConfigHelpers) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nanovgConfig.cmake DESTINATION share/nanovg) diff --git a/ports/nanovg/CONTROL b/ports/nanovg/CONTROL index 5291576ac3..57bd00f726 100644 --- a/ports/nanovg/CONTROL +++ b/ports/nanovg/CONTROL @@ -1,4 +1,5 @@ Source: nanovg -Version: 2019-8-30-1 +Version: 2019-8-30-3 Homepage: https://github.com/memononen/nanovg Description: NanoVG is small antialiased vector graphics rendering library for OpenGL. +Build-Depends: stb \ No newline at end of file diff --git a/ports/nanovg/portfile.cmake b/ports/nanovg/portfile.cmake index 9a2cbc7ac4..6a838808bb 100644 --- a/ports/nanovg/portfile.cmake +++ b/ports/nanovg/portfile.cmake @@ -1,4 +1,5 @@ -include(vcpkg_common_functions) +vcpkg_fail_port_install(ON_TARGET "UWP") + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO memononen/nanovg @@ -10,12 +11,14 @@ vcpkg_from_github( file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/nanovgConfig.cmake DESTINATION ${SOURCE_PATH}) +file(GLOB STB_SRCS ${SOURCE_PATH}/src/stb_*) +if(STB_SRCS) + file(REMOVE_RECURSE ${STB_SRCS}) +endif() + 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 + PREFER_NINJA ) vcpkg_install_cmake()