Skip to content

Commit

Permalink
Only build scalar library if requested. (#515)
Browse files Browse the repository at this point in the history
Previously the scalar library was built even with `SLEEF_BUILD_SCALAR_LIB=OFF`, and SLEEF_BUILD_SCALAR_LIB only controlled the installation.
  • Loading branch information
xuhancn authored Mar 13, 2024
1 parent 3b76e29 commit 82a3780
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/libm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -972,25 +972,24 @@ endif()
# TARGET_LIBSLEEFSCALAR
# --------------------------------------------------------------------
# Build scalar-only library from sleefdp.c and sleefsp.c
if(SLEEF_BUILD_SCALAR_LIB)
add_library(sleefscalar sleefdp.c sleefsp.c rempitab.c)
add_dependencies(sleefscalar ${TARGET_HEADERS})
set_target_properties(sleefscalar PROPERTIES
VERSION ${SLEEF_VERSION}
SOVERSION ${SLEEF_SOVERSION}
PUBLIC_HEADER ${SLEEF_INCLUDE_HEADER}
${COMMON_TARGET_PROPERTIES}
)

add_library(sleefscalar sleefdp.c sleefsp.c rempitab.c)
add_dependencies(sleefscalar ${TARGET_HEADERS})
set_target_properties(sleefscalar PROPERTIES
VERSION ${SLEEF_VERSION}
SOVERSION ${SLEEF_SOVERSION}
PUBLIC_HEADER ${SLEEF_INCLUDE_HEADER}
${COMMON_TARGET_PROPERTIES}
)

target_compile_definitions(sleefscalar
PRIVATE DORENAME=1 ${COMMON_TARGET_DEFINITIONS}
)
target_compile_definitions(sleefscalar
PRIVATE DORENAME=1 ${COMMON_TARGET_DEFINITIONS}
)

if(COMPILER_SUPPORTS_BUILTIN_MATH)
target_compile_definitions(sleefscalar PRIVATE ENABLE_BUILTIN_MATH=1)
endif()
if(COMPILER_SUPPORTS_BUILTIN_MATH)
target_compile_definitions(sleefscalar PRIVATE ENABLE_BUILTIN_MATH=1)
endif()

if(SLEEF_BUILD_SCALAR_LIB)
install(
TARGETS sleefscalar
EXPORT sleefTargets
Expand Down

0 comments on commit 82a3780

Please sign in to comment.