mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 08:38:39 +02:00
Adds an option to disable Conan
This commit is contained in:
parent
d5aa055877
commit
1968e81c79
@ -187,3 +187,8 @@ $ docker run --rm -v ${pwd}:/audacity/audacity/ -v ${pwd}/../build/linux-system:
|
||||
```
|
||||
|
||||
To find system packages, we rely on `pkg-config`. There are several packages that have broken `*.pc` or do not use `pkg-config` at all. For the docker image - we handle this issue by installing the correct [`pc` files](linux/build-environment/pkgconfig/).
|
||||
|
||||
### Disabling Conan
|
||||
|
||||
Conan can be disabled completely using `-Daudacity_conan_enabled=Off` during the configuration.
|
||||
This option implies `-Daudacity_obey_system_dependencies=On` and disables `local` for packages that are managed with Conan.
|
@ -138,6 +138,12 @@ include( AudacityFunctions )
|
||||
|
||||
set_from_env(AUDACITY_ARCH_LABEL) # e.g. x86_64
|
||||
|
||||
# Allow user to globally set the library preference
|
||||
cmd_option( ${_OPT}conan_enabled
|
||||
"Use Conan package manager for 3d party dependencies"
|
||||
On
|
||||
)
|
||||
|
||||
# Allow user to globally set the library preference
|
||||
cmd_option( ${_OPT}lib_preference
|
||||
"Library preference [system (if available), local]"
|
||||
@ -510,7 +516,7 @@ resolve_conan_dependencies()
|
||||
|
||||
add_subdirectory( "help" )
|
||||
if(${_OPT}has_crashreports)
|
||||
add_subdirectory( "crashreports" )
|
||||
add_subdirectory( "crashreports" )
|
||||
endif()
|
||||
add_subdirectory( "images" )
|
||||
add_subdirectory( "libraries" )
|
||||
|
@ -1,10 +1,13 @@
|
||||
# Load Conan
|
||||
include( conan )
|
||||
|
||||
conan_add_remote(NAME audacity
|
||||
if( ${_OPT}conan_enabled )
|
||||
include( conan )
|
||||
|
||||
conan_add_remote(NAME audacity
|
||||
URL https://artifactory.audacityteam.org/artifactory/api/conan/conan-local
|
||||
VERIFY_SSL True
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
set( CONAN_BUILD_REQUIRES )
|
||||
set( CONAN_REQUIRES )
|
||||
@ -13,23 +16,29 @@ set( CONAN_ONLY_DEBUG_RELEASE )
|
||||
set( CONAN_CONFIG_OPTIONS )
|
||||
set( CONAN_RESOLVE_LIST )
|
||||
|
||||
# Add a Conan dependency
|
||||
# Example usage:
|
||||
# add_conan_lib(
|
||||
# wxWdidget
|
||||
# wxwidgets/3.1.3-audacity
|
||||
# OPTION_NAME wxwidgets
|
||||
# SYMBOL WXWIDGET
|
||||
# REQUIRED
|
||||
# ALWAYS_ALLOW_CONAN_FALLBACK
|
||||
# PKG_CONFIG "wxwidgets >= 3.1.3"
|
||||
# FIND_PACKAGE_OPTIONS COMPONENTS adv base core html qa xml
|
||||
# INTERFACE_NAME wxwidgets::wxwidgets
|
||||
# HAS_ONLY_DEBUG_RELEASE
|
||||
# CONAN_OPTIONS
|
||||
# wxwidgets:shared=True
|
||||
# )
|
||||
#[[
|
||||
Add a Conan dependency
|
||||
|
||||
Example usage:
|
||||
|
||||
add_conan_lib(
|
||||
wxWdidget
|
||||
wxwidgets/3.1.3-audacity
|
||||
OPTION_NAME wxwidgets
|
||||
SYMBOL WXWIDGET
|
||||
REQUIRED
|
||||
ALWAYS_ALLOW_CONAN_FALLBACK
|
||||
PKG_CONFIG "wxwidgets >= 3.1.3"
|
||||
FIND_PACKAGE_OPTIONS COMPONENTS adv base core html qa xml
|
||||
INTERFACE_NAME wxwidgets::wxwidgets
|
||||
HAS_ONLY_DEBUG_RELEASE
|
||||
CONAN_OPTIONS
|
||||
wxwidgets:shared=True
|
||||
)
|
||||
|
||||
PKG_CONFIG accepts a list of possible package configurations.
|
||||
add_conan_lib will iterate over it one by one until the library is found.
|
||||
]]
|
||||
|
||||
function (add_conan_lib package conan_package_name )
|
||||
# Extract the list of packages from the function args
|
||||
@ -54,6 +63,8 @@ function (add_conan_lib package conan_package_name )
|
||||
set( list_mode on )
|
||||
set( allow_find_package on )
|
||||
set( current_var "find_package_options" )
|
||||
elseif ( opt STREQUAL "ALLOW_FIND_PACKAGE" )
|
||||
set ( allow_find_package on )
|
||||
elseif ( opt STREQUAL "CONAN_OPTIONS" )
|
||||
set( list_mode on )
|
||||
set( current_var "conan_package_options" )
|
||||
@ -93,14 +104,23 @@ function (add_conan_lib package conan_package_name )
|
||||
|
||||
set( option_desc "local" )
|
||||
|
||||
if( pkg_config_options OR allow_find_package )
|
||||
if( pkg_config_options OR allow_find_package OR NOT ${_OPT}conan_enabled )
|
||||
set( sysopt "system" )
|
||||
string( PREPEND option_desc "system (if available), " )
|
||||
|
||||
if( ${_OPT}conan_enabled )
|
||||
set( default "${${_OPT}lib_preference}" )
|
||||
else()
|
||||
set( default "system" )
|
||||
endif()
|
||||
else()
|
||||
set( default "local" )
|
||||
endif()
|
||||
|
||||
if( ${_OPT}conan_enabled )
|
||||
set( localopt "local" )
|
||||
endif()
|
||||
|
||||
if( NOT required )
|
||||
set( reqopt "off" )
|
||||
string( APPEND option_desc ", off" )
|
||||
@ -109,7 +129,7 @@ function (add_conan_lib package conan_package_name )
|
||||
cmd_option( ${option_name}
|
||||
"Use ${option_name_base} library [${option_desc}]"
|
||||
"${default}"
|
||||
STRINGS ${sysopt} "local" ${reqopt}
|
||||
STRINGS ${sysopt} ${localopt} ${reqopt}
|
||||
)
|
||||
|
||||
# Early bail out
|
||||
@ -129,9 +149,10 @@ function (add_conan_lib package conan_package_name )
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( ${option_name} STREQUAL "system" )
|
||||
if( ${option_name} STREQUAL "system" OR NOT ${_OPT}conan_enabled )
|
||||
if( pkg_config_options )
|
||||
pkg_check_modules( PKG_${package} ${pkg_config_options} )
|
||||
foreach(variant ${pkg_config_options})
|
||||
pkg_check_modules( PKG_${package} ${variant} )
|
||||
|
||||
if( PKG_${package}_FOUND )
|
||||
message( STATUS "Using '${package}' system library" )
|
||||
@ -149,6 +170,7 @@ function (add_conan_lib package conan_package_name )
|
||||
message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if( allow_find_package )
|
||||
@ -160,7 +182,7 @@ function (add_conan_lib package conan_package_name )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( system_only )
|
||||
if( system_only OR NOT ${_OPT}conan_enabled )
|
||||
message( FATAL_ERROR "Failed to find the system package ${package}" )
|
||||
else()
|
||||
set( ${option_name} "local" )
|
||||
@ -237,6 +259,7 @@ function ( _conan_install build_type )
|
||||
endfunction()
|
||||
|
||||
macro( resolve_conan_dependencies )
|
||||
if( ${_OPT}conan_enabled )
|
||||
message(STATUS
|
||||
"Executing Conan: \
|
||||
REQUIRES ${CONAN_REQUIRES}
|
||||
@ -265,6 +288,7 @@ macro( resolve_conan_dependencies )
|
||||
message( FATAL_ERROR "Failed to find the conan package ${package}" )
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
file(GLOB dependency_helpers "${AUDACITY_MODULE_PATH}/dependencies/*.cmake")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user