Skip to content

Commit

Permalink
no message (#626)
Browse files Browse the repository at this point in the history
Co-authored-by: Naoki Shibata <[email protected]>
  • Loading branch information
shibatch and Naoki Shibata authored Feb 9, 2025
1 parent 736cbce commit d77e50a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 45 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ env:
-DSLEEF_ENFORCE_TESTER3=ON
-DSLEEF_ENABLE_TESTER4=OFF
-DSLEEF_ENABLE_TESTER=ON
-DSLEEF_ENABLE_TLFLOAT=OFF
jobs:
build-macos:
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.18)
project(SLEEF VERSION 3.8.0 LANGUAGES C)

set(SLEEF_VERSION 3.9.0)

message(STATUS "Configuring SLEEF ${SLEEF_VERSION}")
project(SLEEF VERSION ${SLEEF_VERSION} LANGUAGES C CXX)

set(SLEEF_SOVERSION ${SLEEF_VERSION_MAJOR})

Expand Down Expand Up @@ -34,6 +38,7 @@ option(SLEEF_ENABLE_ALTSQRT "Enable alternative sqrt method (aarch64 only)" OFF)
option(SLEEF_DISABLE_FFTW "Disable testing the DFT library with FFTW" OFF)
option(SLEEF_DISABLE_MPFR "Disable testing with the MPFR library" OFF)
option(SLEEF_DISABLE_SSL "Disable testing with the SSL library" OFF)
option(SLEEF_ENABLE_TLFLOAT "Enable use of TLFloat library" ON)

option(SLEEF_ENABLE_CUDA "Enable CUDA" OFF)

Expand Down
84 changes: 44 additions & 40 deletions Configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,59 +96,63 @@ endif()

# Include TLFloat as a submodule

set(TLFLOAT_MINIMUM_VERSION 1.11.2)
set(TLFLOAT_GIT_TAG "5b03b9fd41aaf4d655361f971fe45e738646f286")
if (SLEEF_ENABLE_TLFLOAT)
set(TLFLOAT_MINIMUM_VERSION 1.11.2)
set(TLFLOAT_GIT_TAG "5b03b9fd41aaf4d655361f971fe45e738646f286")

set(TLFLOAT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/submodules/tlfloat")
set(TLFLOAT_INSTALL_DIR "${SLEEF_SUBMODULE_INSTALL_DIR}/tlfloat")
set(TLFLOAT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/submodules/tlfloat")
set(TLFLOAT_INSTALL_DIR "${SLEEF_SUBMODULE_INSTALL_DIR}/tlfloat")

set(TLFLOAT_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TLFLOAT_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_LIBS=True -DBUILD_UTILS=False -DBUILD_TESTS=False)
set(TLFLOAT_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${TLFLOAT_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBUILD_LIBS=True -DBUILD_UTILS=False -DBUILD_TESTS=False)

if (CMAKE_C_COMPILER)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER})
endif()
if (CMAKE_C_COMPILER)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER})
endif()

if (CMAKE_CXX_COMPILER)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER})
endif()
if (CMAKE_CXX_COMPILER)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER})
endif()

if (CMAKE_TOOLCHAIN_FILE)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()
if (CMAKE_TOOLCHAIN_FILE)
list(APPEND TLFLOAT_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
endif()

if (EXISTS "${TLFLOAT_SOURCE_DIR}/CMakeLists.txt")
# If the source code of tlfloat is already downloaded, use it
ExternalProject_Add(ext_tlfloat
SOURCE_DIR "${TLFLOAT_SOURCE_DIR}"
CMAKE_ARGS ${TLFLOAT_CMAKE_ARGS}
)
include_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/include")
link_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/lib")
set(TLFLOAT_LIBRARIES "tlfloat")
else()
pkg_search_module(TLFLOAT tlfloat)

if (TLFLOAT_FOUND AND TLFLOAT_VERSION VERSION_GREATER_EQUAL TLFLOAT_MINIMUM_VERSION)
# If tlfloat is installed on the system
add_custom_target(ext_tlfloat ALL)
include_directories(BEFORE "${TLFLOAT_INCLUDE_DIRS}")
link_directories(BEFORE "${TLFLOAT_LIBDIR}")
message(STATUS "Found installed TLFloat " ${TLFLOAT_VERSION})
else()
# Otherwise, download the source code
find_package(Git REQUIRED)
if (EXISTS "${TLFLOAT_SOURCE_DIR}/CMakeLists.txt")
# If the source code of tlfloat is already downloaded, use it
ExternalProject_Add(ext_tlfloat
GIT_REPOSITORY https://github.com/shibatch/tlfloat
GIT_TAG "${TLFLOAT_GIT_TAG}"
SOURCE_DIR "${TLFLOAT_SOURCE_DIR}"
CMAKE_ARGS ${TLFLOAT_CMAKE_ARGS}
)

UPDATE_DISCONNECTED TRUE
)
include_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/include")
link_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/lib")
set(TLFLOAT_LIBRARIES "tlfloat")
else()
pkg_search_module(TLFLOAT tlfloat)

if (TLFLOAT_FOUND AND TLFLOAT_VERSION VERSION_GREATER_EQUAL TLFLOAT_MINIMUM_VERSION)
# If tlfloat is installed on the system
add_custom_target(ext_tlfloat ALL)
include_directories(BEFORE "${TLFLOAT_INCLUDE_DIRS}")
link_directories(BEFORE "${TLFLOAT_LIBDIR}")
message(STATUS "Found installed TLFloat " ${TLFLOAT_VERSION})
else()
# Otherwise, download the source code
find_package(Git REQUIRED)
ExternalProject_Add(ext_tlfloat
GIT_REPOSITORY https://github.com/shibatch/tlfloat
GIT_TAG "${TLFLOAT_GIT_TAG}"
SOURCE_DIR "${TLFLOAT_SOURCE_DIR}"
CMAKE_ARGS ${TLFLOAT_CMAKE_ARGS}
UPDATE_DISCONNECTED TRUE
)

include_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/include")
link_directories(BEFORE "${TLFLOAT_INSTALL_DIR}/lib")
set(TLFLOAT_LIBRARIES "tlfloat")
endif()
endif()
endif()
endif(SLEEF_ENABLE_TLFLOAT)

# Force set default build type if none was specified
# Note: some sleef code requires the optimisation flags turned on
Expand Down
8 changes: 4 additions & 4 deletions src/libm-tester/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ macro(test_extension SIMD)
endif(SLEEF_ENABLE_TESTER)
#

if (SLEEF_ENABLE_TESTER4)
if (SLEEF_ENABLE_TESTER4 AND TLFLOAT_LIBRARIES)
set(TESTER4_SRC tester4simd.cpp ${sleef_SOURCE_DIR}/src/common/main_checkfeature.c)

string(CONCAT TARGET_TESTER4_${SIMD} "tester4" ${LCSIMD})
Expand Down Expand Up @@ -321,7 +321,7 @@ macro(test_extension SIMD)
add_test_with_emu(1.0 ${TARGET_TESTER4I_${SIMD}})
endif()
endif(SLEEF_BUILD_INLINE_HEADERS)
endif(SLEEF_ENABLE_TESTER4)
endif(SLEEF_ENABLE_TESTER4 AND TLFLOAT_LIBRARIES)

#

Expand Down Expand Up @@ -493,7 +493,7 @@ if (SLEEF_ARCH_X86)
list(APPEND IUT_LIST iutdsp256)
endif(SLEEF_ENABLE_TESTER)

if (SLEEF_ENABLE_TESTER4)
if (SLEEF_ENABLE_TESTER4 AND TLFLOAT_LIBRARIES)
# tester4dsp128
add_executable(tester4dsp128 ${TESTER4_SRC})
target_compile_definitions(tester4dsp128 PRIVATE
Expand All @@ -511,7 +511,7 @@ if (SLEEF_ARCH_X86)
target_link_libraries(tester4dsp256 ${TARGET_LIBSLEEF} ${TLFLOAT_LIBRARIES})
add_dependencies(tester4dsp256 ${TARGET_HEADERS} ${TARGET_LIBSLEEF} ext_tlfloat)
add_test_with_emu(1.0 tester4dsp256)
endif(SLEEF_ENABLE_TESTER4)
endif(SLEEF_ENABLE_TESTER4 AND TLFLOAT_LIBRARIES)
endif(SLEEF_ARCH_X86)

if (SLEEF_ARCH_PPC64)
Expand Down

0 comments on commit d77e50a

Please sign in to comment.