mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-30 12:07:50 +08:00
110 lines
3.2 KiB
Diff
110 lines
3.2 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 7e7790271c..cd08a77e4a 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -41,6 +41,104 @@ else()
|
||
|
|
||
|
endif()
|
||
|
|
||
|
+include(CheckCXXSourceCompiles)
|
||
|
+set(CMAKE_REQUIRED_LIBRARIES Boost::config)
|
||
|
+set(CMAKE_REQUIRED_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||
|
+check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_long_double_support.cpp> \n int main() { return 0;}" BOOST_MATH_HAS_LONG_DOUBLE)
|
||
|
+unset(CMAKE_REQUIRED_LIBRARIES)
|
||
|
+unset(CMAKE_REQUIRED_INCLUDES)
|
||
|
+
|
||
|
+set(C99_SOURCES
|
||
|
+ acosh
|
||
|
+ asinh
|
||
|
+ atanh
|
||
|
+ cbrt
|
||
|
+ copysign
|
||
|
+ erfc
|
||
|
+ erf
|
||
|
+ expm1
|
||
|
+ fmax
|
||
|
+ fmin
|
||
|
+ fpclassify
|
||
|
+ hypot
|
||
|
+ lgamma
|
||
|
+ llround
|
||
|
+ log1p
|
||
|
+ lround
|
||
|
+ nextafter
|
||
|
+ nexttoward
|
||
|
+ round
|
||
|
+ tgamma
|
||
|
+ trunc
|
||
|
+)
|
||
|
+
|
||
|
+set(TR1_SOURCES
|
||
|
+ assoc_laguerre
|
||
|
+ assoc_legendre
|
||
|
+ beta
|
||
|
+ comp_ellint_1
|
||
|
+ comp_ellint_2
|
||
|
+ comp_ellint_3
|
||
|
+ cyl_bessel_i
|
||
|
+ cyl_bessel_j
|
||
|
+ cyl_bessel_k
|
||
|
+ cyl_neumann
|
||
|
+ ellint_1
|
||
|
+ ellint_2
|
||
|
+ ellint_3
|
||
|
+ expint
|
||
|
+ hermite
|
||
|
+ laguerre
|
||
|
+ legendre
|
||
|
+ riemann_zeta
|
||
|
+ sph_bessel
|
||
|
+ sph_legendre
|
||
|
+ sph_neumann
|
||
|
+)
|
||
|
+
|
||
|
+list(TRANSFORM C99_SOURCES PREPEND "src/tr1/" ) # OUTPUT_VARIABLE <output variable>])
|
||
|
+list(TRANSFORM TR1_SOURCES PREPEND "src/tr1/" )
|
||
|
+
|
||
|
+list(TRANSFORM C99_SOURCES APPEND "f.cpp" OUTPUT_VARIABLE C99_SOURCESf)
|
||
|
+list(TRANSFORM TR1_SOURCES APPEND "f.cpp" OUTPUT_VARIABLE TR1_SOURCESf)
|
||
|
+
|
||
|
+set(types "" f)
|
||
|
+
|
||
|
+if(BOOST_MATH_HAS_LONG_DOUBLE)
|
||
|
+ list(TRANSFORM C99_SOURCES APPEND "l.cpp" OUTPUT_VARIABLE C99_SOURCESl)
|
||
|
+ list(TRANSFORM TR1_SOURCES APPEND "l.cpp" OUTPUT_VARIABLE TR1_SOURCESl)
|
||
|
+ list(APPEND types l)
|
||
|
+endif()
|
||
|
+
|
||
|
+list(TRANSFORM C99_SOURCES APPEND ".cpp")
|
||
|
+list(TRANSFORM TR1_SOURCES APPEND ".cpp")
|
||
|
+
|
||
|
+foreach(type IN LISTS types)
|
||
|
+ add_library(boost_math_tr1${type} ${TR1_SOURCES${type}})
|
||
|
+ target_include_directories(boost_math_tr1${type} PRIVATE src/tr1)
|
||
|
+ target_include_directories(boost_math_tr1${type} PRIVATE include)
|
||
|
+ add_library(boost_math_c99${type} ${C99_SOURCES${type}})
|
||
|
+ target_include_directories(boost_math_c99${type} PRIVATE src/tr1)
|
||
|
+ target_include_directories(boost_math_c99${type} PRIVATE include)
|
||
|
+ if(BUILD_SHARED_LIBS)
|
||
|
+ target_compile_definitions(boost_math_tr1${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1)
|
||
|
+ target_compile_definitions(boost_math_c99${type} PUBLIC BOOST_MATH_TR1_DYN_LINK=1)
|
||
|
+ if(MSVC)
|
||
|
+ target_compile_definitions(boost_math_tr1${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB)
|
||
|
+ target_compile_definitions(boost_math_c99${type} PRIVATE "BOOST_SYMBOL_EXPORT=__declspec(dllexport)" BOOST_ALL_NO_LIB)
|
||
|
+ endif()
|
||
|
+ endif()
|
||
|
+ target_compile_features(boost_math_tr1${type} PUBLIC cxx_std_11)
|
||
|
+ target_compile_features(boost_math_c99${type} PUBLIC cxx_std_11)
|
||
|
+ if(DARWIN)
|
||
|
+ target_compile_definitions(boost_math_tr1${type} PRIVATE _DARWIN_C_SOURCE)
|
||
|
+ target_compile_definitions(boost_math_c99${type} PRIVATE _DARWIN_C_SOURCE)
|
||
|
+ endif()
|
||
|
+ boost_install_target(TARGET boost_math_tr1${type} VERSION ${BOOST_SUPERPROJECT_VERSION})
|
||
|
+ boost_install_target(TARGET boost_math_c99${type} VERSION ${BOOST_SUPERPROJECT_VERSION})
|
||
|
+endforeach()
|
||
|
+
|
||
|
+
|
||
|
# Only enable tests when we're the root project
|
||
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||
|
|