[edflib] Add new port (#25738)

* [edflib] Add new port

* [edflib] Add version

* [edflib] Fix PDB installation

* [edflib] Overwrite version

* [edflib] No need to call vcpkg_copy_pdbs

* [edflib] Overwrite version

* [vcpkg] Drop dynamic build support

* [edflib] Update version

* [edflib] Fix linux build

* [edflib] Overwrite version

* [edflib] Remove test_edflib and test_generator

* [edflib] Overwrite version

* [edflib] Cleanup

* [edflib] Overwrite version
This commit is contained in:
myd7349 2022-08-24 03:43:10 +08:00 committed by GitHub
parent e5eb2da7fb
commit 88b1071e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 140 additions and 0 deletions

View File

@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 3.5)
project(EDFlib VERSION 1.21 LANGUAGES C)
option(BUILD_TOOLS "Build EDFlib tools." OFF)
include(GNUInstallDirs)
set(sources edflib.h edflib.c)
add_library(EDFlib ${sources})
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_definitions(EDFlib PRIVATE _LARGEFILE64_SOURCE _LARGEFILE_SOURCE)
target_compile_options(EDFlib PRIVATE -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security)
endif()
set_target_properties(EDFlib PROPERTIES PUBLIC_HEADER edflib.h)
install(TARGETS EDFlib
EXPORT EDFlibTargets
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install(EXPORT EDFlibTargets
FILE unofficial-EDFlibConfig.cmake
DESTINATION "share/unofficial-EDFlib"
)
if(BUILD_TOOLS)
include(CheckSymbolExists)
# https://stackoverflow.com/questions/32816646/can-cmake-detect-if-i-need-to-link-to-libm-when-using-pow-in-c
if(NOT POW_FUNCTION_EXISTS AND NOT NEED_LINKING_AGAINST_LIBM)
check_symbol_exists(pow "math.h" POW_FUNCTION_EXISTS)
if(NOT POW_FUNCTION_EXISTS)
unset(POW_FUNCTION_EXISTS CACHE)
list(APPEND CMAKE_REQUIRED_LIBRARIES m)
check_symbol_exists(pow "math.h" POW_FUNCTION_EXISTS)
if(POW_FUNCTION_EXISTS)
set(NEED_LINKING_AGAINST_LIBM True CACHE BOOL "" FORCE)
else()
message(FATAL_ERROR "Failed making the pow() function available")
endif()
endif()
endif()
add_executable(sine_generator sine_generator.c)
target_link_libraries(sine_generator PRIVATE EDFlib)
add_executable(sweep_generator sweep_generator.c)
target_link_libraries(sweep_generator PRIVATE EDFlib)
if(NEED_LINKING_AGAINST_LIBM)
target_link_libraries(sine_generator PRIVATE m)
target_link_libraries(sweep_generator PRIVATE m)
endif()
install(TARGETS sine_generator sweep_generator
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -0,0 +1,41 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com
OUT_SOURCE_PATH SOURCE_PATH
REPO Teuniz/EDFlib
REF v1.21
SHA512 6153cec44e26c0b9cd2f7e00d014f38ee7bdc444015eaf6169fecaf4aa16b04a552d3755ac83d48728de8dac7fe22cb2d0c9566f0fdc967e15bc3f000f456106
HEAD_REF master
)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools BUILD_TOOLS
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-EDFlib)
if ("tools" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES
sine_generator
sweep_generator
AUTO_CLEAN
)
endif()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

22
ports/edflib/vcpkg.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "edflib",
"version": "1.21",
"description": "A C library to read/write EDF/EDF+/BDF/BDF+ files",
"homepage": "https://www.teuniz.net/edflib/",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"tools": {
"description": "Build tools"
}
}
}

View File

@ -2072,6 +2072,10 @@
"baseline": "1.0.7.15",
"port-version": 2
},
"edflib": {
"baseline": "1.21",
"port-version": 0
},
"edlib": {
"baseline": "1.2.7",
"port-version": 1

9
versions/e-/edflib.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "161f6ffc0519e0944bce2573bbfb7ed800899690",
"version": "1.21",
"port-version": 0
}
]
}