aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/iausofa
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/iausofa')
-rw-r--r--vcpkg/ports/iausofa/CMakeLists.txt55
-rw-r--r--vcpkg/ports/iausofa/LICENSE7
-rw-r--r--vcpkg/ports/iausofa/portfile.cmake29
-rw-r--r--vcpkg/ports/iausofa/usage4
-rw-r--r--vcpkg/ports/iausofa/vcpkg.json17
5 files changed, 112 insertions, 0 deletions
diff --git a/vcpkg/ports/iausofa/CMakeLists.txt b/vcpkg/ports/iausofa/CMakeLists.txt
new file mode 100644
index 0000000..e0db624
--- /dev/null
+++ b/vcpkg/ports/iausofa/CMakeLists.txt
@@ -0,0 +1,55 @@
+cmake_minimum_required(VERSION 3.15)
+
+# Sets the name of the <PROJECT-NAME>
+project(iausofa LANGUAGES C)
+
+include(GNUInstallDirs)
+
+# set SOURCE dir
+set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
+
+# set .c files except for test_sofa.c
+file(GLOB_RECURSE SOURCES "${SOURCE_DIR}/*.c")
+list(REMOVE_ITEM SOURCES "${SOURCE_DIR}/test_sofa.c")
+
+# set .h files
+file(GLOB_RECURSE HEADERS "${SOURCE_DIR}/*.h")
+
+# Add a library target called <name>, eg. <name>.lib
+add_library(iausofa ${SOURCES})
+
+# Sets properties on <targets>
+if(LINUX)
+ target_link_libraries(iausofa PRIVATE m)
+endif()
+
+# Specifies include directories to use when compiling a given <target>
+target_include_directories(iausofa PUBLIC
+ $<BUILD_INTERFACE:${SOURCE_DIR}> # for headers when building
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> # for client in install mode
+)
+
+# Install target <target> <export-name> Output Artifacts and associated files
+install(TARGETS iausofa
+ EXPORT iausofa_targets
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+
+install(FILES ${HEADERS} DESTINATION include/iausofa)
+
+# Install <export-name> for dependent projects:
+install(EXPORT iausofa_targets
+ FILE unofficial-iausofa-targets.cmake
+ NAMESPACE unofficial::iausofa::
+ DESTINATION share/unofficial-iausofa)
+
+# Generate the config file in the current binary dir (this ensures it's not placed directly in source)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-iausofa-config.cmake"
+ "include(CMakeFindDependencyMacro)\n"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/unofficial-iausofa-targets.cmake\")\n"
+)
+
+# Install the generated config file
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/unofficial-iausofa-config.cmake"
+ DESTINATION share/unofficial-iausofa)
diff --git a/vcpkg/ports/iausofa/LICENSE b/vcpkg/ports/iausofa/LICENSE
new file mode 100644
index 0000000..671aa9c
--- /dev/null
+++ b/vcpkg/ports/iausofa/LICENSE
@@ -0,0 +1,7 @@
+=====================
+SOFA License
+=====================
+
+The license content can be found at [SOFA Terms and Conditions](https://iausofa.org/tandc.html)
+or by downloading the source code from [SOFA Home Page](https://iausofa.org) and checking the end
+of any code file.
diff --git a/vcpkg/ports/iausofa/portfile.cmake b/vcpkg/ports/iausofa/portfile.cmake
new file mode 100644
index 0000000..681c6fe
--- /dev/null
+++ b/vcpkg/ports/iausofa/portfile.cmake
@@ -0,0 +1,29 @@
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_download_distfile(
+ ARCHIVE
+ URLS "http://iausofa.org/2023_1011_C/sofa_c-${VERSION}.tar.gz"
+ FILENAME "sofa_c-${VERSION}.tar.gz"
+ SHA512 8e7d67f7ac7a285a96160c96d16b1921ccb7a9324b83280b1594efcbbd7eb78c4d41898c1e5acfa5081842e4aeee15a96572d21b466bfda7ef7582c58624d376
+)
+
+vcpkg_extract_source_archive(SOURCE_PATH ARCHIVE "${ARCHIVE}")
+
+set(SOURCE_SUBDIR "${SOURCE_PATH}/${VERSION}/c")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_SUBDIR}")
+
+vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_SUBDIR}")
+
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(PACKAGE_NAME "unofficial-iausofa")
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${CMAKE_CURRENT_LIST_DIR}/LICENSE")
diff --git a/vcpkg/ports/iausofa/usage b/vcpkg/ports/iausofa/usage
new file mode 100644
index 0000000..dc90595
--- /dev/null
+++ b/vcpkg/ports/iausofa/usage
@@ -0,0 +1,4 @@
+iausofa provides CMake targets:
+
+ find_package(unofficial-iausofa CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE unofficial::iausofa::iausofa)
diff --git a/vcpkg/ports/iausofa/vcpkg.json b/vcpkg/ports/iausofa/vcpkg.json
new file mode 100644
index 0000000..861a1a3
--- /dev/null
+++ b/vcpkg/ports/iausofa/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "iausofa",
+ "version": "20231011",
+ "description": "This is C version of IAU sofa software.",
+ "homepage": "https://iausofa.org",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}