mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 22:11:37 +08:00
[plibsys] Fix failures on linux and osx (#11633)
* [plibsys] Fix failures on linux and osx * Update patch for fix build failure with x64-windows-static * Add vcpkg_cmake_wrapper and usage
This commit is contained in:
parent
1509b14bb3
commit
a051803607
@ -1,4 +1,5 @@
|
||||
Source: plibsys
|
||||
Version: 0.0.4-2
|
||||
Version: 0.0.4-3
|
||||
Homepage: https://github.com/saprykin/plibsys
|
||||
Description: Highly portable C system library: threads and synchronization, sockets, IPC, data structures and more.
|
||||
Supports: !uwp
|
||||
|
142
ports/plibsys/fix_configuration.patch
Normal file
142
ports/plibsys/fix_configuration.patch
Normal file
@ -0,0 +1,142 @@
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 343e3d2..aff7929 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -785,18 +785,18 @@ if (PLIBSYS_PLATFORM_DEFINES)
|
||||
endif()
|
||||
|
||||
# Add targets
|
||||
-add_library (plibsys SHARED ${PLIBSYS_SRCS} ${PLIBSYS_PLATFORM_SRCS} ${PLIBSYS_PUBLIC_HDRS} ${PLIBSYS_PRIVATE_HDRS})
|
||||
-
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
add_library (plibsysstatic STATIC ${PLIBSYS_SRCS} ${PLIBSYS_PLATFORM_SRCS} ${PLIBSYS_PUBLIC_HDRS} ${PLIBSYS_PRIVATE_HDRS})
|
||||
+else()
|
||||
+ add_library (plibsys SHARED ${PLIBSYS_SRCS} ${PLIBSYS_PLATFORM_SRCS} ${PLIBSYS_PUBLIC_HDRS} ${PLIBSYS_PRIVATE_HDRS})
|
||||
endif()
|
||||
|
||||
# Add include directories
|
||||
if (COMMAND target_include_directories)
|
||||
- target_include_directories (plibsys PUBLIC ${PLIBSYS_INCLUDE_DIRS})
|
||||
-
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
target_include_directories (plibsysstatic PUBLIC ${PLIBSYS_INCLUDE_DIRS})
|
||||
+ else()
|
||||
+ target_include_directories (plibsys PUBLIC ${PLIBSYS_INCLUDE_DIRS})
|
||||
endif()
|
||||
else()
|
||||
include_directories (${PLIBSYS_INCLUDE_DIRS})
|
||||
@@ -804,15 +804,16 @@ endif()
|
||||
|
||||
# Add compile definitions
|
||||
if (COMMAND target_compile_definitions)
|
||||
- target_compile_definitions (plibsys PRIVATE ${PLIBSYS_COMPILE_DEFS})
|
||||
-
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
target_compile_definitions (plibsysstatic PRIVATE ${PLIBSYS_COMPILE_DEFS})
|
||||
+ else()
|
||||
+ target_compile_definitions (plibsys PRIVATE ${PLIBSYS_COMPILE_DEFS})
|
||||
endif()
|
||||
else()
|
||||
add_definitions (${PLIBSYS_COMPILE_DEFS})
|
||||
endif()
|
||||
|
||||
+if(NOT PLIBSYS_BUILD_STATIC)
|
||||
set_target_properties (plibsys PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set_target_properties (plibsys PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set_target_properties (plibsys PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
@@ -820,6 +821,7 @@ set_target_properties (plibsys PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR}
|
||||
if (NOT PLIBSYS_TARGET_OS STREQUAL os2 AND NOT PLIBSYS_TARGET_OS STREQUAL amigaos)
|
||||
set_target_properties (plibsys PROPERTIES SOVERSION ${PLIBSYS_SOVERSION})
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
set_target_properties (plibsysstatic PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
@@ -834,10 +836,10 @@ if (PLIBSYS_PLATFORM_CFLAGS)
|
||||
set (PLIBSYS_PLATFORM_CFLAGS_STR "${PLIBSYS_PLATFORM_CFLAGS_STR} ${PLATFORM_CFLAG}")
|
||||
endforeach()
|
||||
|
||||
- set_target_properties (plibsys PROPERTIES COMPILE_FLAGS "${PLIBSYS_PLATFORM_CFLAGS_STR}")
|
||||
-
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
set_target_properties (plibsysstatic PROPERTIES COMPILE_FLAGS "${PLIBSYS_PLATFORM_CFLAGS_STR}")
|
||||
+ else()
|
||||
+ set_target_properties (plibsys PROPERTIES COMPILE_FLAGS "${PLIBSYS_PLATFORM_CFLAGS_STR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -846,29 +848,30 @@ if (PLIBSYS_PLATFORM_LDFLAGS)
|
||||
set (PLIBSYS_PLATFORM_LDFLAGS_STR "${PLIBSYS_PLATFORM_LDFLAGS_STR} ${PLATFORM_LDFLAG}")
|
||||
endforeach()
|
||||
|
||||
- set_target_properties (plibsys PROPERTIES LINK_FLAGS "${PLIBSYS_PLATFORM_LDFLAGS_STR}")
|
||||
-
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
set_target_properties (plibsysstatic PROPERTIES LINK_FLAGS "${PLIBSYS_PLATFORM_LDFLAGS_STR}")
|
||||
+ else()
|
||||
+ set_target_properties (plibsys PROPERTIES LINK_FLAGS "${PLIBSYS_PLATFORM_LDFLAGS_STR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
-target_link_libraries (plibsys ${PLIBSYS_PLATFORM_LINK_LIBRARIES})
|
||||
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
- target_link_libraries (plibsysstatic ${PLIBSYS_PLATFORM_LINK_LIBRARIES})
|
||||
+ target_link_libraries (plibsysstatic ${PLIBSYS_PLATFORM_LINK_LIBRARIES})
|
||||
+else()
|
||||
+ target_link_libraries (plibsys ${PLIBSYS_PLATFORM_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (PLIBSYS_BUILD_STATIC)
|
||||
- set (PLIBSYS_INSTALL_TARGETS plibsys plibsysstatic)
|
||||
+ set (PLIBSYS_INSTALL_TARGETS plibsysstatic)
|
||||
else()
|
||||
set (PLIBSYS_INSTALL_TARGETS plibsys)
|
||||
endif()
|
||||
|
||||
if (PLIBSYS_NATIVE_WINDOWS)
|
||||
install (TARGETS ${PLIBSYS_INSTALL_TARGETS}
|
||||
- DESTINATION lib
|
||||
- RUNTIME DESTINATION lib
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ RUNTIME DESTINATION bin
|
||||
COMPONENT Core
|
||||
)
|
||||
|
||||
@@ -878,11 +881,6 @@ if (PLIBSYS_NATIVE_WINDOWS)
|
||||
|
||||
set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||
include (InstallRequiredSystemLibraries)
|
||||
-
|
||||
- install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
|
||||
- DESTINATION lib
|
||||
- COMPONENT Core
|
||||
- )
|
||||
endif()
|
||||
|
||||
# Prepare installation dirs
|
||||
@@ -890,18 +888,18 @@ if (NOT CMAKE_INSTALL_LIBDIR)
|
||||
set (CMAKE_INSTALL_LIBDIR "lib")
|
||||
endif()
|
||||
|
||||
+if (NOT CMAKE_INSTALL_BINDIR)
|
||||
+ set (CMAKE_INSTALL_BINDIR "bin")
|
||||
+endif()
|
||||
+
|
||||
if (NOT CMAKE_INSTALL_INCLUDEDIR)
|
||||
set (CMAKE_INSTALL_INCLUDEDIR "include")
|
||||
endif()
|
||||
|
||||
install (TARGETS ${PLIBSYS_INSTALL_TARGETS} EXPORT plibsys-targets
|
||||
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
- COMPONENT Core
|
||||
-)
|
||||
-install (TARGETS ${PLIBSYS_INSTALL_TARGETS}
|
||||
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Core
|
||||
)
|
||||
install (FILES
|
@ -1,17 +1,16 @@
|
||||
include(vcpkg_common_functions)
|
||||
vcpkg_fail_port_install(ON_TARGET "UWP")
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO saprykin/plibsys
|
||||
REF 0.0.4
|
||||
SHA512 61957666fb454469e1ff68435463eaf426e960caed33540dbb495e1aa7c446c9803d100f33f1a6ea70d5f2ee2d0d19ec315f3a8c651747f65a186ad061c05e51
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix_configuration.patch
|
||||
)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
SET(PLIBSYS_STATIC OFF)
|
||||
else()
|
||||
SET(PLIBSYS_STATIC ON)
|
||||
endif()
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PLIBSYS_STATIC)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
@ -19,6 +18,7 @@ vcpkg_configure_cmake(
|
||||
OPTIONS
|
||||
-DPLIBSYS_TESTS=OFF
|
||||
-DPLIBSYS_COVERAGE=OFF
|
||||
-DPLIBSYS_BUILD_DOC=OFF
|
||||
-DPLIBSYS_BUILD_STATIC=${PLIBSYS_STATIC}
|
||||
)
|
||||
|
||||
@ -26,45 +26,10 @@ vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/plibsys RENAME copyright)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(PLIBSYS_FILENAME plibsys)
|
||||
|
||||
# Put shared libraries into the proper directory
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/bin/plibsys.dll)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/debug/bin/plibsys.dll)
|
||||
else()
|
||||
set(PLIBSYS_FILENAME plibsysstatic)
|
||||
|
||||
# For static build remove dynamic libraries
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)
|
||||
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tmp)
|
||||
|
||||
# Save library files
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib)
|
||||
|
||||
# Remove unused shared libraries
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
|
||||
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
|
||||
|
||||
# Re-install library files
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)
|
||||
|
||||
# Remove duplicate library files (already installed)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tmp)
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake @ONLY)
|
||||
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
|
||||
|
5
ports/plibsys/usage
Normal file
5
ports/plibsys/usage
Normal file
@ -0,0 +1,5 @@
|
||||
The package plibsys provides CMake targets:
|
||||
|
||||
find_package(plibsys CONFIG REQUIRED)
|
||||
target_include_directories(main PRIVATE ${PLIBSYS_INCLUDE_DIRS})
|
||||
target_link_libraries(main PRIVATE ${PLIBSYS_LIBRARIES})
|
12
ports/plibsys/vcpkg-cmake-wrapper.cmake
Normal file
12
ports/plibsys/vcpkg-cmake-wrapper.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
find_path(PLIBSYS_INCLUDE_DIR NAMES plibsys.h HINTS ${CURRENT_INSTALLED_DIR} PATH_SUFFIXES plibsys)
|
||||
|
||||
find_library(PLIBSYS_LIBRARY_DEBUG NAMES plibsys plibsysstatic libplibsys NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
|
||||
find_library(PLIBSYS_LIBRARY_RELEASE NAMES plibsys plibsysstatic libplibsys NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
|
||||
|
||||
select_library_configurations(PLIBSYS)
|
||||
|
||||
set(PLIBSYS_INCLUDE_DIRS ${PLIBSYS_INCLUDE_DIR})
|
||||
set(PLIBSYS_LIBRARIES ${PLIBSYS_LIBRARY})
|
@ -1435,8 +1435,6 @@ plib:arm-uwp=fail
|
||||
plib:x64-osx=fail
|
||||
plib:x64-uwp=fail
|
||||
plibsys:arm-uwp=fail
|
||||
plibsys:x64-linux=fail
|
||||
plibsys:x64-osx=fail
|
||||
plibsys:x64-uwp=fail
|
||||
plplot:arm64-windows=fail
|
||||
plplot:arm-uwp=fail
|
||||
|
Loading…
Reference in New Issue
Block a user