mirror of https://github.com/libsdl-org/SDL
cmake: check for valid isinf/isinff/isnan/isnanf macros
This commit is contained in:
parent
ea11c9e0c7
commit
d52ea20916
|
@ -1100,6 +1100,43 @@ if(SDL_LIBC)
|
|||
endforeach()
|
||||
cmake_pop_check_state()
|
||||
|
||||
cmake_push_check_state()
|
||||
if(MSVC)
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -we4244 -WX") # 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
else()
|
||||
string(APPEND CMAKE_REQUIRED_FLAGS " -Wfloat-conversion -Werror")
|
||||
endif()
|
||||
foreach(math_fn isinf isnan)
|
||||
string(TOUPPER "${math_fn}" MATH_FN)
|
||||
check_c_source_compiles("
|
||||
#include <math.h>
|
||||
int main() {
|
||||
double d = 3.14159;
|
||||
return ${math_fn}(d);
|
||||
}
|
||||
" LIBC_HAS_${MATH_FN})
|
||||
set(HAVE_${MATH_FN} ${LIBC_HAS_${MATH_FN}})
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <math.h>
|
||||
int main() {
|
||||
float f = 3.14159f;
|
||||
return ${math_fn}(f);
|
||||
}
|
||||
" LIBC_${MATH_FN}_HANDLES_FLOAT)
|
||||
set(HAVE_${MATH_FN}_FLOAT_MACRO ${LIBC_${MATH_FN}_HANDLES_FLOAT})
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <math.h>
|
||||
int main() {
|
||||
float f = 3.14159f;
|
||||
return ${math_fn}f(f);
|
||||
}
|
||||
" LIBC_HAS_${MATH_FN}F)
|
||||
set(HAVE_${MATH_FN}F "${LIBC_HAS_${MATH_FN}}")
|
||||
endforeach()
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(NOT WINDOWS)
|
||||
check_symbol_exists(getpagesize "unistd.h" HAVE_GETPAGESIZE)
|
||||
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
|
|
|
@ -55,6 +55,12 @@ function(SDL_Preseed_CMakeCache)
|
|||
set(LIBC_HAS_ICONV_H "" CACHE INTERNAL "Have include iconv.h")
|
||||
set(LIBC_HAS_INDEX "" CACHE INTERNAL "Have symbol index")
|
||||
set(LIBC_HAS_INTTYPES_H "1" CACHE INTERNAL "Have include inttypes.h")
|
||||
set(LIBC_HAS_ISINF "1" CACHE INTERNAL "Have include isinf(double)")
|
||||
set(LIBC_ISINF_HANDLES_FLOAT "1" CACHE INTERNAL "Have include isinf(float)")
|
||||
set(LIBC_HAS_ISINFF "" CACHE INTERNAL "Have include isinff(float)")
|
||||
set(LIBC_HAS_ISNAN "1" CACHE INTERNAL "Have include isnan(double)")
|
||||
set(LIBC_ISNAN_HANDLES_FLOAT "1" CACHE INTERNAL "Have include isnan(float)")
|
||||
set(LIBC_HAS_ISNANF "" CACHE INTERNAL "Have include isnanf(float)")
|
||||
set(LIBC_HAS_ITOA "1" CACHE INTERNAL "Have symbol itoa")
|
||||
set(LIBC_HAS_LIMITS_H "1" CACHE INTERNAL "Have include limits.h")
|
||||
set(LIBC_HAS_LOG "1" CACHE INTERNAL "Have symbol log")
|
||||
|
|
|
@ -154,8 +154,10 @@
|
|||
#cmakedefine HAVE_FMODF 1
|
||||
#cmakedefine HAVE_ISINF 1
|
||||
#cmakedefine HAVE_ISINFF 1
|
||||
#cmakedefine HAVE_ISINF_FLOAT_MACRO 1
|
||||
#cmakedefine HAVE_ISNAN 1
|
||||
#cmakedefine HAVE_ISNANF 1
|
||||
#cmakedefine HAVE_ISNAN_FLOAT_MACRO 1
|
||||
#cmakedefine HAVE_LOG 1
|
||||
#cmakedefine HAVE_LOGF 1
|
||||
#cmakedefine HAVE_LOG10 1
|
||||
|
|
Loading…
Reference in New Issue