From bb1a76604ff6ac0e51d8d4b0f0d0f1e607d3064d Mon Sep 17 00:00:00 2001 From: Dmitry Makarenko Date: Mon, 26 Jan 2026 16:03:06 +0300 Subject: [PATCH] Migrate from Conan 1 to Conan 2 --- CMakeLists.txt | 106 ++++------------------------------------------- conanfile.txt | 44 ++++++++++++++++++++ requirements.txt | 2 +- 3 files changed, 53 insertions(+), 99 deletions(-) create mode 100644 conanfile.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4611f13..8bd6088 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,108 +14,18 @@ if( CMAKE_GENERATOR MATCHES "Visual Studio" ) ) 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) if(WIN32) add_definitions(-DUNICODE -D_UNICODE) endif() -set(DEPENDENCIES - REQUIRES - fmt/7.1.3 - sqlite3/3.40.0 - sqlitecpp/3.1.1 - gflags/2.2.2 - 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) +find_package(fmt REQUIRED) +find_package(SQLite3 REQUIRED) +find_package(SQLiteCpp REQUIRED) +find_package(gflags REQUIRED) +find_package(utf8cpp REQUIRED) +find_package(Boost REQUIRED COMPONENTS filesystem system) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) @@ -150,9 +60,9 @@ add_executable(audacity-project-tools target_link_libraries(audacity-project-tools fmt::fmt SQLite::SQLite3 - SQLiteCpp::SQLiteCpp + SQLiteCpp gflags::gflags - utf8cpp::utf8cpp + utf8cpp Boost::boost Boost::filesystem Boost::system diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..da84926 --- /dev/null +++ b/conanfile.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index 74199ea..fa5603d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -conan==1.59.0 +conan>=2