From 18f4f2ae9e1280002875744e873be199b5e37c2c Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 21:26:09 +0000 Subject: [PATCH 01/15] feat: conan --- CMakeLists.txt | 5 ++ conanfile.py | 70 +++++++++++++++++++++++++++ library/CMakeLists.txt | 105 ++++++++++++++++++++++++----------------- 3 files changed, 137 insertions(+), 43 deletions(-) create mode 100644 conanfile.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 31b14d70ad..5be0c19a30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ option(RUN_LDCONFIG "Run ldconfig after installation" ON) option(DPP_INSTALL "Generate the install target" ON) option(DPP_BUILD_TEST "Build the test program" ON) option(DPP_NO_VCPKG "No VCPKG" OFF) +option(DPP_NO_CONAN "No Conan" OFF) option(DPP_CORO "Support for C++20 coroutines" OFF) option(DPP_FORMATTERS "Support for C++20 formatters" OFF) option(DPP_USE_EXTERNAL_JSON "Use an external installation of nlohmann::json" OFF) @@ -64,6 +65,10 @@ else() endif() endif() +if (DPP_NO_CONAN) + message("-- INFO: Explicitly disabling Conan as running inside the CI action.") +endif() + if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS) message("-- INFO: Configuring .rc resource script") configure_file("${DPP_ROOT_PATH}/src/dpp/dpp.rc.in" "${DPP_ROOT_PATH}/src/dpp/dpp.rc" NEWLINE_STYLE WIN32) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000..f14d40628d --- /dev/null +++ b/conanfile.py @@ -0,0 +1,70 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.scm import Git +from conan.tools.files import update_conandata + +class DPPConan(ConanFile): + name = "dpp" + version = "10.0.33" + default_user = "brainboxdotcc" + default_channel = "testing" + license = "https://github.com/brainboxdotcc/DPP/blob/master/LICENSE" + url = "https://github.com/brainboxdotcc/DPP" + description = "D++ is a lightweight and efficient library for Discord" + topics = ("discord") + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + def requirements(self): + self.requires("nlohmann_json/3.11.2") + self.requires("openssl/3.1.2") + self.requires("zlib/1.3") + self.requires("opus/1.4") + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self) + + def export(self): + git = Git(self, os.path.dirname(self.recipe_folder)) + scm_url, scm_commit = git.get_url_and_commit() + update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) + + def source(self): + git = Git(self) + sources = self.conan_data["sources"] + git.clone(url=sources["url"], target=".") + git.checkout(commit=sources["commit"]) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self) + tc.cache_variables["CONAN_EXPORTED"] = True + tc.cache_variables["BUILD_VOICE_SUPPORT"] = True + tc.cache_variables["DPP_BUILD_TEST"] = False + tc.cache_variables["BUILD_SHARED_LIBS"] = True + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["dpp"] + self.cpp_info.includedirs = ["include/dpp-10.0"] + self.cpp_info.libdirs = ["lib/dpp-10.0"] diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index d631d61f31..aaeac5672a 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -67,7 +67,14 @@ else() message("-- Building ${Green}dynamic${ColourReset} library.") endif() - +if (CONAN_EXPORTED) + message("-- INFO: ${Green}Conan detected${ColourReset}... finding packages...") + find_package(OpenSSL REQUIRED COMPONENTS SSL Crypto) + find_package(ZLIB REQUIRED) + find_package(Opus) + find_package(Threads REQUIRED) + find_package(Git QUIET) +endif() if(WIN32 AND NOT MINGW) # Fake an ssl version number to satisfy MLSPP @@ -75,23 +82,25 @@ if(WIN32 AND NOT MINGW) if (NOT WINDOWS_32_BIT) message("-- Building for windows with precompiled packaged dependencies") #set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - set(ZLIB_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib") - set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") - set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") - set(OPENSSL_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib") - #ADD_DEFINITIONS(/bigobj) - - link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/libssl.lib") - link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/libcrypto.lib") - link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/zlib.lib") - link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/opus.lib") - - set(OPUS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") - set(OPUS_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/opus.lib") - set(HAVE_OPUS_OPUS_H "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include/opus/opus.h") - set(OPUS_FOUND 1) + if (NOT CONAN_EXPORTED) + set(ZLIB_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib") + set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") + set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") + set(OPENSSL_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib") + + link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/libssl.lib") + link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/libcrypto.lib") + link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/zlib.lib") + link_libraries("${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/opus.lib") + + set(OPUS_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") + set(OPUS_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/opus.lib") + set(HAVE_OPUS_OPUS_H "${CMAKE_CURRENT_SOURCE_DIR}/../win32/include/opus/opus.h") + + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") + endif() - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../win32/include") + set(OPUS_FOUND 1) add_compile_options("/bigobj") add_compile_definitions(OPENSSL_SYS_WIN32) @@ -154,31 +163,39 @@ string(ASCII 27 Esc) set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) +if (NOT CONAN_EXPORTED) + find_package(Threads REQUIRED) +endif() if(MINGW OR NOT WIN32) - find_package(ZLIB REQUIRED) + if (NOT CONAN_EXPORTED) + find_package(ZLIB REQUIRED) + endif() message("-- ZLIB: ${Green}${ZLIB_LIBRARIES}${ColourReset}") endif(MINGW OR NOT WIN32) -if(APPLE) - if(CMAKE_APPLE_SILICON_PROCESSOR EQUAL arm64) - set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/openssl") - else() - set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") - endif() - find_package(OpenSSL REQUIRED) -else() - if(MINGW OR NOT WIN32) - if(NOT BUILD_SHARED_LIBS) - set(OPENSSL_USE_STATIC_LIBS TRUE) +if (NOT CONAN_EXPORTED) + if(APPLE) + if(CMAKE_APPLE_SILICON_PROCESSOR EQUAL arm64) + set(OPENSSL_ROOT_DIR "/opt/homebrew/opt/openssl") + else() + set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif() find_package(OpenSSL REQUIRED) + else() + if(MINGW OR NOT WIN32) + if(NOT BUILD_SHARED_LIBS) + set(OPENSSL_USE_STATIC_LIBS TRUE) + endif() + find_package(OpenSSL REQUIRED) + endif() endif() endif() include_directories(${OPENSSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS}) -find_package(Git QUIET) +if (NOT CONAN_EXPORTED) + find_package(Git QUIET) +endif() if(NOT GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git") message(FATAL_ERROR "You are using a git version of D++ but do not have git installed. Install git (not 'gh') and try again.") @@ -435,18 +452,20 @@ if (DPP_BUILD_TEST) COMMAND unittest ) endif() - -if(WIN32 AND NOT MINGW) - if (NOT WINDOWS_32_BIT) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/zlib1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/libcrypto-1_1-x64.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/libssl-1_1-x64.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/opus.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - else() - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/zlib1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/libcrypto-1_1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/libssl-1_1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/opus.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + +if (NOT CONAN_EXPORTED) + if(WIN32 AND NOT MINGW) + if (NOT WINDOWS_32_BIT) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/zlib1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/libcrypto-1_1-x64.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/libssl-1_1-x64.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/bin/opus.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + else() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/zlib1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/libcrypto-1_1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/libssl-1_1.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../win32/32/bin/opus.dll" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COPYONLY) + endif() endif() endif() From 45c8a378ea8d9d3bb4920aa93185afc072bbc025 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:18:11 +0000 Subject: [PATCH 02/15] feat: conan the librarian --- CMakeLists.txt | 1 + conanfile.py | 19 ++++++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5be0c19a30..18b54f5d15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(DPP_INSTALL "Generate the install target" ON) option(DPP_BUILD_TEST "Build the test program" ON) option(DPP_NO_VCPKG "No VCPKG" OFF) option(DPP_NO_CONAN "No Conan" OFF) +option(CONAN_EXPORTED "Exported via Conan - DO NOT SET MANUALLY" OFF) option(DPP_CORO "Support for C++20 coroutines" OFF) option(DPP_FORMATTERS "Support for C++20 formatters" OFF) option(DPP_USE_EXTERNAL_JSON "Use an external installation of nlohmann::json" OFF) diff --git a/conanfile.py b/conanfile.py index f14d40628d..6137c2dd0c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,8 +1,9 @@ import os +import shutil from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.scm import Git -from conan.tools.files import update_conandata +from conan.tools.files import update_conandata, download, unzip class DPPConan(ConanFile): name = "dpp" @@ -15,7 +16,7 @@ class DPPConan(ConanFile): topics = ("discord") settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + default_options = {"shared": True, "fPIC": True} def requirements(self): self.requires("nlohmann_json/3.11.2") @@ -34,16 +35,12 @@ def configure(self): def layout(self): cmake_layout(self) - def export(self): - git = Git(self, os.path.dirname(self.recipe_folder)) - scm_url, scm_commit = git.get_url_and_commit() - update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) - def source(self): - git = Git(self) - sources = self.conan_data["sources"] - git.clone(url=sources["url"], target=".") - git.checkout(commit=sources["commit"]) + zip_name = f"DPP.zip" + download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) + unzip(self, zip_name, '.', False, None, True) + # shutil.move(f"DPP-{self.version}", f"DPP-{self.version}/../") + os.unlink(zip_name) def generate(self): deps = CMakeDeps(self) From b219e07bae22172a35dd7340ebeb9fede4c2e942 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:38:24 +0000 Subject: [PATCH 03/15] feat: conan --- conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 6137c2dd0c..ee843a850a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -35,11 +35,15 @@ def configure(self): def layout(self): cmake_layout(self) + def export(self): + git = Git(self, self.recipe_folder) + scm_url, scm_commit = git.get_url_and_commit() + update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) + def source(self): zip_name = f"DPP.zip" download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) unzip(self, zip_name, '.', False, None, True) - # shutil.move(f"DPP-{self.version}", f"DPP-{self.version}/../") os.unlink(zip_name) def generate(self): From a486bc79f9b44dc3f1f103066f93027695482cc3 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:47:01 +0000 Subject: [PATCH 04/15] validator --- conanfile.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/conanfile.py b/conanfile.py index ee843a850a..37030faef0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,10 +1,14 @@ import os import shutil from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.scm import Git from conan.tools.files import update_conandata, download, unzip +required_conan_version = ">=2.0" + class DPPConan(ConanFile): name = "dpp" version = "10.0.33" @@ -18,6 +22,29 @@ class DPPConan(ConanFile): options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": True, "fPIC": True} + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "11", + "apple-clang": "14", + "Visual Studio": "17", + "msvc": "193", + } + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + def requirements(self): self.requires("nlohmann_json/3.11.2") self.requires("openssl/3.1.2") From b304bd7509f5ad80214202592042c1568e5cb7ab Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:47:52 +0000 Subject: [PATCH 05/15] version --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 37030faef0..768ba17348 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,7 +4,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps -from conan.tools.scm import Git +from conan.tools.scm import Git, Version from conan.tools.files import update_conandata, download, unzip required_conan_version = ">=2.0" From 311b742b1e3b7a7c3fa76a8ae2e5ac37f336dfdf Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 22:53:30 +0000 Subject: [PATCH 06/15] conannnn --- library/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index aaeac5672a..f25ceb1dfe 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -280,7 +280,7 @@ foreach (fullmodname ${subdirlist}) ) endif() - if (WIN32 AND NOT MINGW) + if (WIN32 AND NOT MINGW AND NOT CONAN_EXPORTED) if (NOT WINDOWS_32_BIT) target_link_libraries(${modname} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../win32/lib/libssl.lib" @@ -295,7 +295,11 @@ foreach (fullmodname ${subdirlist}) endif() else() - target_link_libraries(${modname} PUBLIC ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${ZLIB_LIBRARIES}) + if (CONAN_EXPORTED) + target_link_libraries(${modname} PUBLIC nlohmann_json::nlohmann_json openssl::openssl ZLIB::ZLIB Opus::opus) + else() + target_link_libraries(${modname} PUBLIC ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${ZLIB_LIBRARIES}) + endif() if (MINGW) target_link_libraries(${modname} PUBLIC wsock32 ws2_32 crypt32) endif () From 241ffba3ee7498117708b22227624b73646cec4f Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Wed, 23 Oct 2024 23:01:20 +0000 Subject: [PATCH 07/15] fix: satisfy codacy --- conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 768ba17348..bafe3e4578 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,5 +1,4 @@ import os -import shutil from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd @@ -68,7 +67,7 @@ def export(self): update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) def source(self): - zip_name = f"DPP.zip" + zip_name = "DPP.zip" download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) unzip(self, zip_name, '.', False, None, True) os.unlink(zip_name) From cd5e0f275f341449002faee0bb0ecabdf5152361 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Thu, 24 Oct 2024 13:21:58 +0000 Subject: [PATCH 08/15] conanfile improvements --- conanfile.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/conanfile.py b/conanfile.py index bafe3e4578..aaf553b93b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,9 +1,8 @@ import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps -from conan.tools.scm import Git, Version +from conan.tools.scm import Git from conan.tools.files import update_conandata, download, unzip required_conan_version = ">=2.0" @@ -11,9 +10,7 @@ class DPPConan(ConanFile): name = "dpp" version = "10.0.33" - default_user = "brainboxdotcc" - default_channel = "testing" - license = "https://github.com/brainboxdotcc/DPP/blob/master/LICENSE" + license = "Apache-2.0" url = "https://github.com/brainboxdotcc/DPP" description = "D++ is a lightweight and efficient library for Discord" topics = ("discord") @@ -25,24 +22,9 @@ class DPPConan(ConanFile): def _min_cppstd(self): return 17 - @property - def _compilers_minimum_version(self): - return { - "gcc": "8", - "clang": "11", - "apple-clang": "14", - "Visual Studio": "17", - "msvc": "193", - } - def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." - ) def requirements(self): self.requires("nlohmann_json/3.11.2") @@ -63,8 +45,7 @@ def layout(self): def export(self): git = Git(self, self.recipe_folder) - scm_url, scm_commit = git.get_url_and_commit() - update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) + git.coordinates_to_conandata() def source(self): zip_name = "DPP.zip" From 4f1e65f9c1dc5b0e40ffd6d8ecb98da5c8fb6e61 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Thu, 24 Oct 2024 13:26:11 +0000 Subject: [PATCH 09/15] =?UTF-8?q?chore:=20make=20codacy=20happy=20?= =?UTF-8?q?=F0=9F=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index aaf553b93b..9ed80addc5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps from conan.tools.scm import Git -from conan.tools.files import update_conandata, download, unzip +from conan.tools.files import download, unzip required_conan_version = ">=2.0" From 68a5827a1c71cfa11d8ea8559ab0b28cedd2ff78 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Thu, 24 Oct 2024 13:49:31 +0000 Subject: [PATCH 10/15] bump version in prep for next release when we can use conan [skip ci] --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 9ed80addc5..ae40de49e0 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class DPPConan(ConanFile): name = "dpp" - version = "10.0.33" + version = "10.0.34" license = "Apache-2.0" url = "https://github.com/brainboxdotcc/DPP" description = "D++ is a lightweight and efficient library for Discord" From a73e4ad6e249616ebf4f64b92e877e27a7da4363 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 25 Oct 2024 10:38:34 +0000 Subject: [PATCH 11/15] testing var --- conanfile.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/conanfile.py b/conanfile.py index ae40de49e0..ff93ea9ff7 100644 --- a/conanfile.py +++ b/conanfile.py @@ -48,10 +48,14 @@ def export(self): git.coordinates_to_conandata() def source(self): - zip_name = "DPP.zip" - download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) - unzip(self, zip_name, '.', False, None, True) - os.unlink(zip_name) + if 'DPP_CONAN_TESTING' in os.environ: + git.clone(url="https://github.com/brainboxdotcc/DPP.git", target=".") + git.checkout(commit="conan-the-librarian") + zip_name = "DPP.zip" + else: + download(self, f"https://github.com/brainboxdotcc/DPP/archive/refs/tags/v{self.version}.zip", zip_name) + unzip(self, zip_name, '.', False, None, True) + os.unlink(zip_name) def generate(self): deps = CMakeDeps(self) From 723efdcfc3715c658f724cac07366a674f99c18e Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 25 Oct 2024 10:39:11 +0000 Subject: [PATCH 12/15] testing var --- conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conanfile.py b/conanfile.py index ff93ea9ff7..947ea1e18b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -49,6 +49,7 @@ def export(self): def source(self): if 'DPP_CONAN_TESTING' in os.environ: + git = Git(self) git.clone(url="https://github.com/brainboxdotcc/DPP.git", target=".") git.checkout(commit="conan-the-librarian") zip_name = "DPP.zip" From 2f551a8d7e15d801d92cc37613d1ab87f5eba079 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 25 Oct 2024 11:00:49 +0000 Subject: [PATCH 13/15] testing var --- library/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index f25ceb1dfe..c9714b0083 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -296,7 +296,7 @@ foreach (fullmodname ${subdirlist}) else() if (CONAN_EXPORTED) - target_link_libraries(${modname} PUBLIC nlohmann_json::nlohmann_json openssl::openssl ZLIB::ZLIB Opus::opus) + target_link_libraries(${modname} PUBLIC openssl::openssl ZLIB::ZLIB Opus::opus) else() target_link_libraries(${modname} PUBLIC ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${ZLIB_LIBRARIES}) endif() From 8ab2572aeb98eacc51bd014e69f3aeef35e7cb63 Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 25 Oct 2024 11:21:53 +0000 Subject: [PATCH 14/15] docs: document testing var --- conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conanfile.py b/conanfile.py index 947ea1e18b..32570b1388 100644 --- a/conanfile.py +++ b/conanfile.py @@ -48,6 +48,10 @@ def export(self): git.coordinates_to_conandata() def source(self): + # This environment variable should only be set by D++ library developers to ensure that conan builds succeed + # without having to wait for release. It will check out the development branch where conanfile.py is being + # developed and tested. If you are NOT sure what this does, DO NOT SET IT. You won't get the D++ release + # you expect! if 'DPP_CONAN_TESTING' in os.environ: git = Git(self) git.clone(url="https://github.com/brainboxdotcc/DPP.git", target=".") From a9b007a88ef60ae3eb261c78d0d7ab2ad90de83d Mon Sep 17 00:00:00 2001 From: Craig Edwards Date: Fri, 25 Oct 2024 11:53:32 +0000 Subject: [PATCH 15/15] really codacy? whinge about trailing whitespace on a COMMENT is just petty --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 32570b1388..0c45bf906c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -49,7 +49,7 @@ def export(self): def source(self): # This environment variable should only be set by D++ library developers to ensure that conan builds succeed - # without having to wait for release. It will check out the development branch where conanfile.py is being + # without having to wait for release. It will check out the development branch where conanfile.py is being # developed and tested. If you are NOT sure what this does, DO NOT SET IT. You won't get the D++ release # you expect! if 'DPP_CONAN_TESTING' in os.environ: