1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 17:23:12 +02:00

Migrate the Windows dependencies to Conan 2.

[skip alpine ci]
[skip ubuntu ci]
This commit is contained in:
Sadie Powell
2026-02-07 14:28:45 +00:00
parent bd72a444df
commit e7aa0cb583
7 changed files with 49 additions and 45 deletions
+16 -12
View File
@@ -14,8 +14,7 @@ jobs:
runs-on: windows-2025
env:
BUILD_TYPE: ${{ github.event_name == 'release' && 'Release' || 'Debug' }}
CONAN_USER_HOME: ${{ github.workspace }}/win/build
CONAN_USER_HOME_SHORT: None
CONAN_HOME: ${{ github.workspace }}\build\conan
steps:
- uses: actions/checkout@v6
@@ -28,32 +27,37 @@ jobs:
- name: Setup Conan
uses: turtlebrowser/get-conan@v1.2
with:
version: 1.66.0
- name: Create Conan profile
run: |-
conan profile detect
(Get-Content ${{ env.CONAN_HOME }}\profiles\default).replace('build_type=Release', 'build_type=${{ env.BUILD_TYPE }}') | Set-Content ${{ env.CONAN_HOME }}\profiles\default
(Get-Content ${{ env.CONAN_HOME }}\profiles\default).replace('compiler.cppstd=14', 'compiler.cppstd=17') | Set-Content ${{ env.CONAN_HOME }}\profiles\default
Write-Output 'core.sources:download_urls=["origin", "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/"]' | Out-File -Append ${{ env.CONAN_HOME }}\global.conf
- name: Try to restore libraries from the cache
uses: actions/cache/restore@v5
id: library-cache
with:
key: conan-${{ hashFiles('src/win32/conanfile.txt') }}
path: ${{ env.CONAN_USER_HOME }}/.conan
key: conan-${{ env.BUILD_TYPE }}-${{ hashFiles('src\win32\conanfile.txt') }}
path: ${{ env.CONAN_HOME }}\p
- name: Install libraries
run: |
conan install ${{ github.workspace }}\src\win32 --build=missing
(Get-Content ${{ github.workspace }}\src\win32\conanfile.txt).replace('##', '') | Set-Content ${{ github.workspace }}\src\win32\conanfile.txt
conan install ${{ github.workspace }}\src\win32 --build missing --deployer runtime_deploy --deployer-folder ${{ github.workspace }}\build\extradll --output-folder .
- name: Save libraries to the cache
if: ${{ steps.library-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v5
with:
key: ${{ steps.library-cache.outputs.cache-primary-key }}
path: ${{ env.CONAN_USER_HOME }}/.conan
key: ${{ steps.library-cache.outputs.cache-primary-key }}
path: ${{ env.CONAN_HOME }}\p
- name: Run CMake
working-directory: ${{ github.workspace }}\build
run: |
mkdir ${{ github.workspace }}\build
cd ${{ github.workspace }}\build
cmake -A x64 -D "CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}" -G "Visual Studio 17 2022" ..
cmake -A x64 -D "CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}" -D CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -G "Visual Studio 17 2022" ..
- name: Build Anope
working-directory: ${{ github.workspace }}\build
+4 -7
View File
@@ -25,7 +25,10 @@ include(CheckFunctionExists)
include(CheckTypeSize)
include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
include(FindPkgConfig)
if(NOT WIN32)
include(FindPkgConfig)
endif()
# If extra include directories were specified, tell cmake about them.
if(EXTRA_INCLUDE)
@@ -37,12 +40,6 @@ if(EXTRA_LIBS)
link_directories(${EXTRA_LIBS})
endif()
# setup conan
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
conan_basic_setup(TARGETS)
endif()
# Find gettext
find_package(Gettext)
find_package(Intl)
+8 -7
View File
@@ -4,9 +4,10 @@ if(WIN32)
endif()
# enable extra modules if conan is used
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
if(WIN32 AND DEFINED CMAKE_TOOLCHAIN_FILE)
function(enable_extra NAME PACKAGE)
if(DEFINED "CONAN_${PACKAGE}_ROOT")
find_package(${PACKAGE})
if(${PACKAGE}_FOUND)
message("Enabling the ${NAME} module")
# copy the modules out of extra so it gets picked up by build_modules
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -19,16 +20,16 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()
enable_extra("enc_argon2" "ARGON2")
enable_extra("mysql" "LIBMYSQLCLIENT")
enable_extra("enc_argon2" "argon2")
enable_extra("mysql" "libmysqlclient")
enable_extra("regex_pcre2" "PCRE2")
enable_extra("sqlite" "SQLITE3")
enable_extra("ssl_openssl" "OPENSSL")
enable_extra("sqlite" "SQLite3")
enable_extra("ssl_openssl" "OpenSSL")
# this uses Wldap so should always be available
copy_extra("ldap")
# Package extra dlls
file(GLOB EXTRA_DLLS "${Anope_SOURCE_DIR}/extradll/bin/*.dll" "${Anope_SOURCE_DIR}/extradll/lib/*.dll")
file(GLOB EXTRA_DLLS "${PROJECT_BINARY_DIR}/extradll/*.dll")
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
endif()
+2 -1
View File
@@ -14,7 +14,8 @@
/// BEGIN CMAKE
/// if(WIN32)
/// target_link_libraries(${SO} PRIVATE CONAN_PKG::argon2)
/// find_package("argon2" REQUIRED)
/// target_link_libraries(${SO} PRIVATE "argon2::argon2")
/// else()
/// pkg_check_modules("ARGON2" IMPORTED_TARGET REQUIRED "libargon2")
/// target_link_libraries(${SO} PRIVATE PkgConfig::ARGON2)
+2 -1
View File
@@ -14,7 +14,8 @@
/// BEGIN CMAKE
/// if(WIN32)
/// target_link_libraries(${SO} PRIVATE CONAN_PKG::libmysqlclient)
/// find_package("libmysqlclient" REQUIRED)
/// target_link_libraries(${SO} PRIVATE "libmysqlclient::libmysqlclient")
/// else()
/// pkg_search_module("MYSQL" IMPORTED_TARGET REQUIRED "mysqlclient" "mariadb")
/// target_link_libraries(${SO} PRIVATE PkgConfig::MYSQL)
+2 -1
View File
@@ -14,7 +14,8 @@
/// BEGIN CMAKE
/// if(WIN32)
/// target_link_libraries(${SO} PRIVATE CONAN_PKG::pcre2)
/// find_package("PCRE2" REQUIRED)
/// target_link_libraries(${SO} PRIVATE "pcre2::pcre2")
/// else()
/// pkg_check_modules("PCRE2" IMPORTED_TARGET REQUIRED "libpcre2-8")
/// target_link_libraries(${SO} PRIVATE PkgConfig::PCRE2)
+15 -16
View File
@@ -1,23 +1,22 @@
[requires]
argon2/20190702
gettext/0.26
libgettext/0.26
libmysqlclient/8.1.0
openssl/3.2.1
pcre2/10.42
sqlite3/3.45.1
gettext/0.21
libgettext/0.22
openssl/3.6.1
pcre2/10.44
sqlite3/3.51.0
[options]
argon2/*:shared=True
libmysqlclient/*:shared=True
openssl/*:shared=True
pcre2/*:shared=True
sqlite3/*:shared=True
libgettext/*:shared=True
[imports]
., *.dll -> extradll
., *.lib -> extralib
*/*:shared=True
libiconv/*:shared=False # Shared libiconv causes linker errors
openssl/*:no_apps=True
openssl/*:no_legacy=True
pcre2/*:build_pcre2_16=False
pcre2/*:build_pcre2_32=False
pcre2/*:build_pcre2grep=False
sqlite3/*:build_executable=False
[generators]
cmake
CMakeDeps
CMakeToolchain