mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
Add arblib (#1991)
This commit is contained in:
parent
244d6e894f
commit
c0090ed4c9
94
ports/arb/CMakeLists.txt
Normal file
94
ports/arb/CMakeLists.txt
Normal file
@ -0,0 +1,94 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(arb C)
|
||||
|
||||
set (DEPS mpir mpfr pthreads flint2 gettimeofday)
|
||||
set (mpir_lib gmp mpir)
|
||||
set (mpfr_lib mpfr)
|
||||
set (pthreads_lib pthreads pthread)
|
||||
set (flint2_lib ${LIBRARY_TYPE}_flint flint)
|
||||
set (gettimeofday_lib gettimeofday)
|
||||
|
||||
set (mpir_header gmp.h)
|
||||
set (mpfr_header mpfr.h)
|
||||
set (pthreads_header pthread.h)
|
||||
set (flint2_header flint/flint.h)
|
||||
set (gettimeofday_header gettimeofday.h)
|
||||
|
||||
foreach (LIB ${DEPS})
|
||||
string (TOUPPER ${LIB} LIB_UPPER)
|
||||
find_library(${LIB_UPPER}_LIBRARY NAMES ${${LIB}_lib})
|
||||
if (NOT ${LIB_UPPER}_LIBRARY)
|
||||
message(FATAL_ERROR "${LIB} library not found.")
|
||||
endif()
|
||||
add_library(${LIB} UNKNOWN IMPORTED)
|
||||
set_property(TARGET ${LIB} PROPERTY IMPORTED_LOCATION ${${LIB_UPPER}_LIBRARY})
|
||||
message("${LIB} found in ${${LIB_UPPER}_LIBRARY}")
|
||||
endforeach ()
|
||||
|
||||
foreach (LIB ${DEPS})
|
||||
string(TOUPPER ${LIB} HEADER_PKG)
|
||||
set (HEADER ${${LIB}_header})
|
||||
find_path(${HEADER_PKG}_INCLUDE_DIR NAMES ${HEADER})
|
||||
if (NOT ${HEADER_PKG}_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "${HEADER} header not found.")
|
||||
endif()
|
||||
message("${HEADER} found in ${${HEADER_PKG}_INCLUDE_DIR}")
|
||||
set (DEP_INCLUDE_DIRS ${DEP_INCLUDE_DIRS} ${${HEADER_PKG}_INCLUDE_DIR})
|
||||
endforeach ()
|
||||
|
||||
file(GLOB TEMP "*.h")
|
||||
|
||||
foreach (TEMP_H ${TEMP})
|
||||
get_filename_component(FOLDER ${TEMP_H} NAME_WE)
|
||||
set(FOLDERS ${FOLDERS} ${FOLDER})
|
||||
endforeach()
|
||||
|
||||
foreach (FOLDER ${FOLDERS})
|
||||
file(GLOB TEMP "${FOLDER}/*.c")
|
||||
set(SRC ${SRC} ${TEMP})
|
||||
endforeach ()
|
||||
|
||||
include_directories(BEFORE ${arb_SOURCE_DIR})
|
||||
include_directories(BEFORE ${DEP_INCLUDE_DIRS})
|
||||
|
||||
add_library(arb ${SRC})
|
||||
|
||||
target_compile_definitions(arb PRIVATE HAVE_TLS=1 FLINT_REENTRANT=0)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(arb PRIVATE MSC_USE_DLL)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS yes)
|
||||
MESSAGE( STATUS "Building shared libraries" )
|
||||
else ()
|
||||
target_compile_definitions(arb PRIVATE PTW32_STATIC_LIB)
|
||||
MESSAGE( STATUS "Building static libraries" )
|
||||
endif()
|
||||
target_compile_definitions(arb PRIVATE "ARB_BUILD_DLL")
|
||||
|
||||
target_link_libraries(arb ${DEPS})
|
||||
|
||||
install(TARGETS arb
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
foreach (FOLDER ${FOLDERS})
|
||||
set(HEADERS ${HEADERS} ${FOLDER}.h)
|
||||
endforeach ()
|
||||
|
||||
install(FILES ${HEADERS} DESTINATION include)
|
||||
|
||||
if (BUILD_TESTS)
|
||||
enable_testing()
|
||||
foreach (FOLDER ${FOLDERS})
|
||||
file(GLOB TEMP "${FOLDER}/test/*.c")
|
||||
foreach (TEST_SOURCE ${TEMP})
|
||||
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
|
||||
add_executable(${FOLDER}-${TEST_NAME} ${TEST_SOURCE})
|
||||
target_link_libraries(${FOLDER}-${TEST_NAME} arb)
|
||||
add_test(${FOLDER}-${TEST_NAME} ${FOLDER}-${TEST_NAME})
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
4
ports/arb/CONTROL
Normal file
4
ports/arb/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: arb
|
||||
Version: 2.11.1
|
||||
Description: a C library for arbitrary-precision interval arithmetic
|
||||
Build-Depends: flint
|
32
ports/arb/portfile.cmake
Normal file
32
ports/arb/portfile.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
endif()
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/arb-2.11.1)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH ${SOURCE_PATH}
|
||||
REPO fredrik-johansson/arb
|
||||
REF 2.11.1
|
||||
SHA512 7a014da5208b55f20c7a3cd3eb51070b09ae107b04cbbd6329925780c2ab4d7c38e1fb3619f21456fa806939818370fcae921f59eb013661b6bdd3d0971e3353
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
file(REMOVE ${SOURCE_PATH}/CMakeLists.txt)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/arb RENAME copyright)
|
||||
|
||||
# Remove duplicate headers
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
Loading…
x
Reference in New Issue
Block a user