|
From: <kin...@us...> - 2025-09-10 04:30:06
|
Revision: 7395
http://sourceforge.net/p/teem/code/7395
Author: kindlmann
Date: 2025-09-10 04:30:02 +0000 (Wed, 10 Sep 2025)
Log Message:
-----------
comment tweaks
Modified Paths:
--------------
teem/trunk/CMake/CheckAirExists.cmake
teem/trunk/CMake/CheckLibM.cmake
Modified: teem/trunk/CMake/CheckAirExists.cmake
===================================================================
--- teem/trunk/CMake/CheckAirExists.cmake 2025-09-10 02:12:17 UTC (rev 7394)
+++ teem/trunk/CMake/CheckAirExists.cmake 2025-09-10 04:30:02 UTC (rev 7395)
@@ -1,26 +1,25 @@
# CMake/CheckAirExists.cmake: see if AIR_EXISTS() macro works like isfinite()
-# sets AIR_EXISTS_MACRO_FAILS if not
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
-# 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.
+### Rationale
+# Modern C has isfinite() to detect if a given floating point value is an IEEE754 special
+# values (NaNs and infinities). Teem development, however, started before isfinite() was
+# widely available, so it uses the AIR_EXISTS() macro in air.h. Being a macro, there are
+# expressions that could do the right thing with some compiler options, but fail with
+# different options (like -ffast-math). So we jump through some hoops to rigorously check
+# if AIR_EXISTS() is really working, based on the little CMake/TestAIR_EXISTS.c test
+# program. 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...'")
-# )
+# Defines:
+# AIR_EXISTS_MACRO_FAILS -- TRUE if AIR_EXISTS() fails with current compiler settings
+
# "taex" = Test Air_EXists
set(_taex_src "${CMAKE_CURRENT_LIST_DIR}/TestAIR_EXISTS.c")
@@ -99,3 +98,10 @@
message(CHECK_FAIL "NO, it FAILS to detect IEEE754 special values")
set(AIR_EXISTS_MACRO_FAILS 1 CACHE INTERNAL "AIR_EXISTS macro fails")
endif()
+
+# (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...'")
+# )
Modified: teem/trunk/CMake/CheckLibM.cmake
===================================================================
--- teem/trunk/CMake/CheckLibM.cmake 2025-09-10 02:12:17 UTC (rev 7394)
+++ teem/trunk/CMake/CheckLibM.cmake 2025-09-10 04:30:02 UTC (rev 7395)
@@ -3,21 +3,21 @@
# See ../LICENSE.txt for licensing terms
### Rationale
-# Different unices have different ways of tacitly linking (or not) with -lm.
-# In the interests of pedantic explicitness, we figure out if linking with -lm
-# is needed when linking with a library that calls math functions. Yes,
-# https://cmake.org/cmake/help/latest/module/CheckLibraryExists.html could
-# probably do the job here, but once I (GLK) went down the rabbit hole of
-# understanding what the problem was, I wanted to create a CMake module that
-# replicated the minimal example I used. So, this test builds a shared library
-# `libtiny` that calls some math functions, then an executable `maintiny` that
-# calls into that library. When compiling `maintiny`, we try linking:
+# Different unices have different ways of tacitly linking (or not) with -lm. In the
+# interests of pedantic explicitness, we figure out if linking with -lm is needed when
+# linking with a library that calls math functions. Yes,
+# https://cmake.org/cmake/help/latest/module/CheckLibraryExists.html could probably do
+# the job here, but once I (GLK) went down the rabbit hole of understanding what the
+# problem was, I wanted to create a CMake module that replicated the minimal example I
+# used. So, this test builds a shared library `libtiny` that calls some math functions,
+# then an executable `maintiny` that calls into that library. When compiling `maintiny`,
+# we try linking:
# 1. Without -lm
# 2. With -lm (if needed)
# Then we run `maintiny` to ensure the math is mathing.
#
# Defines:
-# LIBM_NEEDED -- TRUE if executables must link with -lm
+# LIBM_NEEDED -- TRUE if executables must link with -lm for current library type
#
# Usage example
# include(CheckLibM)
@@ -24,7 +24,6 @@
# if(LIBM_NEEDED)
# target_link_libraries(Teem PRIVATE m)
# endif()
-#
### ------------------------------------------------------------------------
# Setup
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|