mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-22 18:47:09 +01:00
[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>
This commit is contained in:
parent
9c860988ab
commit
f9b577e74f
67
ports/libaaplus/CMakeLists.txt
Normal file
67
ports/libaaplus/CMakeLists.txt
Normal file
@ -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::
|
||||
)
|
7
ports/libaaplus/CONTROL
Normal file
7
ports/libaaplus/CONTROL
Normal file
@ -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
|
36
ports/libaaplus/portfile.cmake
Normal file
36
ports/libaaplus/portfile.cmake
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user