1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 14:52:34 +02:00
Leland Lucius 70bbfb69d5 Last major update to the cmake build
I'm sure there will be further minor updates, but this
should be the last major update and it should be ready
for testing.

Audacity specific cmake options (cmake -Doption=<yes|no>) include:

   // Disable dynamic loading of ffmpeg libraries
   disable_dynamic_ffmpeg:BOOL=OFF

   // Disable dynamic loading of JACK libraries
   disable_dynamic_jack:BOOL=ON

   // Enable ffmpeg library
   enable_ffmpeg:BOOL=ON

   // Enable flac library
   enable_flac:BOOL=ON

   // Enable id3tag library
   enable_id3tag:BOOL=ON

   // Enable LADSPA plug-in support
   enable_ladspa:BOOL=ON

   // Enable lv2 library
   enable_lv2:BOOL=ON

   // Enable mad library
   enable_mad:BOOL=ON

   // Enable midi library
   enable_midi:BOOL=ON

   // Enable nyquist library
   enable_nyquist:BOOL=ON

   // Enable ogg library
   enable_ogg:BOOL=ON

   // Enable portmixer library
   enable_portmixer:BOOL=ON

   // Enable portsmf library
   enable_portsmf:BOOL=ON

   // Enable sbsms library
   enable_sbsms:BOOL=ON

   // Enable soundtouch library
   enable_soundtouch:BOOL=ON

   // Enable twolame library
   enable_twolame:BOOL=ON

   // Enable vamp library
   enable_vamp:BOOL=ON

   // Enable vorbis library
   enable_vorbis:BOOL=ON

   // Enable VST2 plug-in support
   enable_vst:BOOL=ON

   // Use system libraries if available
   prefer_system_libs:BOOL=ON

   // Enable the portaudio ALSA interface if available
   use_pa_alsa:BOOL=ON

   // Enable the portaudio CoreAudio interface if available
   use_pa_coreaudio:BOOL=ON

   // Enable the portaudio DirectSound interface if available
   use_pa_ds:BOOL=ON

   // Use the JACK audio interface if available
   use_pa_jack:BOOL=ON

   // Use the OSS audio interface if available
   use_pa_oss:BOOL=ON

   // Enable the portaudio WASAPI interface if available
   use_pa_wasapi:BOOL=ON

   // Enable the portaudio WMME interface if available
   use_pa_wmme:BOOL=ON

   // Use ffmpeg system library if available
   use_system_ffmpeg:BOOL=ON

   // Use flac system library if available
   use_system_flac:BOOL=ON

   // Use id3tag system library if available
   use_system_id3tag:BOOL=ON

   // Use lame system library if available
   use_system_lame:BOOL=ON

   // Use lv2 system library if available
   use_system_lv2:BOOL=ON

   // Use mad system library if available
   use_system_mad:BOOL=ON

   // Use midi system library if available
   use_system_midi:BOOL=ON

   // Use ogg system library if available
   use_system_ogg:BOOL=ON

   // Use portsmf system library if available
   use_system_portsmf:BOOL=ON

   // Use sbsms system library if available
   use_system_sbsms:BOOL=ON

   // Use sndfile system library if available
   use_system_sndfile:BOOL=ON

   // Use soundtouch system library if available
   use_system_soundtouch:BOOL=ON

   // Use soxr system library if available
   use_system_soxr:BOOL=ON

   // Use twolame system library if available
   use_system_twolame:BOOL=ON

   // Use vamp system library if available
   use_system_vamp:BOOL=ON

   // Use vorbis system library if available
   use_system_vorbis:BOOL=ON

   // Use wxwidgets system library if available
   use_system_wxwidgets:BOOL=ON
2020-02-11 01:15:26 -06:00

185 lines
5.1 KiB
CMake

add_library( ${TARGET} INTERFACE )
add_library( ${symbol} ALIAS ${TARGET} )
def_vars()
message( STATUS "========== Configuring ${name} ==========" )
option( use_system_${name} "Use ${name} system library if available" ${prefer_system_libs} )
if( use_system_${name} )
find_package(wxWidgets)
endif()
if( wxWidgets_FOUND )
message( STATUS "Using '${name}' system library" )
if( wxWidgets_INCLUDE_DIRS_NO_SYSTEM )
set( INCLUDES
INTERFACE
${wxWidgets_INCLUDE_DIRS_NO_SYSTEM}
)
else()
set( INCLUDES
INTERFACE
${wxWidgets_INCLUDE_DIRS}
)
endif()
set( DEFINES
INTERFACE
${wxWidgets_DEFINITIONS}
$<$<CONFIG:Debug>:
${wxWidgets_DEFINITIONS_DEBUG}
>
)
set( LINKDIRS
INTERFACE
$<$<PLATFORM_ID:Windows>:
${wxWidgets_LIB_DIR}
>
)
set( LIBRARIES
INTERFACE
${wxWidgets_LIBRARIES}
$<$<NOT:$<PLATFORM_ID:Windows>>:
z
>
)
set( toolkit "${wxWidgets_LIBRARIES}" )
else()
message( STATUS "Using local '${name}' library" )
set( use_system_${name} OFF CACHE BOOL "Prefer ${name} system library if available" FORCE )
set( WXWIN $ENV{WXWIN} )
if( "${WXWIN}" STREQUAL "" )
# XXX: Look into importing instead of adding to this project
set( WXWIN "${_INTDIR}/wxwidgets" )
endif()
if( NOT EXISTS "${WXWIN}" )
find_package( Git )
if( NOT GIT_FOUND )
message( FATAL_ERROR "Git is needed to clone wxWidgets" )
endif()
execute_process(
COMMAND
${GIT_EXECUTABLE} clone
--depth 1
--single-branch
--recurse-submodules
https://github.com/audacity/wxwidgets
"${WXWIN}"
)
endif()
if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
# Want accessibility
set( wxUSE_ACCESSIBILITY YES )
# Windows requires it due to missing "#include" directives
set( wxBUILD_PRECOMP YES )
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
# Want accessibility
set( wxUSE_ACCESSIBILITY YES )
# Causes problems on OSX, so turn it off
set( wxBUILD_PRECOMP NO )
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" )
# Doesn't yet have accessbility
set( wxUSE_ACCESSIBILITY NO )
# Linux can go either way, so might as well use it
set( wxBUILD_PRECOMP YES )
endif()
# Just to be consistent with Audacity
set( wxBUILD_CXX_STANDARD "14" )
# Pull in wxWidgets
add_subdirectory( ${WXWIN} ${WXWIN} )
# And rearrange the folder structure
set_dir_folder( ${WXWIN} "wxWidgets" )
set( INCLUDES
$<$<STREQUAL:"${wxUSE_ZLIB}","builtin">:
${WXWIN}/src/zlib
>
)
set( DEFINES
WXUSINGDLL
)
# Do NOT split the generator expressions across multiple lines here.
# CMake appears to have a bug and doesn't see to handle it correctly
# for target link libraries.
set( LIBRARIES
adv
base
core
html
net
qa
xml
$<$<STREQUAL:"${wxUSE_EXPAT}","builtin">:wxexpat>
$<$<STREQUAL:"${wxUSE_LIBJPEG}","builtin">:wxjpeg>
$<$<STREQUAL:"${wxUSE_LIBPNG}","builtin">:wxpng>
$<$<STREQUAL:"${wxUSE_LIBTIFF}","builtin">:wxtiff>
$<$<STREQUAL:"${wxUSE_REGEX}","builtin">:wxregex>
$<$<STREQUAL:"${wxUSE_ZLIB}","builtin">:wxzlib>
)
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
# When accessibility is enabled, the build will fail in "wx/chkconf.h"
# since wxRegex compile defines do not include __WXOSX_COCOA__. So,
# add it here.
target_compile_definitions( wxregex PRIVATE "__WXOSX_COCOA__" )
endif()
set( toolkit "${wxBUILD_TOOLKIT}" )
endif()
if( "${toolkit}" MATCHES ".*gtk2.*" )
set( gtk gtk+-2.0 )
set( glib glib-2.0 )
set( wxTOOLKIT "GTK2" CACHE INTERNAL "" )
set( wxIS_GTK YES CACHE INTERNAL "" )
elseif( "${toolkit}" MATCHES ".*gtk3.*" )
set( gtk gtk+-3.0 )
set( glib glib-2.0 )
set( wxTOOLKIT "GTK3" CACHE INTERNAL "" )
set( wxIS_GTK YES CACHE INTERNAL "" )
elseif( "${toolkit}" MATCHES ".*gtk4.*" )
set( gtk gtk+-4.0 )
set( glib glib-2.0 )
set( wxTOOLKIT "GTK4" CACHE INTERNAL "" )
set( wxIS_GTK YES CACHE INTERNAL "" )
elseif( "${toolkit}" MATCHES ".*msw.*" )
set( wxTOOLKIT "MSW" CACHE INTERNAL "" )
set( wxIS_WIN YES CACHE INTERNAL "" )
elseif( "${toolkit}" MATCHES ".*osx.*" )
set( wxTOOLKIT "MAC" CACHE INTERNAL "" )
set( wxIS_MAC YES CACHE INTERNAL "" )
else()
message( FATAL_ERROR "Unrecognized wxWidgets toolkit" )
endif()
if( "${wxTOOLKIT}" MATCHES "GTK." )
pkg_check_modules( GTK REQUIRED IMPORTED_TARGET GLOBAL ${gtk} )
pkg_check_modules( GLIB REQUIRED IMPORTED_TARGET GLOBAL ${glib} )
endif()
target_include_directories( ${TARGET} INTERFACE ${INCLUDES} )
target_compile_definitions( ${TARGET} INTERFACE ${DEFINES} )
target_link_directories( ${TARGET} INTERFACE ${LINKDIRS} )
target_link_libraries( ${TARGET} INTERFACE ${LIBRARIES} )
INSTALL( TARGETS ${TARGET} DESTINATION ${_LIBDIR} )