mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-16 15:41:11 +02:00
Add the first Conan-based dependecies
add_conan_lib cmake function is defined, that allows to add a dependency using Conan with two possible system fallbacks: 1. pkg_check_modules is invoked, if `PGK_CONFIG ...` is present 2. find_package is invoked if `FIND_PACKAGE_OPTIONS` is present and `pkg_check_modules` has failed If `ALWAYS_ALLOW_CONAN_FALLBACK` is present - `obey_system_dependencies` will be ignored for the package Currently, the following dependencies are retrieved using Conan: * zlib * expat * wxwidgets * libmp3lame * libid3tag * libmad The last three libraries are included in this commit, as they depend on zlib. Properly pass **arch** and **os.version** to Conan
This commit is contained in:
94
cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake
Normal file
94
cmake-proxies/cmake-modules/dependencies/wxwidgets.cmake
Normal file
@@ -0,0 +1,94 @@
|
||||
if( ${_OPT}use_wxwidgets STREQUAL "system" )
|
||||
if( NOT TARGET wxwidgets::wxwidgets )
|
||||
add_library( wxwidgets::wxwidgets INTERFACE IMPORTED GLOBAL)
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::base )
|
||||
add_library( wxwidgets::base ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::core )
|
||||
add_library( wxwidgets::core ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::html )
|
||||
add_library( wxwidgets::html ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::xml )
|
||||
add_library( wxwidgets::xml ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::xrc )
|
||||
add_library( wxwidgets::xrc ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::qa )
|
||||
add_library( wxwidgets::qa ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::aui )
|
||||
add_library( wxwidgets::aui ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::adv )
|
||||
add_library( wxwidgets::adv ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( NOT TARGET wxwidgets::wxwidgets )
|
||||
add_library( wxwidgets::wxwidgets ALIAS wxwidgets::wxwidgets )
|
||||
endif()
|
||||
|
||||
if( wxWidgets_INCLUDE_DIRS_NO_SYSTEM )
|
||||
target_include_directories( wxwidgets::wxwidgets INTERFACE ${wxWidgets_INCLUDE_DIRS_NO_SYSTEM} )
|
||||
else()
|
||||
target_include_directories( wxwidgets::wxwidgets INTERFACE ${wxWidgets_INCLUDE_DIRS} )
|
||||
endif()
|
||||
|
||||
target_compile_definitions( wxwidgets::wxwidgets INTERFACE
|
||||
${wxWidgets_DEFINITIONS_GENERAL}
|
||||
$<$<CONFIG:Debug>:
|
||||
${wxWidgets_DEFINITIONS_DEBUG}
|
||||
>
|
||||
$<$<NOT:$<CONFIG:Debug>>:
|
||||
${wxWidgets_DEFINITIONS_OPTIMIZED}
|
||||
>
|
||||
)
|
||||
|
||||
target_link_directories( wxwidgets::wxwidgets INTERFACE
|
||||
$<$<PLATFORM_ID:Windows>:
|
||||
${wxWidgets_LIB_DIR}
|
||||
>
|
||||
)
|
||||
|
||||
target_link_libraries( wxwidgets::wxwidgets INTERFACE
|
||||
${wxWidgets_LIBRARIES}
|
||||
$<$<NOT:$<PLATFORM_ID:Windows>>:
|
||||
z
|
||||
>
|
||||
)
|
||||
|
||||
set( toolkit "${wxWidgets_LIBRARIES}" )
|
||||
|
||||
if( "${toolkit}" MATCHES ".*gtk2.*" )
|
||||
set( gtk gtk+-2.0 )
|
||||
set( glib glib-2.0 )
|
||||
elseif( "${toolkit}" MATCHES ".*gtk3.*" )
|
||||
set( gtk gtk+-3.0 )
|
||||
set( glib glib-2.0 )
|
||||
elseif( "${toolkit}" MATCHES ".*gtk4.*" )
|
||||
set( gtk gtk+-4.0 )
|
||||
set( glib glib-2.0 )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Darwin" )
|
||||
|
||||
if( NOT DEFINED gtk )
|
||||
set( gtk gtk+-2.0 )
|
||||
set( glib glib-2.0 )
|
||||
endif()
|
||||
|
||||
pkg_check_modules( GTK REQUIRED IMPORTED_TARGET GLOBAL ${gtk} )
|
||||
pkg_check_modules( GLIB REQUIRED IMPORTED_TARGET GLOBAL ${glib} )
|
||||
endif()
|
39
cmake-proxies/cmake-modules/dependencies/zlib.cmake
Normal file
39
cmake-proxies/cmake-modules/dependencies/zlib.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
# ZLib is a very popular library to use.
|
||||
# Some of the dependecies do not check for the system libraries,
|
||||
# which can be problematic.
|
||||
# We need to call find_package once again.
|
||||
if (${_OPT}use_zlib STREQUAL "system")
|
||||
message(STATUS "Fixing up ZLib mess...")
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
|
||||
|
||||
if(ZLIB_LIBRARY_RELEASE)
|
||||
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
|
||||
set_property(TARGET ZLIB::ZLIB
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${ZLIB_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_LIBRARY_DEBUG)
|
||||
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
|
||||
set_property(TARGET ZLIB::ZLIB
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${ZLIB_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
|
||||
set_property(TARGET ZLIB::ZLIB
|
||||
PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${ZLIB_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
Reference in New Issue
Block a user