|
From: <kin...@us...> - 2025-09-10 01:23:54
|
Revision: 7389
http://sourceforge.net/p/teem/code/7389
Author: kindlmann
Date: 2025-09-10 01:23:48 +0000 (Wed, 10 Sep 2025)
Log Message:
-----------
now the AIR_EXISTS test has been moved to a separte file
Modified Paths:
--------------
teem/trunk/CMakeLists-v2.txt
Modified: teem/trunk/CMakeLists-v2.txt
===================================================================
--- teem/trunk/CMakeLists-v2.txt 2025-09-10 01:21:31 UTC (rev 7388)
+++ teem/trunk/CMakeLists-v2.txt 2025-09-10 01:23:48 UTC (rev 7389)
@@ -238,102 +238,8 @@
###-------------------------------------------------------------------------------------
# Configure-time test: does AIR_EXISTS() work like isfinite()?
-# A lot of work for one little macro (which GLK started using before the functionally
-# equivalent isfinite() became widely available). The little CMake/TestAIR_EXISTS.c
-# program tests the equivalent of AIR_EXISTS (but without directly using air.h's
-# AIR_EXISTS because this has to be stand-alone), to see if it can correctly detect
-# IEEE754 special values (NaNs and infinities). For this to be a useful test that informs
-# how the rest of Teem code will work, TestAIR_EXISTS.c needs to be compiled the same as
-# Teem itself will be compiled later. Sadly, it was not until Teem V2 that this
-# consistency was actually enforced (!) To further help debugging, we also print out
-# exactly how TestAIR_EXISTS.c is compiled, and we use try_compile instead of try_run
-# so the resulting executable file stays available for later inspection.
-#
-# (rejected but interesting debugging strategies:
-# message(STATUS "Pausing CMake so you can inspect temporary files...")
-# execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 30)
-# or
-# execute_process(COMMAND /bin/sh -c "read -p 'Press ENTER to continue...'")
-# )
-
-# "taex" = Test Air_EXists
-set(_taex_src "${CMAKE_CURRENT_LIST_DIR}/CMake/TestAIR_EXISTS.c")
-
-# Build flags for the probe (same as Teem itself)
-string(TOUPPER "${CMAKE_BUILD_TYPE}" _taex_BTUC)
-set(_taex_flags "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_taex_BTUC}}")
-set(_taex_me "AIR_EXISTS (compiled \"${_taex_flags}\")")
-
-# Where we want a durable copy of the compiled probe
-if(WIN32)
- set(_taex_copy "${CMAKE_BINARY_DIR}/TestAIR_EXISTS.exe")
-else()
- set(_taex_copy "${CMAKE_BINARY_DIR}/TestAIR_EXISTS")
-endif()
-
-# Remove any stale copy from previous runs
-if(EXISTS "${_taex_copy}")
- file(REMOVE "${_taex_copy}")
-endif()
-
-# Compile the probe
-message(CHECK_START "Testing whether macro ${_taex_me} detects IEEE754 special values")
-try_compile(
- _taex_compiles # boolean result: TRUE if compile succeeded
- SOURCES "${_taex_src}" # one or more source files for the test
- CMAKE_FLAGS
- "-DCMAKE_VERBOSE_MAKEFILE=ON"
- "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
- "-DCMAKE_C_FLAGS_${_taex_BTUC}=${_taex_flags}"
- "-DCMAKE_DEPENDS_USE_COMPILER=FALSE" # no -MD/-MT/-MF dependency cruft
- COPY_FILE "${_taex_copy}" # copy the built executable to a stable path
- OUTPUT_VARIABLE _taex_compile_out
- COPY_FILE_ERROR _taex_copy_error
-)
-# Always show the captured compile output, as progress indication
-string(REPLACE "\n" "\n " _taex_compile_out_indented "${_taex_compile_out}")
-message(STATUS "Compile output:\n ${_taex_compile_out_indented}")
-
-if(NOT _taex_compiles)
- message(CHECK_FAIL "compile failed")
- message(FATAL_ERROR "Could not compile ${_taex_src}")
-elseif(_taex_copy_error)
- message(CHECK_FAIL "copy failed")
- message(FATAL_ERROR "Test program compiled but could not copy: ${_taex_copy_error}")
-elseif(NOT EXISTS "${_taex_copy}")
- message(CHECK_FAIL "missing executable")
- message(FATAL_ERROR "Test program compiled but file not found at ${_taex_copy}")
-else()
- message(CHECK_PASS "compiled successfully")
-endif()
-
-# Run the test program
-message(CHECK_START "Running ${_taex_me} test program")
-# https://cmake.org/cmake/help/latest/command/execute_process.html
-execute_process(
- COMMAND "${_taex_copy}"
- RESULT_VARIABLE _taex_run_status
- OUTPUT_VARIABLE _taex_run_out
- ERROR_VARIABLE _taex_run_err
-)
-
-# Act on the results; set AIR_EXISTS_MACRO_FAILS
-if(_taex_run_status EQUAL 0)
- message(CHECK_PASS "Yes, it detects IEEE754 special values")
- set(AIR_EXISTS_MACRO_FAILS 0 CACHE INTERNAL "AIR_EXISTS macro works correctly")
-else()
- # Always show stdout/stderr from the probe as indented sub-log
- if(_taex_run_out)
- string(REPLACE "\n" "\n " _taex_run_out_indented "${_taex_run_out}")
- message(STATUS "Probe stdout:\n ${_taex_run_out_indented}")
- endif()
- if(_taex_run_err)
- string(REPLACE "\n" "\n " _taex_run_err_indented "${_taex_run_err}")
- message(STATUS "Probe stderr:\n ${_taex_run_err_indented}")
- endif()
- message(CHECK_FAIL "NO, it FAILS to detect IEEE754 special values")
- set(AIR_EXISTS_MACRO_FAILS 1 CACHE INTERNAL "AIR_EXISTS macro fails")
-endif()
+# This finishes by setting AIR_EXISTS_MACRO_FAILS
+include(CheckAirExists)
# AIR_EXISTS_MACRO_FAILS is used indirectly, below, by configure_file(airExistsConf.h)
###-------------------------------------------------------------------------------------
@@ -375,7 +281,7 @@
# (used as part of handling Windows "extern" analog)
target_compile_definitions(Teem PUBLIC "$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:TEEM_STATIC>")
-# Do we need to link with -lm?
+# Do we need to link with -lm? This finishes by setting LIBM_NEEDED
include(CheckLibM)
if(LIBM_NEEDED)
message(STATUS "Will explicitly link with -lm")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|