diff options
| author | Matioupi <Matioupi@users.noreply.github.com> | 2020-01-07 00:04:42 +0100 |
|---|---|---|
| committer | dan-shaw <51385773+dan-shaw@users.noreply.github.com> | 2020-01-06 15:04:42 -0800 |
| commit | f9b577e74ffcafb59e1fdffe42ff9c787c3a628c (patch) | |
| tree | 2545c6de687fbb3f546196090d4232d5f68e4383 | |
| parent | 9c860988ab67312761246b9d55242ee995596c1b (diff) | |
| download | vcpkg-f9b577e74ffcafb59e1fdffe42ff9c787c3a628c.tar.gz vcpkg-f9b577e74ffcafb59e1fdffe42ff9c787c3a628c.zip | |
[libaaplus] Add new port (#9194)
* Added port for AA+ library (astronomical algorithms)
* fix PR #9194 for static builds
* Additionnal PR #9194 fixes following JackBoosY comments
* [libaaplus] Fix export cmake, add feature tools
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
| -rw-r--r-- | ports/libaaplus/CMakeLists.txt | 67 | ||||
| -rw-r--r-- | ports/libaaplus/CONTROL | 7 | ||||
| -rw-r--r-- | ports/libaaplus/portfile.cmake | 36 |
3 files changed, 110 insertions, 0 deletions
diff --git a/ports/libaaplus/CMakeLists.txt b/ports/libaaplus/CMakeLists.txt new file mode 100644 index 000000000..8c658ff87 --- /dev/null +++ b/ports/libaaplus/CMakeLists.txt @@ -0,0 +1,67 @@ +PROJECT (AstronomicalAlgorithms) + +cmake_minimum_required(VERSION 3.11) +cmake_policy(VERSION 3.11) + +project(libaaplus LANGUAGES CXX) + +option(BUILD_TOOLS "Build libaaplus tools" OFF) + +file(GLOB LIBS_SRC RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*.cpp) + +list(REMOVE_ITEM ${LIBS_SRC} AATest.cpp) + +file(GLOB PUBLIC_HEADERS RELATIVE ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_LIST_DIR}/*.h) + +set(TEST_SRCS + AATest.cpp +) + +add_library(libaaplus + ${LIBS_SRC} +) + +if (MSVC AND BUILD_SHARED_LIBS) +target_compile_definitions(libaaplus + PRIVATE + -DAAPLUS_EXT_CLASS\=__declspec\(dllexport\) +) +endif (MSVC AND BUILD_SHARED_LIBS) + +install( + TARGETS libaaplus + EXPORT libaaplus + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +# Headers makes relative includes so directory structure must be kept +foreach(HEADER ${PUBLIC_HEADERS}) + get_filename_component(HEADER_DIR ${HEADER} DIRECTORY) + install( + FILES ${HEADER} + DESTINATION include/aaplus/${HEADER_DIR} + ) +endforeach() + + +if (BUILD_TOOLS) + add_executable(aatest AATest.cpp) + target_link_libraries(aatest PRIVATE libaaplus) + if (BUILD_SHARED_LIBS AND MSVC) + target_compile_definitions(aatest + PUBLIC + -DAAPLUS_EXT_CLASS\=__declspec\(dllimport\) + ) + endif (BUILD_SHARED_LIBS AND MSVC) + + install(TARGETS aatest RUNTIME DESTINATION tools/aaplus) +endif() + +install( + EXPORT libaaplus + DESTINATION share/libaaplus + FILE libaaplusConfig.cmake + NAMESPACE libaaplus:: +) diff --git a/ports/libaaplus/CONTROL b/ports/libaaplus/CONTROL new file mode 100644 index 000000000..3fb7f9fb3 --- /dev/null +++ b/ports/libaaplus/CONTROL @@ -0,0 +1,7 @@ +Source: libaaplus
+Version: 2.1.0
+Description: libaaplus is an astronomical computations library by naughter software
+Homepage: http://www.naughter.com/aa.html
+
+Feature: tools
+Description: Build libaaplus tools
\ No newline at end of file diff --git a/ports/libaaplus/portfile.cmake b/ports/libaaplus/portfile.cmake new file mode 100644 index 000000000..b1418fb18 --- /dev/null +++ b/ports/libaaplus/portfile.cmake @@ -0,0 +1,36 @@ +set(VERSION 2.10.0)
+
+vcpkg_download_distfile(
+ ARCHIVE_FILE
+ URLS "http://www.naughter.com/download/aaplus.zip"
+ FILENAME "aaplus.zip"
+ SHA512 ef814a36fa567e806be5e5345abd89e1a8d32da1c392c251e5b74aea86b866ebc74bc17885a0eff303b170cfe226670cd6f69095702396cc9d6fcbc1a769de4f
+)
+
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE_FILE}
+ REF ${VERSION}
+ NO_REMOVE_ONE_LEVEL
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ tools BUILD_TOOLS
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS ${FEATURE_OPTIONS}
+)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/libaaplus)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(INSTALL ${SOURCE_PATH}/AA+.htm DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
