|
From: <kin...@us...> - 2025-09-12 06:07:43
|
Revision: 7416
http://sourceforge.net/p/teem/code/7416
Author: kindlmann
Date: 2025-09-12 06:07:42 +0000 (Fri, 12 Sep 2025)
Log Message:
-----------
tweaks to how diagnostics are printed
Modified Paths:
--------------
teem/trunk/CMake/CheckAirExists.cmake
teem/trunk/CMake/CheckLibmNeeded.cmake
teem/trunk/CMake/FindFFTW3-v2.cmake
teem/trunk/CMake/FindLEVMAR-v2.cmake
teem/trunk/CMakeLists-v2.txt
Modified: teem/trunk/CMake/CheckAirExists.cmake
===================================================================
--- teem/trunk/CMake/CheckAirExists.cmake 2025-09-12 05:05:03 UTC (rev 7415)
+++ teem/trunk/CMake/CheckAirExists.cmake 2025-09-12 06:07:42 UTC (rev 7416)
@@ -1,4 +1,4 @@
-# CMake/CheckAirExists.cmake: see if AIR_EXISTS() macro works like isfinite()
+## CheckAirExists.cmake: see if AIR_EXISTS() macro works like isfinite()
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
@@ -19,6 +19,7 @@
# Defines:
# AIR_EXISTS_MACRO_FAILS -- TRUE if AIR_EXISTS() fails with current compiler settings
+set(_me "[CheckAirExists]")
# "taex" = Test Air_EXists
set(_taex_src "${CMAKE_CURRENT_LIST_DIR}/TestAIR_EXISTS.c")
@@ -41,7 +42,7 @@
endif()
# Compile the probe
-message(CHECK_START "Testing whether macro ${_taex_me} detects IEEE754 special values")
+message(CHECK_START "${_me} 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
@@ -56,23 +57,23 @@
)
# 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}")
+message(STATUS "${_me} Compile output:\n ${_taex_compile_out_indented}")
if(NOT _taex_compiles)
message(CHECK_FAIL "compile failed")
- message(FATAL_ERROR "Could not compile ${_taex_src}")
+ message(FATAL_ERROR "${_me} 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}")
+ message(FATAL_ERROR "${_me} 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}")
+ message(FATAL_ERROR "${_me} 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")
+message(CHECK_START "${_me} Running ${_taex_me} test program")
# https://cmake.org/cmake/help/latest/command/execute_process.html
execute_process(
COMMAND "${_taex_copy}"
@@ -89,11 +90,11 @@
# 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}")
+ message(STATUS "${_me} 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}")
+ message(STATUS "${_me} 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")
@@ -105,3 +106,6 @@
# or
# execute_process(COMMAND /bin/sh -c "read -p 'Press ENTER to continue...'")
# )
+
+# Cleanup
+unset(_me)
Modified: teem/trunk/CMake/CheckLibmNeeded.cmake
===================================================================
--- teem/trunk/CMake/CheckLibmNeeded.cmake 2025-09-12 05:05:03 UTC (rev 7415)
+++ teem/trunk/CMake/CheckLibmNeeded.cmake 2025-09-12 06:07:42 UTC (rev 7416)
@@ -1,4 +1,4 @@
-# CMake/CheckLibM.cmake: learn if need to link with -lm for math functions
+## CheckLibmNeeded.cmake: learn if linking bin with math-using lib also needs -lm
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
@@ -20,9 +20,9 @@
# LIBM_NEEDED -- TRUE if executables must link with -lm for current library type
#
# Usage example
-# include(CheckLibM)
+# include(CheckLibmNeeded)
# if(LIBM_NEEDED)
-# target_link_libraries(Teem PRIVATE m)
+# target_link_libraries(mylib PRIVATE m)
# endif()
### ------------------------------------------------------------------------
@@ -32,6 +32,8 @@
return()
endif()
+set(_me "[CheckLibmNeeded]")
+
# BUILD_SHARED_LIBS informs what kind of libtiny we make
if(BUILD_SHARED_LIBS)
set(_lib_type SHARED)
@@ -39,8 +41,6 @@
set(_lib_type STATIC)
endif()
-set(_me "[CheckLibM]")
-
set(_lmn_desc "Need to add -lm when linking with math-using ${_lib_type} lib?")
message(STATUS "${_me} ${_lmn_desc}")
@@ -156,3 +156,6 @@
### ------------------------------------------------------------------------
# Cleanup if we didn't crash out
file(REMOVE_RECURSE "${_checklibm_dir}")
+unset(_me)
+unset(_proj_dir)
+unset(_lib_type)
Modified: teem/trunk/CMake/FindFFTW3-v2.cmake
===================================================================
--- teem/trunk/CMake/FindFFTW3-v2.cmake 2025-09-12 05:05:03 UTC (rev 7415)
+++ teem/trunk/CMake/FindFFTW3-v2.cmake 2025-09-12 06:07:42 UTC (rev 7416)
@@ -1,4 +1,4 @@
-# CMake/FindFFTW3.cmake: Slightly better way of looking for FFTW3 package
+## FindFFTW3.cmake: Slightly better way of looking for FFTW3 package
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
@@ -10,18 +10,48 @@
# and there must be various solutions out there, since ChatGPT basically wrote the code
# below (and is characterically unable to provide a citation for similarly simple but
# working code online)
+#
+# For comparison look at:
+# https://github.com/egpbos/findFFTW
+# https://github.com/acoustid/chromaprint/blob/master/cmake/modules/FindFFTW3.cmake
+# https://git.astron.nl/RD/EveryBeam/-/blob/v0.6.2/CMake/FindFFTW3.cmake
# TODO: handle the various variants for different precisions
# See FindFFTW3-multiprec.cmake for inspiration
+# how we identify ourselves
+set(_dep "FFTW3")
+
+# Option to enable extra debug output from this module
+option(Teem_${_dep}_DEBUG "Print detailed debug about finding ${_dep}" OFF)
+
+# Helper macros to print only when Teem_${_dep}_DEBUG is enabled
+macro(_status msg)
+ if(Teem_${_dep}_DEBUG)
+ message(STATUS "[Find${_dep}] ${msg}")
+ endif()
+endmacro()
+macro(_check_start msg)
+ if(Teem_${_dep}_DEBUG)
+ message(CHECK_START "[Find${_dep}] ${msg}")
+ endif()
+endmacro()
+macro(_check_fail msg)
+ if(Teem_${_dep}_DEBUG)
+ message(CHECK_FAIL "${msg}")
+ endif()
+endmacro()
+macro(_check_pass msg)
+ if(Teem_${_dep}_DEBUG)
+ message(CHECK_PASS "${msg}")
+ endif()
+endmacro()
+
# NOTE: If a working FFTW3Config.cmake is found, it will define
# FFTW3::fftw3 for us already, so we don’t have to do anything else.
# This fallback only runs when FFTW3_FOUND is still FALSE.
-if (NOT FFTW3_FOUND)
+if(NOT FFTW3_FOUND)
- # Include the helper macro for standard handling of results
- include(FindPackageHandleStandardArgs)
-
# Look for the FFTW3 header. Users can help by setting FFTW3_DIR or
# by making sure the header is somewhere in the default search paths.
find_path(FFTW3_INCLUDE_DIR
@@ -29,6 +59,7 @@
HINTS ENV FFTW3_DIR # WHAT MORE hints?
PATH_SUFFIXES include
)
+ _status("find_path result: FFTW3_INCLUDE_DIR='${FFTW3_INCLUDE_DIR}'")
# Look for the FFTW3 library. Allow FFTW3_DIR to point to its prefix.
find_library(FFTW3_LIBRARY
@@ -36,27 +67,37 @@
HINTS ENV FFTW3_DIR # WHAT MORE hints?
PATH_SUFFIXES lib
)
+ _status("find_library result: FFTW3_LIBRARY='${FFTW3_LIBRARY}'")
- # Standard handling macro: sets FFTW3_FOUND if successful
+ # Include the helper macro for standard handling of results
+ include(FindPackageHandleStandardArgs)
+ # Sets FFTW3_FOUND if successful
+ _check_start("find_package_handle_standard_args(FFTW3)")
find_package_handle_standard_args(FFTW3
REQUIRED_VARS FFTW3_LIBRARY FFTW3_INCLUDE_DIR
)
- # If we did find FFTW3, but no imported target exists yet,
- # create our own IMPORTED target so downstream code can use:
- # target_link_libraries(myprog PRIVATE FFTW3::fftw3)
- if (FFTW3_FOUND AND NOT TARGET FFTW3::fftw3)
- add_library(FFTW3::fftw3 UNKNOWN IMPORTED)
- set_target_properties(FFTW3::fftw3 PROPERTIES
- IMPORTED_LOCATION "${FFTW3_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR}"
- # HEY no INTERFACE_LINK_LIBRARIES ?
- )
+ if (FFTW3_FOUND)
+ # If we did find FFTW3, but no imported target exists yet,
+ # create our own IMPORTED target so downstream code can use:
+ # target_link_libraries(myprog PRIVATE FFTW3::fftw3)
+ if (NOT TARGET FFTW3::fftw3)
+ add_library(FFTW3::fftw3 UNKNOWN IMPORTED)
+ set_target_properties(FFTW3::fftw3 PROPERTIES
+ IMPORTED_LOCATION "${FFTW3_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR}"
+ # HEY no INTERFACE_LINK_LIBRARIES ?
+ )
+ endif()
+ _check_pass("Found: ${_dep}_INCLUDE_DIR=${${_dep}_INCLUDE_DIR} ${_dep}_LIBRARY=${${_dep}_LIBRARY}")
+ else()
+ _check_fail("Not found")
endif()
endif()
-if (FFTW3_FOUND)
- message(STATUS "Using FFTW3: ${FFTW3_LIBRARY}")
-else()
- message(STATUS "FFTW3 not found")
-endif()
+# clean up
+unset(_dep)
+unset(_status)
+unset(_check_start)
+unset(_check_fail)
+unset(_check_pass)
Modified: teem/trunk/CMake/FindLEVMAR-v2.cmake
===================================================================
--- teem/trunk/CMake/FindLEVMAR-v2.cmake 2025-09-12 05:05:03 UTC (rev 7415)
+++ teem/trunk/CMake/FindLEVMAR-v2.cmake 2025-09-12 06:07:42 UTC (rev 7416)
@@ -1,4 +1,4 @@
-# CMake/FindLEVMAR.cmake: Careful+verbose way of looking for levmar install
+## FindLEVMAR.cmake: Careful+verbose way of looking for a levmar install
# ("levmar" = https://users.ics.forth.gr/~lourakis/levmar/index.html)
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
@@ -118,7 +118,7 @@
# If we did find LEVMAR, but no imported target exists yet,
# create our own IMPORTED target so downstream code can use:
- # target_link_libraries(myprog PRIVATE FFTW3::fftw3)
+ # target_link_libraries(myprog PRIVATE LEVMAR::LEVMAR)
if(NOT TARGET LEVMAR::LEVMAR)
add_library(LEVMAR::LEVMAR UNKNOWN IMPORTED)
set_target_properties(LEVMAR::LEVMAR PROPERTIES
@@ -127,7 +127,7 @@
INTERFACE_LINK_LIBRARIES "${LEVMAR_LIBRARIES}"
)
endif()
- _check_pass("Found: LEVMAR_INCLUDE_DIRS=${LEVMAR_INCLUDE_DIRS} LEVMAR_LIBRARIES=${LEVMAR_LIBRARIES}")
+ _check_pass("Found: ${_dep}_INCLUDE_DIR=${${_dep}_INCLUDE_DIR} ${_dep}_LIBRARY=${${_dep}_LIBRARY}")
else()
_check_fail("Not found")
endif()
Modified: teem/trunk/CMakeLists-v2.txt
===================================================================
--- teem/trunk/CMakeLists-v2.txt 2025-09-12 05:05:03 UTC (rev 7415)
+++ teem/trunk/CMakeLists-v2.txt 2025-09-12 06:07:42 UTC (rev 7416)
@@ -17,7 +17,7 @@
# along with this library; if not, see <https://www.gnu.org/licenses/>.
#
-# Teem/CMakeLists.txt Version 10.98
+# Teem/CMakeLists.txt Version 11
# This CMakeLists.txt describes a Teem package that contains:
# (1) a library ("libteem" on unix) and
@@ -51,15 +51,11 @@
LANGUAGES C)
message(STATUS "
-
-
********************************************************************
-** Please join the Teem-users discord https://discord.gg/xBBqZGXkF7
+** Please join the Teem-users Discord https://discord.gg/xBBqZGXkF7
** to share how Teem works or does not work for you!
** For example, are these re-written CMakeLists.txt files working?
********************************************************************
-
-
")
###-------------------------------------------------------------------------------------
@@ -289,12 +285,12 @@
target_compile_definitions(Teem PUBLIC "$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:TEEM_STATIC>")
# Do we need to link with -lm? This finishes by setting LIBM_NEEDED
-include(CheckLibM)
+include(CheckLibmNeeded)
if(LIBM_NEEDED)
message(STATUS "Will explicitly link with -lm")
target_link_libraries(Teem
- PRIVATE # still link to Teem itself
- INTERFACE m # this ensures consumers (executables) get -lm automatically
+ PRIVATE m # Teem itself links (especially for shared library)
+ INTERFACE m # Consumers (especially for static builds) automatically link
)
else()
message(STATUS "Do not need to link with -lm")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|