mirror of https://github.com/microsoft/vcpkg.git
[plplot] Fix cross builds, fix exported config, add test port (#44234)
This commit is contained in:
parent
119902863a
commit
374b6c6cbb
|
|
@ -0,0 +1,29 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e29c43d..7063e4c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -308,7 +308,8 @@ endif(USE_DLL_SUBDIRECTORY)
|
||||
# Prior to processing directories must initialize exports of installed targets.
|
||||
|
||||
# Install CMake package config file which handles all those exports.
|
||||
-install(FILES plplotConfig.cmake DESTINATION ${LIB_DIR}/cmake/plplot)
|
||||
+configure_file("${PROJECT_SOURCE_DIR}/plplotConfig.cmake" "${PROJECT_BINARY_DIR}/plplotConfig.cmake" @ONLY)
|
||||
+install(FILES "${PROJECT_BINARY_DIR}/plplotConfig.cmake" DESTINATION ${LIB_DIR}/cmake/plplot)
|
||||
|
||||
# Initialize the plplot_exports.cmake file which is appended to by CMake logic
|
||||
# to install and export targets that is indirectly executed by the add_subdirectory commands below.
|
||||
diff --git a/plplotConfig.cmake b/plplotConfig.cmake
|
||||
index 677faec..fe6d2ca 100644
|
||||
--- a/plplotConfig.cmake
|
||||
+++ b/plplotConfig.cmake
|
||||
@@ -1,3 +1,10 @@
|
||||
+if(NOT "@BUILD_SHARED_LIBS@")
|
||||
+ include(CMakeFindDependencyMacro)
|
||||
+ if("@ENABLE_wxwidgets@")
|
||||
+ find_dependency(wxWidgets)
|
||||
+ endif()
|
||||
+endif()
|
||||
+
|
||||
if(ANY_QT_DEVICE AND PLPLOT_USE_QT5)
|
||||
# Find Qt5 components that we need to link applications against
|
||||
# the plplot library (if ENABLE_DYNDRIVERS is false) and which we
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
if(NOT TARGET @name@)
|
||||
add_executable(@name@ IMPORTED)
|
||||
set_target_properties(@name@ PROPERTIES
|
||||
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/@name@@VCPKG_TARGET_EXECUTABLE_SUFFIX@"
|
||||
)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
diff --git a/cmake/modules/pkg-config.cmake b/cmake/modules/pkg-config.cmake
|
||||
index a0ca6b2..32e8566 100644
|
||||
--- a/cmake/modules/pkg-config.cmake
|
||||
+++ b/cmake/modules/pkg-config.cmake
|
||||
@@ -194,10 +194,14 @@ function(pkg_config_link_flags link_flags_out link_flags_in)
|
||||
# Linux, Mac OS X, and MinGW/MSYS but it may need some
|
||||
# generalization on other platforms such as Cygwin.
|
||||
|
||||
+ set(prefix_literal "lib")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(suffix_pattern "(\\.so.*|\\.a)")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(suffix_pattern "(\\.so.*|\\.a|\\.dylib)")
|
||||
+ elseif(MSVC)
|
||||
+ set(prefix_literal "")
|
||||
+ set(suffix_pattern "(\\.[Ll][Ii][Bb])")
|
||||
elseif(WIN32_OR_CYGWIN)
|
||||
# Order is important here.
|
||||
set(suffix_pattern "(\\.dll\\.a|\\.a)")
|
||||
@@ -210,12 +214,35 @@ function(pkg_config_link_flags link_flags_out link_flags_in)
|
||||
set(_link_flags)
|
||||
foreach(link_flag IN LISTS link_flags)
|
||||
#message(STATUS "link_flag = ${link_flag}")
|
||||
+ if(TARGET "${link_flag}")
|
||||
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" config)
|
||||
+ foreach(key IN ITEMS IMPORTED_IMPLIB_${config} IMPORTED_LOCATION_${config} IMPORTED_IMPLIB IMPORTED_LOCATION)
|
||||
+ get_target_property(lib "${link_flag}" "${key}")
|
||||
+ if(lib)
|
||||
+ set(link_flag "${lib}")
|
||||
+ break()
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+ # sorry, no transitive deps for now.
|
||||
+ endif()
|
||||
if(WIN32_OR_CYGWIN)
|
||||
# Look for colon-delimited drive-letter form on these platforms.
|
||||
- string(REGEX REPLACE "^([a-zA-Z]:/.*)/lib(.*)${suffix_pattern}$" "-L\"\\1\" -l\\2" link_flag "${link_flag}")
|
||||
endif(WIN32_OR_CYGWIN)
|
||||
# Look for form starting with "/" on all platforms.
|
||||
- string(REGEX REPLACE "^(/.*)/lib(.*)${suffix_pattern}$" "-L\"\\1\" -l\\2" link_flag "${link_flag}")
|
||||
+ if(link_flag MATCHES "^([a-zA-Z]:/.*|/.*)/${prefix_literal}(.+)${suffix_pattern}$")
|
||||
+ if(CMAKE_MATCH_2 IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
|
||||
+ continue()
|
||||
+ endif()
|
||||
+ set(link_flag "-l${CMAKE_MATCH_2}")
|
||||
+ if(NOT CMAKE_MATCH_1 IN_LIST CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
|
||||
+ set(lib_dir_flag "-L\"${CMAKE_MATCH_1}\"")
|
||||
+ if(NOT lib_dir_flag IN_LIST _link_flags)
|
||||
+ list(APPEND _link_flags "${lib_dir_flag}")
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ elseif(NOT link_flag MATCHES "^-|/") # e.g. 'm'
|
||||
+ set(link_flag "-l${link_flag}")
|
||||
+ endif()
|
||||
#message(STATUS "(-L form of link_flag = ${link_flag}")
|
||||
list(APPEND _link_flags ${link_flag})
|
||||
endforeach(link_flag IN LISTS link_flags)
|
||||
@@ -290,6 +317,7 @@ macro(cmake_link_flags _link_flags_out _link_flags_in)
|
||||
#message("_link_directory_list = ${_link_directory_list}")
|
||||
#message("_link_flags_list (without -L options) = ${_link_flags_list}")
|
||||
|
||||
+ string(REPLACE "-framework;" "-framework " _link_flags_list "${_link_flags_list}")
|
||||
# Derive ${_link_flags_out} from _link_flags_list with -l options
|
||||
# replaced by complete pathname of library.
|
||||
list(LENGTH _link_flags_list _link_flags_length)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/pkgcfg/plplot-template.pc.in b/pkgcfg/plplot-template.pc.in
|
||||
index 7c1310e..4656c03 100644
|
||||
--- a/pkgcfg/plplot-template.pc.in
|
||||
+++ b/pkgcfg/plplot-template.pc.in
|
||||
@@ -1,6 +1,7 @@
|
||||
-libdir=@LIB_DIR@
|
||||
+prefix=${pcfiledir}/../..
|
||||
+libdir=${prefix}/@LIB_DIR@
|
||||
includedir=@INCLUDE_DIR@
|
||||
-drvdir=@LIB_DIR@/plplot@PLPLOT_VERSION@/drivers
|
||||
+drvdir=${prefix}/@LIB_DIR@/plplot@PLPLOT_VERSION@/drivers
|
||||
|
||||
Name: PLplot @PC_SHORT_NAME@
|
||||
Description: Scientific plotting library (@PC_PRECISION@@PC_LONG_NAME@)
|
||||
|
|
@ -5,10 +5,13 @@ vcpkg_from_sourceforge(
|
|||
FILENAME "plplot-${VERSION}.tar.gz"
|
||||
SHA512 54533245569b724a7ef90392cc6e9ae65873e6cbab923df0f841c8b43def5e4307690894c7681802209bd3c8df97f54285310a706428f79b3340cce3207087c8
|
||||
PATCHES
|
||||
subdirs.patch
|
||||
install-interface-include-directories.patch
|
||||
use-math-h-nan.patch
|
||||
cmake-config.diff
|
||||
fix-pc-absolute.patch
|
||||
install-interface-include-directories.patch
|
||||
pkg_config_link_flags.diff
|
||||
pkgconfig-template.diff
|
||||
subdirs.patch
|
||||
use-math-h-nan.patch
|
||||
)
|
||||
|
||||
vcpkg_check_features(
|
||||
|
|
@ -22,6 +25,14 @@ vcpkg_check_features(
|
|||
x11 CMAKE_DISABLE_FIND_PACKAGE_X11
|
||||
)
|
||||
|
||||
if(VCPKG_CROSSCOMPILING)
|
||||
list(APPEND FEATURE_OPTIONS "-DCMAKE_NATIVE_BINARY_DIR=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}")
|
||||
# Necessary to skip a try_run which isn't used anyways due to PL_HAVE_QHULL=OFF
|
||||
list(APPEND FEATURE_OPTIONS "-DNaNAwareCCompiler=ON")
|
||||
endif()
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
|
|
@ -37,6 +48,8 @@ vcpkg_cmake_configure(
|
|||
-DPLD_aqt=OFF # needs aquaterm framework
|
||||
-DPLD_pdf=OFF # needs haru
|
||||
-DPLD_psttf=OFF # needs lasi (in addition to pango)
|
||||
-DPLD_psttfc=OFF # needs lasi (in addition to pango)
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
${FEATURE_OPTIONS}
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_SWIG=ON
|
||||
|
|
@ -56,8 +69,8 @@ vcpkg_fixup_pkgconfig()
|
|||
|
||||
if("wxwidgets" IN_LIST FEATURES)
|
||||
file(GLOB pkg_files "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/*.pc")
|
||||
foreach(pkg_file IN ITEMS ${pkg_files})
|
||||
vcpkg_replace_string("${pkg_file}" "${prefix}/lib/mswu" "${prefix}/lib/mswud" IGNORE_UNCHANGED)
|
||||
foreach(pkg_file IN LISTS pkg_files)
|
||||
vcpkg_replace_string("${pkg_file}" [[${prefix}/lib/mswu]] [[${prefix}/lib/mswud]] IGNORE_UNCHANGED)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
|
@ -66,6 +79,24 @@ file(REMOVE_RECURSE
|
|||
"${CURRENT_PACKAGES_DIR}/debug/share"
|
||||
)
|
||||
|
||||
if(NOT VCPKG_CROSSCOMPILING)
|
||||
function(copy_tool name subdir cmake_name)
|
||||
vcpkg_copy_tools(
|
||||
TOOL_NAMES "${name}"
|
||||
SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${subdir}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/${subdir}"
|
||||
)
|
||||
configure_file(
|
||||
"${CURRENT_PORT_DIR}/host-tool.cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/${subdir}/${cmake_name}"
|
||||
@ONLY
|
||||
)
|
||||
endfunction()
|
||||
copy_tool(plhershey-unicode-gen "include" "ImportExecutables.cmake")
|
||||
copy_tool(tai-utc-gen "lib/qsastime" "tai-utc-gen.cmake")
|
||||
copy_tool(deltaT-gen "lib/qsastime" "deltaT-gen.cmake")
|
||||
endif()
|
||||
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(
|
||||
FILE_LIST
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
plplot provides CMake targets:
|
||||
|
||||
find_package(plplot CONFIG REQUIRED)
|
||||
# C API, PLplot Core Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplot)
|
||||
# C++ binding
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplotcxx)
|
||||
# wxWidgets GUI binding (optional, feature "wxwidgets")
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplotwxwidgets)
|
||||
# CSIRO Cubic Spline Approximation Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::csirocsa)
|
||||
# QSAS Time Format Conversion Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::qsastime)
|
||||
find_package(plplot CONFIG REQUIRED)
|
||||
# C API, PLplot Core Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplot)
|
||||
# C++ binding
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplotcxx)
|
||||
# wxWidgets GUI binding (optional, feature "wxwidgets")
|
||||
target_link_libraries(main PRIVATE PLPLOT::plplotwxwidgets)
|
||||
# CSIRO Cubic Spline Approximation Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::csirocsa)
|
||||
# QSAS Time Format Conversion Library
|
||||
target_link_libraries(main PRIVATE PLPLOT::qsastime)
|
||||
|
||||
plplot provides pkg-config modules:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "plplot",
|
||||
"version-semver": "5.15.0",
|
||||
"port-version": 4,
|
||||
"port-version": 5,
|
||||
"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.",
|
||||
"homepage": "https://plplot.sourceforge.net/",
|
||||
"license": null,
|
||||
|
|
@ -11,6 +11,10 @@
|
|||
"default-features": false
|
||||
},
|
||||
"pango",
|
||||
{
|
||||
"name": "plplot",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
|
|
|
|||
|
|
@ -817,11 +817,6 @@ platform-folders:x64-uwp=fail
|
|||
plib:arm-neon-android=fail
|
||||
plib:arm64-android=fail
|
||||
plib:x64-android=fail
|
||||
plplot:arm-neon-android=fail
|
||||
plplot:arm64-android=fail
|
||||
plplot:arm64-windows-static-md=fail
|
||||
plplot:arm64-windows=fail
|
||||
plplot:x64-android=fail
|
||||
pmdk:x64-android=fail
|
||||
pmdk:x64-osx=fail
|
||||
pmdk:x64-windows-static=fail
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS
|
||||
${options}
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
)
|
||||
vcpkg_cmake_build()
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
cmake_minimum_required(VERSION 3.30)
|
||||
project(plplot-test C CXX)
|
||||
|
||||
find_package(plplot CONFIG REQUIRED)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE
|
||||
PLPLOT::plplot
|
||||
)
|
||||
target_compile_definitions(main PRIVATE USING_CMAKE)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(plplot_pc plplot REQUIRED IMPORTED_TARGET)
|
||||
|
||||
add_executable(main-pkconfig main.c)
|
||||
target_link_libraries(main-pkconfig PRIVATE
|
||||
PkgConfig::plplot_pc
|
||||
)
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
#ifdef USING_CMAKE
|
||||
#include <plplot/plplot.h>
|
||||
#else
|
||||
#include <plplot.h>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
PLFLT x[5], y[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
x[i] = 0.25 * (PLFLT)(i);
|
||||
y[i] = 2.0 * x[i];
|
||||
}
|
||||
|
||||
plinit();
|
||||
plenv(0.0, 1.0, 0.0, 2.0, 0, 0);
|
||||
pllab("x", "y", "2D line plot");
|
||||
plline(5, x, y);
|
||||
plend();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "vcpkg-ci-plplot",
|
||||
"version-string": "ci",
|
||||
"description": "Port to force features of plplot within CI",
|
||||
"homepage": "https://github.com/microsoft/vcpkg",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "plplot",
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"all"
|
||||
],
|
||||
"features": {
|
||||
"all": {
|
||||
"description": "Test all features",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "plplot",
|
||||
"features": [
|
||||
"wxwidgets"
|
||||
],
|
||||
"platform": "!android"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7198,7 +7198,7 @@
|
|||
},
|
||||
"plplot": {
|
||||
"baseline": "5.15.0",
|
||||
"port-version": 4
|
||||
"port-version": 5
|
||||
},
|
||||
"plustache": {
|
||||
"baseline": "0.4.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "658102e460a970de4035cbd46f6cc22901023a18",
|
||||
"version-semver": "5.15.0",
|
||||
"port-version": 5
|
||||
},
|
||||
{
|
||||
"git-tree": "e876a75a0e8e457fe3a268002e1cae2390982a6d",
|
||||
"version-semver": "5.15.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue