mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 00:20:06 +02:00
Provides to use the system wxWidgets install
The default is to use the system one if found. If the WXWIN environment variable is set and points to a valid wxWidgets tree, that will be used. Otherwise, it will search the platform specific locations. You can use a local library instead with: cmake -Duse_system_wxwigets=no ... In this case it will look for the WXWIN environment variable and use that or it will download the Audacity specific wxWidgets source. In both cases, wxWidgets will be built as part of the Audacity project.
This commit is contained in:
parent
ad77faca0d
commit
e2a7204403
1229
cmake-proxies/cmake-modules/FindwxWidgets.cmake
Normal file
1229
cmake-proxies/cmake-modules/FindwxWidgets.cmake
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@ list( APPEND SOURCES
|
||||
list( APPEND INCLUDES
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/private
|
||||
$<$<PLATFORM_ID:Windows>:$ENV{WXWIN}/src/zlib>
|
||||
PUBLIC
|
||||
${TARGET_ROOT}
|
||||
)
|
||||
|
@ -3,13 +3,49 @@ add_library( ${TARGET} INTERFACE )
|
||||
|
||||
def_vars()
|
||||
|
||||
set( WXWIN $ENV{WXWIN} )
|
||||
if( "${WXWIN}" STREQUAL "" )
|
||||
set( WXWIN "${_INTDIR}/wxwidgets" )
|
||||
# XXX: Look into importing instead of adding to this project
|
||||
option( use_system_wxwidgets "Prefer wxWidgets system library if available" ON )
|
||||
if( use_system_wxwidgets )
|
||||
find_package(wxWidgets)
|
||||
endif()
|
||||
|
||||
if( NOT EXISTS "${WXWIN}" )
|
||||
if( wxWidgets_FOUND )
|
||||
#include(${wxWidgets_USE_FILE})
|
||||
|
||||
if( wxWidgets_INCLUDE_DIRS_NO_SYSTEM )
|
||||
set( INCLUDES
|
||||
INTERFACE
|
||||
${wxWidgets_INCLUDE_DIRS}
|
||||
)
|
||||
else()
|
||||
set( INCLUDES
|
||||
SYSTEM
|
||||
${wxWidgets_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
set( DEFINES
|
||||
INTERFACE
|
||||
${wxWidgets_DEFINITIONS}
|
||||
${wxWidgets_DEFINITIONS_DEBUG}
|
||||
)
|
||||
|
||||
set( LIBRARIES
|
||||
INTERFACE
|
||||
${wxWidgets_LIBRARIES}
|
||||
$<$<NOT:$<PLATFORM_ID:Windows>>:z>
|
||||
)
|
||||
|
||||
set( toolkit "${wxWidgets_LIBRARIES}" )
|
||||
else()
|
||||
set( use_system_wxwidgets OFF CACHE BOOL "Prefer wxWidgets 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" )
|
||||
@ -24,46 +60,46 @@ if( NOT EXISTS "${WXWIN}" )
|
||||
https://github.com/audacity/wxwidgets
|
||||
"${WXWIN}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
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" )
|
||||
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" )
|
||||
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
||||
# 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()
|
||||
endif()
|
||||
|
||||
# Just to be consistent with Audacity
|
||||
set( wxBUILD_CXX_STANDARD "14" )
|
||||
# Just to be consistent with Audacity
|
||||
set( wxBUILD_CXX_STANDARD "14" )
|
||||
|
||||
# Pull in wxWidgets
|
||||
add_subdirectory( ${WXWIN} ${WXWIN} )
|
||||
# Pull in wxWidgets
|
||||
add_subdirectory( ${WXWIN} ${WXWIN} )
|
||||
|
||||
# And rearrange the folder structure
|
||||
set_dir_folder( ${WXWIN} "wxWidgets" )
|
||||
# And rearrange the folder structure
|
||||
set_dir_folder( ${WXWIN} "wxWidgets" )
|
||||
|
||||
set( INCLUDES
|
||||
set( INCLUDES
|
||||
$<$<STREQUAL:"${wxUSE_ZLIB}","builtin">:${WXWIN}/src/zlib>
|
||||
)
|
||||
)
|
||||
|
||||
set( DEFINES
|
||||
set( DEFINES
|
||||
WXUSINGDLL
|
||||
)
|
||||
)
|
||||
|
||||
set( LIBRARIES
|
||||
set( LIBRARIES
|
||||
adv
|
||||
base
|
||||
core
|
||||
@ -77,22 +113,27 @@ set( LIBRARIES
|
||||
$<$<STREQUAL:"${wxUSE_LIBTIFF}","builtin">:wxtiff>
|
||||
$<$<STREQUAL:"${wxUSE_REGEX}","builtin">:wxregex>
|
||||
$<$<STREQUAL:"${wxUSE_ZLIB}","builtin">:wxzlib>
|
||||
)
|
||||
)
|
||||
|
||||
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
||||
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__" )
|
||||
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
||||
elseif( CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
||||
set( toolkit "${wxBUILD_TOOLKIT}" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
||||
# We need the system GTK/GLIB packages
|
||||
if( "${wxBUILD_TOOLKIT}" STREQUAL "gtk2" )
|
||||
if( "${toolkit}" MATCHES ".*gtk2.*" )
|
||||
set( gtk gtk+-2.0 )
|
||||
set( glib glib-2.0 )
|
||||
elseif( "${wxBUILD_TOOLKIT}" STREQUAL "gtk3" )
|
||||
elseif( "${toolkit}" MATCHES ".*gtk3.*" )
|
||||
set( gtk gtk+-3.0 )
|
||||
set( glib glib-2.0 )
|
||||
elseif( "${wxBUILD_TOOLKIT}" STREQUAL "gtk4" )
|
||||
elseif( "${toolkit}" MATCHES ".*gtk4.*" )
|
||||
set( gtk gtk+-4.0 )
|
||||
set( glib glib-2.0 )
|
||||
else()
|
||||
|
@ -1053,6 +1053,12 @@ if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
configure_file( audacity_config.h.in private/configwin.h )
|
||||
|
||||
# Copy over the wxWidgets DLLs
|
||||
if( use_system_wxwidgets )
|
||||
set( wxlibs "$ENV{WXWIN}" )
|
||||
else()
|
||||
set( wxlibs "${CMAKE_BINARY_DIR}" )
|
||||
endif()
|
||||
|
||||
file( TO_NATIVE_PATH ${_EXEDIR} exedir )
|
||||
add_custom_command(
|
||||
TARGET
|
||||
@ -1060,7 +1066,7 @@ if( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
COMMAND
|
||||
XCOPY "*.dll" ${exedir} /I /R /Y
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_BINARY_DIR}/lib/vc_dll"
|
||||
"${wxlibs}/lib/vc_dll"
|
||||
POST_BUILD
|
||||
)
|
||||
elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
|
||||
|
Loading…
x
Reference in New Issue
Block a user