From 4d2ffdfbcf9ed9239549d8620af59e0469e56a4d Mon Sep 17 00:00:00 2001 From: Nikolay Simakov Date: Thu, 10 Jan 2019 14:54:05 -0500 Subject: fixed building plplot with wxwidget feature on (#5089) * fixed builting plplot with wxwidget feature on * [plplot] Use vcpkg_extract_source_archive_ex --- ports/plplot/0001-findwxwidgets-fixes.patch | 59 +++++++++++++++++++++++++++++ ports/plplot/0002-wxwidgets-dev-fixes.patch | 12 ++++++ ports/plplot/CONTROL | 2 +- ports/plplot/portfile.cmake | 24 ++++++------ 4 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 ports/plplot/0001-findwxwidgets-fixes.patch create mode 100644 ports/plplot/0002-wxwidgets-dev-fixes.patch diff --git a/ports/plplot/0001-findwxwidgets-fixes.patch b/ports/plplot/0001-findwxwidgets-fixes.patch new file mode 100644 index 000000000..72b1d6c25 --- /dev/null +++ b/ports/plplot/0001-findwxwidgets-fixes.patch @@ -0,0 +1,59 @@ +diff --git a/cmake/modules/FindwxWidgets.cmake b/cmake/modules/FindwxWidgets.cmake +index 4d3a2d1..eaaa358 100644 +--- a/cmake/modules/FindwxWidgets.cmake ++++ b/cmake/modules/FindwxWidgets.cmake +@@ -515,7 +515,16 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + set(_WX_ARCH _x64) + endif() + endif() +- if(BUILD_SHARED_LIBS) ++ if(VCPKG_TARGET_TRIPLET) ++ find_library(wxWidgets_LIB_DIR ++ NAMES ++ wxmsw31ud_core.lib ++ wxmsw31u_core.lib ++ PATHS ++ DOC "Path to wxWidgets libraries" ++ ) ++ get_filename_component(wxWidgets_LIB_DIR ${wxWidgets_LIB_DIR} DIRECTORY) ++ elseif(BUILD_SHARED_LIBS) + find_path(wxWidgets_LIB_DIR + NAMES + msw/wx/setup.h +@@ -571,6 +580,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + set(wxWidgets_DEFINITIONS WXUSINGDLL) + DBG_MSG_V("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}") + endif() ++ if(VCPKG_TARGET_TRIPLET) ++ set(wxWidgets_DEFINITIONS WXUSINGDLL) ++ endif(VCPKG_TARGET_TRIPLET) + + # Search for available configuration types. + foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw) +@@ -582,6 +594,15 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + endif() + endforeach() + DBG_MSG_V("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}") ++ ++ if(VCPKG_TARGET_TRIPLET) ++ if(CMAKE_BUILD_TYPE STREQUAL "Debug") ++ set(WX_CONFIGURATION "mswud") ++ else() ++ set(WX_CONFIGURATION "mswu") ++ endif() ++ set(WX_${WX_CONFIGURATION}_FOUND TRUE) ++ endif(VCPKG_TARGET_TRIPLET) + + if(WX_CONFIGURATION) + set(wxWidgets_FOUND TRUE) +@@ -616,7 +637,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") + WX_GET_NAME_COMPONENTS(${wxWidgets_CONFIGURATION} UNV UCD DBG) + + # Set wxWidgets lib setup include directory. +- if(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) ++ if(VCPKG_TARGET_TRIPLET) ++ set(wxWidgets_INCLUDE_DIRS "${wxWidgets_ROOT_DIR}/include") ++ elseif(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) + set(wxWidgets_INCLUDE_DIRS + ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}) + else() diff --git a/ports/plplot/0002-wxwidgets-dev-fixes.patch b/ports/plplot/0002-wxwidgets-dev-fixes.patch new file mode 100644 index 000000000..707c64796 --- /dev/null +++ b/ports/plplot/0002-wxwidgets-dev-fixes.patch @@ -0,0 +1,12 @@ +diff --git a/drivers/wxwidgets_dev.cpp b/drivers/wxwidgets_dev.cpp +index f025bd8..f5881b1 100644 +--- a/drivers/wxwidgets_dev.cpp ++++ b/drivers/wxwidgets_dev.cpp +@@ -31,6 +31,7 @@ + + // Headers needed for Rand + #ifdef WIN32 ++#define _WINSOCKAPI_ + // This include must occur before any other include of stdlib.h due to + // the #define _CRT_RAND_S + #define _CRT_RAND_S diff --git a/ports/plplot/CONTROL b/ports/plplot/CONTROL index c278778b0..71bdb1a51 100644 --- a/ports/plplot/CONTROL +++ b/ports/plplot/CONTROL @@ -1,5 +1,5 @@ Source: plplot -Version: 5.13.0-1 +Version: 5.13.0-2 Build-Depends: freetype, zlib, libpng, bzip2 Description: PLplot is a cross-platform software package for creating scientific plots whose (UTF-8) plot symbols and text are limited in practice only by what Unicode-aware system fonts are installed on a user's computer. diff --git a/ports/plplot/portfile.cmake b/ports/plplot/portfile.cmake index 7b35f0a15..c98c8253b 100644 --- a/ports/plplot/portfile.cmake +++ b/ports/plplot/portfile.cmake @@ -2,26 +2,28 @@ include(vcpkg_common_functions) set(PLPLOT_VERSION 5.13.0) set(PLPLOT_HASH 1d5cb5da17d4bde6d675585bff1f8dcb581719249a0b2687867e767703f8dab0870e7ea44b9549a497f4ac0141a3cabf6761c49520c0e2b26ffe581468512cbb) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/plplot-${PLPLOT_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://sourceforge.net/projects/plplot/files/plplot/${PLPLOT_VERSION}%20Source/plplot-${PLPLOT_VERSION}.tar.gz/download" FILENAME "plplot-${PLPLOT_VERSION}.tar.gz" SHA512 ${PLPLOT_HASH} ) -vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + REF ${PLPLOT_VERSION} + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/0001-findwxwidgets-fixes.patch" + "${CMAKE_CURRENT_LIST_DIR}/0002-wxwidgets-dev-fixes.patch" + "${CMAKE_CURRENT_LIST_DIR}/install-interface-include-directories.patch" +) set(BUILD_with_wxwidgets OFF) if("wxwidgets" IN_LIST FEATURES) set(BUILD_with_wxwidgets ON) endif() -# Patch build scripts -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/install-interface-include-directories.patch" -) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -32,9 +34,7 @@ vcpkg_configure_cmake( -DPLPLOT_USE_QT5=OFF -DENABLE_ocaml=OFF -DPL_DOUBLE=ON - -DENABLE_wxwidgets=${ENABLE_wxwidgets} - -DPLD_wxpng=${ENABLE_wxwidgets} - -DPLD_wxwidgets=${ENABLE_wxwidgets} + -DPLD_wxwidgets=${BUILD_with_wxwidgets} -DENABLE_DYNDRIVERS=OFF -DDATA_DIR=${CURRENT_PACKAGES_DIR}/share/plplot OPTIONS_DEBUG @@ -51,6 +51,8 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/plplot) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/pltek.exe ${CURRENT_PACKAGES_DIR}/bin/pltek.exe + ${CURRENT_PACKAGES_DIR}/debug/bin/wxPLViewer.exe + ${CURRENT_PACKAGES_DIR}/bin/wxPLViewer.exe ) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") -- cgit v1.2.3