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/).
|
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
|
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
|
# Allow user to globally set the library preference
|
||||||
cmd_option( ${_OPT}lib_preference
|
cmd_option( ${_OPT}lib_preference
|
||||||
"Library preference [system (if available), local]"
|
"Library preference [system (if available), local]"
|
||||||
@ -510,7 +516,7 @@ resolve_conan_dependencies()
|
|||||||
|
|
||||||
add_subdirectory( "help" )
|
add_subdirectory( "help" )
|
||||||
if(${_OPT}has_crashreports)
|
if(${_OPT}has_crashreports)
|
||||||
add_subdirectory( "crashreports" )
|
add_subdirectory( "crashreports" )
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory( "images" )
|
add_subdirectory( "images" )
|
||||||
add_subdirectory( "libraries" )
|
add_subdirectory( "libraries" )
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
# Load Conan
|
# Load Conan
|
||||||
include( conan )
|
|
||||||
|
|
||||||
conan_add_remote(NAME audacity
|
if( ${_OPT}conan_enabled )
|
||||||
URL https://artifactory.audacityteam.org/artifactory/api/conan/conan-local
|
include( conan )
|
||||||
VERIFY_SSL True
|
|
||||||
)
|
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_BUILD_REQUIRES )
|
||||||
set( CONAN_REQUIRES )
|
set( CONAN_REQUIRES )
|
||||||
@ -13,23 +16,29 @@ set( CONAN_ONLY_DEBUG_RELEASE )
|
|||||||
set( CONAN_CONFIG_OPTIONS )
|
set( CONAN_CONFIG_OPTIONS )
|
||||||
set( CONAN_RESOLVE_LIST )
|
set( CONAN_RESOLVE_LIST )
|
||||||
|
|
||||||
# Add a Conan dependency
|
#[[
|
||||||
# Example usage:
|
Add a Conan dependency
|
||||||
# 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
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
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 )
|
function (add_conan_lib package conan_package_name )
|
||||||
# Extract the list of packages from the function args
|
# 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( list_mode on )
|
||||||
set( allow_find_package on )
|
set( allow_find_package on )
|
||||||
set( current_var "find_package_options" )
|
set( current_var "find_package_options" )
|
||||||
|
elseif ( opt STREQUAL "ALLOW_FIND_PACKAGE" )
|
||||||
|
set ( allow_find_package on )
|
||||||
elseif ( opt STREQUAL "CONAN_OPTIONS" )
|
elseif ( opt STREQUAL "CONAN_OPTIONS" )
|
||||||
set( list_mode on )
|
set( list_mode on )
|
||||||
set( current_var "conan_package_options" )
|
set( current_var "conan_package_options" )
|
||||||
@ -93,14 +104,23 @@ function (add_conan_lib package conan_package_name )
|
|||||||
|
|
||||||
set( option_desc "local" )
|
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" )
|
set( sysopt "system" )
|
||||||
string( PREPEND option_desc "system (if available), " )
|
string( PREPEND option_desc "system (if available), " )
|
||||||
set( default "${${_OPT}lib_preference}" )
|
|
||||||
|
if( ${_OPT}conan_enabled )
|
||||||
|
set( default "${${_OPT}lib_preference}" )
|
||||||
|
else()
|
||||||
|
set( default "system" )
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set( default "local" )
|
set( default "local" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( ${_OPT}conan_enabled )
|
||||||
|
set( localopt "local" )
|
||||||
|
endif()
|
||||||
|
|
||||||
if( NOT required )
|
if( NOT required )
|
||||||
set( reqopt "off" )
|
set( reqopt "off" )
|
||||||
string( APPEND option_desc ", off" )
|
string( APPEND option_desc ", off" )
|
||||||
@ -109,7 +129,7 @@ function (add_conan_lib package conan_package_name )
|
|||||||
cmd_option( ${option_name}
|
cmd_option( ${option_name}
|
||||||
"Use ${option_name_base} library [${option_desc}]"
|
"Use ${option_name_base} library [${option_desc}]"
|
||||||
"${default}"
|
"${default}"
|
||||||
STRINGS ${sysopt} "local" ${reqopt}
|
STRINGS ${sysopt} ${localopt} ${reqopt}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Early bail out
|
# Early bail out
|
||||||
@ -129,26 +149,28 @@ function (add_conan_lib package conan_package_name )
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( ${option_name} STREQUAL "system" )
|
if( ${option_name} STREQUAL "system" OR NOT ${_OPT}conan_enabled )
|
||||||
if( pkg_config_options )
|
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 )
|
if( PKG_${package}_FOUND )
|
||||||
message( STATUS "Using '${package}' system library" )
|
message( STATUS "Using '${package}' system library" )
|
||||||
|
|
||||||
# Create the target interface library
|
|
||||||
add_library( ${interface_name} INTERFACE IMPORTED GLOBAL)
|
|
||||||
|
|
||||||
# Retrieve the package information
|
# Create the target interface library
|
||||||
get_package_interface( PKG_${package} )
|
add_library( ${interface_name} INTERFACE IMPORTED GLOBAL)
|
||||||
|
|
||||||
# And add it to our target
|
# Retrieve the package information
|
||||||
target_include_directories( ${interface_name} INTERFACE ${INCLUDES} )
|
get_package_interface( PKG_${package} )
|
||||||
target_link_libraries( ${interface_name} INTERFACE ${LIBRARIES} )
|
|
||||||
|
# And add it to our target
|
||||||
|
target_include_directories( ${interface_name} INTERFACE ${INCLUDES} )
|
||||||
|
target_link_libraries( ${interface_name} INTERFACE ${LIBRARIES} )
|
||||||
|
|
||||||
message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}")
|
message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( allow_find_package )
|
if( allow_find_package )
|
||||||
@ -160,7 +182,7 @@ function (add_conan_lib package conan_package_name )
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( system_only )
|
if( system_only OR NOT ${_OPT}conan_enabled )
|
||||||
message( FATAL_ERROR "Failed to find the system package ${package}" )
|
message( FATAL_ERROR "Failed to find the system package ${package}" )
|
||||||
else()
|
else()
|
||||||
set( ${option_name} "local" )
|
set( ${option_name} "local" )
|
||||||
@ -237,34 +259,36 @@ function ( _conan_install build_type )
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro( resolve_conan_dependencies )
|
macro( resolve_conan_dependencies )
|
||||||
message(STATUS
|
if( ${_OPT}conan_enabled )
|
||||||
"Executing Conan: \
|
message(STATUS
|
||||||
REQUIRES ${CONAN_REQUIRES}
|
"Executing Conan: \
|
||||||
GENERATORS cmake_find_package_multi
|
REQUIRES ${CONAN_REQUIRES}
|
||||||
BUILD_REQUIRES ${CONAN_BUILD_REQUIRES}
|
GENERATORS cmake_find_package_multi
|
||||||
${CONAN_CONFIG_OPTIONS}
|
BUILD_REQUIRES ${CONAN_BUILD_REQUIRES}
|
||||||
OPTIONS ${CONAN_PACKAGE_OPTIONS}
|
${CONAN_CONFIG_OPTIONS}
|
||||||
")
|
OPTIONS ${CONAN_PACKAGE_OPTIONS}
|
||||||
|
")
|
||||||
|
|
||||||
if(MSVC OR XCODE)
|
if(MSVC OR XCODE)
|
||||||
foreach(TYPE ${CMAKE_CONFIGURATION_TYPES})
|
foreach(TYPE ${CMAKE_CONFIGURATION_TYPES})
|
||||||
_conan_install(${TYPE})
|
_conan_install(${TYPE})
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
_conan_install(${CMAKE_BUILD_TYPE})
|
_conan_install(${CMAKE_BUILD_TYPE})
|
||||||
endif()
|
|
||||||
|
|
||||||
list( REMOVE_DUPLICATES CONAN_REQUIRES )
|
|
||||||
|
|
||||||
foreach( package ${CONAN_RESOLVE_LIST} )
|
|
||||||
message(STATUS "Resolving Conan library ${package}")
|
|
||||||
|
|
||||||
find_package(${package} CONFIG)
|
|
||||||
|
|
||||||
if (NOT ${package}_FOUND)
|
|
||||||
message( FATAL_ERROR "Failed to find the conan package ${package}" )
|
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
|
||||||
|
list( REMOVE_DUPLICATES CONAN_REQUIRES )
|
||||||
|
|
||||||
|
foreach( package ${CONAN_RESOLVE_LIST} )
|
||||||
|
message(STATUS "Resolving Conan library ${package}")
|
||||||
|
|
||||||
|
find_package(${package} CONFIG)
|
||||||
|
|
||||||
|
if (NOT ${package}_FOUND)
|
||||||
|
message( FATAL_ERROR "Failed to find the conan package ${package}" )
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB dependency_helpers "${AUDACITY_MODULE_PATH}/dependencies/*.cmake")
|
file(GLOB dependency_helpers "${AUDACITY_MODULE_PATH}/dependencies/*.cmake")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user