1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 16:43:33 +02:00

Various cmake changes

Mostly from suggestions, but there's a couple of other minor
fixes and additions:

   Cmake not decides with SDK to use on Windows

   All Audacity cmake options are not prefixed with "audacity_", but this
   is configurable in audacity/CMakeLists.txt

   Several other options have been marked advanced so they don't clutter
   the CMake GUI

   On Windows, multiple processors will now be used reducing build time
   considerably

   Quieted a couple of package messages that the user doesn't need to see

   No longer tried to create aliases on Windows

   No longer used precompiled headers if ccache is available

   On Windows, only copies the needed wxWidgets and VC runtime libraries
   to the bin directory
This commit is contained in:
Leland Lucius
2020-02-12 01:05:51 -06:00
parent cb5d1f0bf5
commit e79274a403
9 changed files with 149 additions and 109 deletions

View File

@@ -1,6 +1,6 @@
# Allow user to globally set the system library preference
option( prefer_system_libs "Use system libraries if available" YES )
option( ${_OPT}prefer_system_libs "Use system libraries if available" YES )
#
# Add individual library targets
@@ -33,7 +33,7 @@ function( addlib dir name symbol required check )
# If the target is required, then it's always enabled. Otherwise,
# give the user the option to enable/disable it.
set( enable enable_${name} )
set( enable ${_OPT}enable_${name} )
if( required )
set( ${enable} YES )
else()
@@ -59,9 +59,9 @@ function( addlib dir name symbol required check )
# Only present the system library option if pkg-config was found and
# a package has been specified. Otherwise, the local library will
# be used unconditionally.
set( system use_system_${name} )
set( system ${_OPT}use_system_${name} )
if( PkgConfig_FOUND AND packages )
option( ${system} "Use ${name} system library if available" ${prefer_system_libs} )
option( ${system} "Use ${name} system library if available" ${${_OPT}prefer_system_libs} )
else()
set( ${system} NO )
endif()

View File

@@ -22,6 +22,8 @@ list( APPEND INCLUDES
list( APPEND DEFINES
PRIVATE
HAVE_EXPAT_CONFIG_H
PUBLIC
XML_STATIC
)
if( WORDS_BIGENDIAN )

View File

@@ -15,19 +15,19 @@ message( STATUS "========== Configuring ${name} ==========" )
set( USE_${symbol} ON CACHE INTERNAL USE_${symbol} )
# Add the system/local option
option( use_system_${name} "Use ${name} system library if available" ${prefer_system_libs} )
option( ${_OPT}use_system_${name} "Use ${name} system library if available" ${${_OPT}prefer_system_libs} )
# Look up the system packages if the user wants them
if( use_system_${name} )
if( ${_OPT}use_system_${name} )
# Provide an option that determines if the libraries are loaded
# dynamically at run time or statically linked at build time
option( disable_dynamic_${name} "Disable dynamic loading of ${name} libraries" NO)
option( ${_OPT}disable_dynamic_${name} "Disable dynamic loading of ${name} libraries" NO)
# Look them up
pkg_check_modules( ${TARGET} ${packages} )
else()
# Make sure to reset in case user reconfigures between local/system
set( disable_dynamic_${name} NO CACHE INTERNAL "" )
set( ${_OPT}disable_dynamic_${name} NO CACHE INTERNAL "" )
endif()
# If the system packages were found

View File

@@ -121,30 +121,12 @@ set( dst "${_PUBDIR}" )
set( ns "${dst}/lv2/lv2plug.in/ns" )
set( stamp "${_INTDIR}/.stamp.lv2" )
execute_process(
COMMAND
"${CMAKE_COMMAND}" -E make_directory "${ns}"
)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -E create_symlink "${src}/lv2/core/lv2.h" "${dst}/lv2.h"
)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -E create_symlink "${src}/lv2" "${ns}/ext"
)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -E create_symlink "${src}/lv2" "${ns}/extensions"
)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -E create_symlink "${src}/lv2/core" "${ns}/lv2core"
)
# Simulate the older directory structure (trailing "/" is important)
file( MAKE_DIRECTORY "${ns}" )
file( COPY "${src}/lv2/core/lv2.h" DESTINATION "${dst}/lv2.h" )
file( COPY "${src}/lv2/" DESTINATION "${ns}/ext" )
file( COPY "${src}/lv2/" DESTINATION "${ns}/extensions" )
file( COPY "${src}/lv2/core/" DESTINATION "${ns}/lv2core" )
set( LILV_VERSION "0.24.4" )
set( SERD_VERSION "0.30.2" )

View File

@@ -7,54 +7,58 @@ set( CMAKE_MODULE_PATH ${TARGET_ROOT}/cmake_support )
# Define the platform specific interface options
if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
option( use_pa_ds "Enable the portaudio DirectSound interface if available" YES )
option( use_pa_wasapi "Enable the portaudio WASAPI interface if available" YES )
option( use_pa_wmme "Enable the portaudio WMME interface if available" YES )
option( ${_OPT}use_pa_ds "Enable the portaudio DirectSound interface if available" YES )
option( ${_OPT}use_pa_wasapi "Enable the portaudio WASAPI interface if available" YES )
option( ${_OPT}use_pa_wmme "Enable the portaudio WMME interface if available" YES )
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
option( use_pa_coreaudio "Enable the portaudio CoreAudio interface if available" YES )
option( ${_OPT}use_pa_coreaudio "Enable the portaudio CoreAudio interface if available" YES )
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" )
option( use_pa_alsa "Enable the portaudio ALSA interface if available" YES )
if( use_pa_alsa )
option( ${_OPT}use_pa_alsa "Enable the portaudio ALSA interface if available" YES )
if( ${_OPT}use_pa_alsa )
find_package( ALSA )
if( NOT ALSA_FOUND )
set( use_pa_alsa NO CACHE INTERNAL "" )
set( ${_OPT}use_pa_alsa NO CACHE INTERNAL "" )
endif()
endif()
endif()
# Look for OSS if the user wants it
option( use_pa_oss "Use the OSS audio interface if available" YES )
if( use_pa_oss )
option( ${_OPT}use_pa_oss "Use the OSS audio interface if available" YES )
if( ${_OPT}use_pa_oss )
find_path( OSS_INCLUDE NAMES sys/soundcard.h )
mark_as_advanced( FORCE OSS_INCLUDE )
if( OSS_INCLUDE )
set( OSS_INCLUDE_DIRS ${OSS_INCLUDE} )
endif()
find_library( OSS_LIBRARY NAMES ossaudio )
mark_as_advanced( FORCE OSS_LIBRARY )
if( OSS_LIBRARY )
set( OSS_LIBRARIES ${OSS_LIBRARY} )
endif()
if( NOT OSS_INCLUDE_DIRS )
set( use_pa_oss NO CACHE INTERNAL "" )
set( ${_OPT}use_pa_oss NO CACHE INTERNAL "" )
endif()
endif()
# Look for JACK if the user wants it
option( use_pa_jack "Use the JACK audio interface if available" YES )
if( use_pa_jack )
option( ${_OPT}use_pa_jack "Use the JACK audio interface if available" YES )
if( ${_OPT}use_pa_jack )
# Provide an option that determines if the libraries are loaded
# dynamically at run time or statically linked at build time
option( disable_dynamic_jack "Disable dynamic loading of JACK libraries" YES )
option( ${_OPT}disable_dynamic_jack "Disable dynamic loading of JACK libraries" YES )
# Find it
find_package( Jack )
if( NOT JACK_FOUND)
set( use_pa_jack NO CACHE INTERNAL "" )
set( ${_OPT}use_pa_jack NO CACHE INTERNAL "" )
endif()
else()
# Make sure to reset in case user reconfigures later
set( disable_dynamic_jack NO CACHE INTERNAL "" )
set( ${_OPT}disable_dynamic_jack NO CACHE INTERNAL "" )
endif()
list( APPEND SOURCES
@@ -91,28 +95,28 @@ list( APPEND SOURCES
${TARGET_ROOT}/src/os/unix/pa_unix_util.c
>
$<$<BOOL:${use_pa_ds}>:
$<$<BOOL:${${_OPT}use_pa_ds}>:
${TARGET_ROOT}/src/hostapi/dsound/pa_win_ds.c
${TARGET_ROOT}/src/hostapi/dsound/pa_win_ds_dynlink.c
>
$<$<BOOL:${use_pa_wasapi}>:
$<$<BOOL:${${_OPT}use_pa_wasapi}>:
${TARGET_ROOT}/src/hostapi/wasapi/pa_win_wasapi.c
>
$<$<BOOL:${use_pa_wmme}>:
$<$<BOOL:${${_OPT}use_pa_wmme}>:
${TARGET_ROOT}/src/hostapi/wmme/pa_win_wmme.c
>
$<$<BOOL:${use_pa_alsa}>:
$<$<BOOL:${${_OPT}use_pa_alsa}>:
${TARGET_ROOT}/src/hostapi/alsa/pa_linux_alsa.c
>
$<$<BOOL:${use_pa_oss}>:
$<$<BOOL:${${_OPT}use_pa_oss}>:
${TARGET_ROOT}/src/hostapi/oss/pa_unix_oss.c
>
$<$<BOOL:${use_pa_jack}>:
$<$<BOOL:${${_OPT}use_pa_jack}>:
${TARGET_ROOT}/src/hostapi/jack/pa_jack.c
${TARGET_ROOT}/src/hostapi/jack/pa_jack_dynload.c
>
@@ -130,23 +134,23 @@ list( APPEND INCLUDES
${TARGET_ROOT}/src/os/unix
>
$<$<BOOL:${use_pa_ds}>:
$<$<BOOL:${${_OPT}use_pa_ds}>:
${TARGET_ROOT}/src/hostapi/dsound
>
$<$<BOOL:${use_pa_coreaudio}>:
$<$<BOOL:${${_OPT}use_pa_coreaudio}>:
${TARGET_ROOT}/src/hostapi/coreaudio
>
$<$<BOOL:${use_pa_alsa}>:
$<$<BOOL:${${_OPT}use_pa_alsa}>:
${ALSA_INCLUDE_DIRS}
>
$<$<BOOL:${use_pa_oss}>:
$<$<BOOL:${${_OPT}use_pa_oss}>:
${OSS_INCLUDE_DIRS}
>
$<$<BOOL:${use_pa_jack}>:
$<$<BOOL:${${_OPT}use_pa_jack}>:
${TARGET_ROOT}/src/hostapi/jack
${JACK_INCLUDE_DIRS}
>
@@ -157,51 +161,51 @@ list( APPEND INCLUDES
list( APPEND DEFINES
PUBLIC
$<$<BOOL:${use_pa_ds}>:
$<$<BOOL:${${_OPT}use_pa_ds}>:
PA_USE_DS=1
>
$<$<BOOL:${use_pa_wasapi}>:
$<$<BOOL:${${_OPT}use_pa_wasapi}>:
PA_USE_WASAPI=1
>
$<$<BOOL:${use_pa_wmme}>:
$<$<BOOL:${${_OPT}use_pa_wmme}>:
PA_USE_WMME=1
>
$<$<BOOL:${use_pa_coreaudio}>:
$<$<BOOL:${${_OPT}use_pa_coreaudio}>:
PA_USE_COREAUDIO=1
>
$<$<BOOL:${use_pa_alsa}>:
$<$<BOOL:${${_OPT}use_pa_alsa}>:
PA_USE_ALSA=1
>
$<$<BOOL:${use_pa_oss}>:
$<$<BOOL:${${_OPT}use_pa_oss}>:
PA_USE_OSS=1
HAVE_SYS_SOUNDCARD_H=1
>
$<$<BOOL:${use_pa_jack}>:
$<$<BOOL:${${_OPT}use_pa_jack}>:
PA_USE_JACK=1
>
$<$<NOT:$<BOOL:${disable_dynamic_jack}>>:
$<$<NOT:$<BOOL:${${_OPT}disable_dynamic_jack}>>:
PA_DYNAMIC_JACK=1
>
)
list( APPEND LIBRARIES
INTERFACE
$<$<BOOL:${use_pa_alsa}>:
$<$<BOOL:${${_OPT}use_pa_alsa}>:
${ALSA_LIBRARIES}
>
$<$<BOOL:${use_pa_oss}>:
$<$<BOOL:${${_OPT}use_pa_oss}>:
${OSS_LIBRARIES}
>
$<$<BOOL:${use_pa_jack}>:
$<$<BOOL:${${_OPT}use_pa_jack}>:
${JACK_LIBRARIES}
>
)

View File

@@ -6,8 +6,8 @@ def_vars()
message( STATUS "========== Configuring ${name} ==========" )
option( use_system_${name} "Use ${name} system library if available" ${prefer_system_libs} )
if( use_system_${name} )
option( ${_OPT}use_system_${name} "Use ${name} system library if available" ${${_OPT}prefer_system_libs} )
if( ${_OPT}use_system_${name} )
find_package(wxWidgets)
endif()
@@ -53,7 +53,7 @@ if( wxWidgets_FOUND )
else()
message( STATUS "Using local '${name}' library" )
set( use_system_${name} OFF CACHE BOOL "Prefer ${name} system library if available" FORCE )
set( ${_OPT}use_system_${name} OFF CACHE BOOL "Prefer ${name} system library if available" FORCE )
set( WXWIN $ENV{WXWIN} )
if( "${WXWIN}" STREQUAL "" )