aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/edflib
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/edflib
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/edflib')
-rw-r--r--vcpkg/ports/edflib/CMakeLists.txt75
-rw-r--r--vcpkg/ports/edflib/portfile.cmake49
-rw-r--r--vcpkg/ports/edflib/vcpkg.json22
3 files changed, 146 insertions, 0 deletions
diff --git a/vcpkg/ports/edflib/CMakeLists.txt b/vcpkg/ports/edflib/CMakeLists.txt
new file mode 100644
index 0000000..8358e27
--- /dev/null
+++ b/vcpkg/ports/edflib/CMakeLists.txt
@@ -0,0 +1,75 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(EDFlib LANGUAGES C)
+
+option(BUILD_TOOLS "Build EDFlib tools." OFF)
+
+include(GNUInstallDirs)
+
+set(sources edflib.h edflib.c)
+
+add_library(EDFlib ${sources})
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EDFlib
+ PUBLIC
+ EDFLIB_SO_DLL
+ PRIVATE
+ $<BUILD_INTERFACE:EDFLIB_BUILD>
+ )
+endif()
+
+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}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ 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()
diff --git a/vcpkg/ports/edflib/portfile.cmake b/vcpkg/ports/edflib/portfile.cmake
new file mode 100644
index 0000000..6b4b80c
--- /dev/null
+++ b/vcpkg/ports/edflib/portfile.cmake
@@ -0,0 +1,49 @@
+vcpkg_from_gitlab(
+ GITLAB_URL https://gitlab.com
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Teuniz/EDFlib
+ REF "v${VERSION}"
+ SHA512 ad5f9be5a10d0e83a80242cdb088db8ae697ee6e723a7c5459cef95b5eba16c54d8bc2493b66d5114a8d1782505b2d2c63c9a5ce96c09dcca89489cd43fa6012
+ 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()
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_replace_string(
+ "${CURRENT_PACKAGES_DIR}/include/edflib.h"
+ "#if defined(EDFLIB_SO_DLL)"
+ "#if 1 // defined(EDFLIB_SO_DLL)"
+ )
+endif()
+
+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()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/edflib/vcpkg.json b/vcpkg/ports/edflib/vcpkg.json
new file mode 100644
index 0000000..40bbe06
--- /dev/null
+++ b/vcpkg/ports/edflib/vcpkg.json
@@ -0,0 +1,22 @@
+{
+ "name": "edflib",
+ "version": "1.27",
+ "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"
+ }
+ }
+}