[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 <roschuma@microsoft.com>
This commit is contained in:
Jack·Boos·Yu 2020-01-07 05:18:22 +08:00 committed by dan-shaw
parent ef3a7fb29c
commit 0c481e12f1
3 changed files with 14 additions and 9 deletions

View File

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

View File

@ -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

View File

@ -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()