CMake: Unify config header

config.h is now used on all platforms rather than three separate
configwin.h, configmac.h, and configunix.h

Signed-off-by: Avery King <gperson@disroot.org>
This commit is contained in:
Avery King
2025-03-07 07:35:56 -08:00
parent 453b01419d
commit a42c3f57d6
3 changed files with 7 additions and 14 deletions

View File

@@ -749,16 +749,12 @@ add_subdirectory( "modules" )
add_subdirectory( "scripts" )
# Generate config file
if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
configure_file( src/tenacity_config.h.in src/private/configwin.h )
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set( HAVE_VISIBILITY 1 )
configure_file( src/tenacity_config.h.in src/private/configmac.h )
else()
set( HAVE_VISIBILITY 1 )
configure_file( src/tenacity_config.h.in src/private/configunix.h )
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
set(HAVE_VISIBILITY 1)
endif()
configure_file(src/tenacity_config.h.in src/private/config.h)
# Generate a picture of module dependencies
string( JOIN "\n" GRAPH_EDGES ${GRAPH_EDGES} )
# Choose edge attributes making it easy to hover at either end of edge

View File

@@ -163,9 +163,8 @@ function( tenacity_append_common_compiler_options var use_pch )
PRIVATE
# include the correct config file; give absolute path to it, so
# that this works whether in src, modules, libraries
$<$<PLATFORM_ID:Windows>:/FI${CMAKE_BINARY_DIR}/src/private/configwin.h>
$<$<PLATFORM_ID:Darwin>:-include ${CMAKE_BINARY_DIR}/src/private/configmac.h>
$<$<NOT:$<PLATFORM_ID:Windows,Darwin>>:-include ${CMAKE_BINARY_DIR}/src/private/configunix.h>
$<$<CXX_COMPILER_ID:MSVC>:/FI${CMAKE_BINARY_DIR}/src/private/config.h>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include ${CMAKE_BINARY_DIR}/src/private/config.h>
)
endif()
list( APPEND ${var}

View File

@@ -1280,9 +1280,7 @@ if( NOT CCACHE_PROGRAM AND NOT SCCACHE_PROGRAM )
if( PCH )
message( STATUS "Using precompiled headers" )
target_precompile_headers( ${TARGET} PRIVATE
$<$<PLATFORM_ID:Windows>:${CMAKE_BINARY_DIR}/src/private/configwin.h>
$<$<PLATFORM_ID:Darwin>:${CMAKE_BINARY_DIR}/src/private/configmac.h>
$<$<NOT:$<PLATFORM_ID:Windows,Darwin>>:${CMAKE_BINARY_DIR}/src/private/configunix.h>
${CMAKE_BINARY_DIR}/src/private/config.h
AudacityHeaders.h
)
else()