Migrate from Conan 1 to Conan 2

This commit is contained in:
Dmitry Makarenko 2026-01-26 16:03:06 +03:00
parent 58d7406479
commit bb1a76604f
3 changed files with 53 additions and 99 deletions

View File

@ -14,108 +14,18 @@ if( CMAKE_GENERATOR MATCHES "Visual Studio" )
) )
endif() endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake"
TLS_VERIFY ON)
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
if(WIN32) if(WIN32)
add_definitions(-DUNICODE -D_UNICODE) add_definitions(-DUNICODE -D_UNICODE)
endif() endif()
set(DEPENDENCIES find_package(fmt REQUIRED)
REQUIRES find_package(SQLite3 REQUIRED)
fmt/7.1.3 find_package(SQLiteCpp REQUIRED)
sqlite3/3.40.0 find_package(gflags REQUIRED)
sqlitecpp/3.1.1 find_package(utf8cpp REQUIRED)
gflags/2.2.2 find_package(Boost REQUIRED COMPONENTS filesystem system)
utfcpp/3.2.1
boost/1.78.0
OPTIONS
boost:without_atomic=False
boost:without_chrono=True
boost:without_container=True
boost:without_context=True
boost:without_contract=True
boost:without_coroutine=True
boost:without_date_time=True
boost:without_exception=True
boost:without_fiber=True
boost:without_filesystem=False
boost:without_graph=True
boost:without_graph_parallel=True
boost:without_iostreams=True
boost:without_json=True
boost:without_locale=True
boost:without_log=True
boost:without_math=True
boost:without_mpi=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_regex=True
boost:without_serialization=True
boost:without_stacktrace=True
boost:without_system=False
boost:without_test=True
boost:without_thread=True
boost:without_timer=True
boost:without_type_erasure=True
boost:without_wave=True
)
### Setup dependecies
if(CMAKE_CONFIGURATION_TYPES)
foreach(TYPE ${CMAKE_CONFIGURATION_TYPES})
message(STATUS "Configuring packages for ${TYPE}")
conan_cmake_configure(
${DEPENDENCIES}
GENERATORS
cmake_find_package_multi
)
conan_cmake_autodetect(settings BUILD_TYPE ${TYPE})
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
SETTINGS ${settings}
)
endforeach()
else()
message(STATUS "Configuring packages for ${CMAKE_BUILD_TYPE}")
conan_cmake_configure(
${DEPENDENCIES}
GENERATORS
cmake_find_package_multi
)
conan_cmake_autodetect(settings)
conan_cmake_install(PATH_OR_REFERENCE .
BUILD missing
SETTINGS ${settings}
)
endif()
find_package(fmt CONFIG)
find_package(SQLite3 CONFIG)
find_package(SQLiteCpp CONFIG)
find_package(gflags CONFIG)
find_package(utf8cpp CONFIG)
find_package(Boost)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
@ -150,9 +60,9 @@ add_executable(audacity-project-tools
target_link_libraries(audacity-project-tools target_link_libraries(audacity-project-tools
fmt::fmt fmt::fmt
SQLite::SQLite3 SQLite::SQLite3
SQLiteCpp::SQLiteCpp SQLiteCpp
gflags::gflags gflags::gflags
utf8cpp::utf8cpp utf8cpp
Boost::boost Boost::boost
Boost::filesystem Boost::filesystem
Boost::system Boost::system

44
conanfile.txt Normal file
View File

@ -0,0 +1,44 @@
[requires]
fmt/7.1.3
sqlite3/3.45.3
sqlitecpp/3.3.3
gflags/2.2.2
utfcpp/3.2.1
boost/1.84.0
[generators]
CMakeDeps
CMakeToolchain
[options]
boost/*:without_atomic=False
boost/*:without_chrono=True
boost/*:without_container=True
boost/*:without_context=True
boost/*:without_contract=True
boost/*:without_coroutine=True
boost/*:without_date_time=True
boost/*:without_exception=True
boost/*:without_fiber=True
boost/*:without_filesystem=False
boost/*:without_graph=True
boost/*:without_graph_parallel=True
boost/*:without_iostreams=True
boost/*:without_json=True
boost/*:without_locale=True
boost/*:without_log=True
boost/*:without_math=True
boost/*:without_mpi=True
boost/*:without_nowide=True
boost/*:without_program_options=True
boost/*:without_python=True
boost/*:without_random=True
boost/*:without_regex=True
boost/*:without_serialization=True
boost/*:without_stacktrace=True
boost/*:without_system=False
boost/*:without_test=True
boost/*:without_thread=True
boost/*:without_timer=True
boost/*:without_type_erasure=True
boost/*:without_wave=True

View File

@ -1 +1 @@
conan==1.59.0 conan>=2