diff options
| author | 2025-04-17 01:49:50 +0100 | |
|---|---|---|
| committer | 2025-04-17 15:50:04 +0100 | |
| commit | b439a5c6c77e1a9968ba555ad046239e7b99d813 (patch) | |
| tree | 39193663c6cc81db5f142d49102e736e04b0bc85 | |
| parent | Fix freeing the psl library when cloak_sha256 is unloaded. (diff) | |
Migrate the Windows build to Conan 2.
[skip alpine ci]
[skip irctest ci]
[skip macos ci]
[skip ubuntu ci]
| -rw-r--r-- | .github/workflows/ci-windows.yml | 25 | ||||
| -rw-r--r-- | src/modules/extra/m_geo_maxmind.cpp | 3 | ||||
| -rw-r--r-- | src/modules/extra/m_log_json.cpp | 1 | ||||
| -rw-r--r-- | src/modules/extra/m_mysql.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_regex_pcre2.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_regex_posix.cpp | 1 | ||||
| -rw-r--r-- | src/modules/extra/m_sqlite3.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 4 | ||||
| -rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_cloak_sha256.cpp | 1 | ||||
| -rw-r--r-- | win/.gitignore | 1 | ||||
| -rw-r--r-- | win/build.ps1 | 4 | ||||
| -rw-r--r-- | win/conanfile.txt | 41 | ||||
| -rw-r--r-- | win/modules/CMakeLists.txt | 49 |
14 files changed, 62 insertions, 82 deletions
diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index abe0c7cf5..4bf3d8aea 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -12,8 +12,8 @@ jobs: if: "!contains(github.event.head_commit.message, '[skip windows ci]')" runs-on: windows-2025 env: - CONAN_USER_HOME: ${{ github.workspace }}/win/build - CONAN_USER_HOME_SHORT: None + BUILD_TYPE: ${{ github.event_name == 'release' && 'Release' || 'Debug' }} + CONAN_HOME: ${{ github.workspace }}/win/build/conan steps: - uses: actions/checkout@v4 @@ -28,40 +28,45 @@ 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@v4 id: library-cache with: - key: conan-${{ hashFiles('win/conanfile.txt') }} - path: ${{ env.CONAN_USER_HOME }}/.conan + key: conan-${{ env.BUILD_TYPE }}-${{ hashFiles('win/conanfile.txt') }} + path: ${{ env.CONAN_HOME }} - name: Install libraries working-directory: ${{ github.workspace }}/win/build run: | (Get-Content ../conanfile.txt).replace('##', '') | Set-Content ../conanfile.txt - conan install .. --build=missing + conan install .. --build missing --deployer runtime_deploy --deployer-folder extradll --output-folder . - name: Save libraries to the cache if: ${{ steps.library-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v4 with: key: ${{ steps.library-cache.outputs.cache-primary-key }} - path: ${{ env.CONAN_USER_HOME }}/.conan + path: ${{ env.CONAN_HOME }} - name: Run CMake working-directory: ${{ github.workspace }}/win/build env: LDFLAGS: /DEBUG:FASTLINK /INCREMENTAL run: | - cmake -A x64 -D CMAKE_BUILD_TYPE=${{ github.event_name == 'release' && 'Release' || 'Debug' }} -G "Visual Studio 17 2022" -Wdev .. + cmake -A x64 -D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -D CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -G "Visual Studio 17 2022" -Wdev .. - name: Build InspIRCd working-directory: ${{ github.workspace }}/win/build run: | - msbuild PACKAGE.vcxproj /M:5 /P:Configuration=${{ github.event_name == 'release' && 'Release' || 'Debug' }} /P:Platform=x64 /VERBOSITY:MINIMAL + msbuild PACKAGE.vcxproj /M:5 /P:Configuration=${{ env.BUILD_TYPE }} /P:Platform=x64 /VERBOSITY:MINIMAL - name: Upload installer if: "${{ github.event_name == 'release' }}" diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index f8123df8a..ec7cabc1f 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -26,9 +26,6 @@ /// $PackageInfo: require_system("debian~") libmaxminddb-dev pkg-config /// $PackageInfo: require_system("rhel~") libmaxminddb-devel pkgconfig -#ifdef _WIN32 -# pragma comment(lib, "maxminddb.lib") -#endif #include <maxminddb.h> diff --git a/src/modules/extra/m_log_json.cpp b/src/modules/extra/m_log_json.cpp index 66aaea6e6..3628e3645 100644 --- a/src/modules/extra/m_log_json.cpp +++ b/src/modules/extra/m_log_json.cpp @@ -28,7 +28,6 @@ #ifdef _WIN32 # define HAS_YYJSON -# pragma comment(lib, "yyjson.lib") #endif #ifdef HAS_YYJSON diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 290a862fe..29271e204 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -43,10 +43,6 @@ #include "threadsocket.h" #include "utility/string.h" -#ifdef _WIN32 -# pragma comment(lib, "libmysql.lib") -#endif - /* VERSION 3 API: With nonblocking (threaded) requests */ /* THE NONBLOCKING MYSQL API! diff --git a/src/modules/extra/m_regex_pcre2.cpp b/src/modules/extra/m_regex_pcre2.cpp index 08605e2f2..f296068ab 100644 --- a/src/modules/extra/m_regex_pcre2.cpp +++ b/src/modules/extra/m_regex_pcre2.cpp @@ -32,10 +32,6 @@ #define PCRE2_CODE_UNIT_WIDTH 8 #include <pcre2.h> -#ifdef _WIN32 -# pragma comment(lib, "pcre2-8.lib") -#endif - class PCREPattern final : public Regex::Pattern { diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index f387ddc4f..1118a2842 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -22,7 +22,6 @@ #ifdef _WIN32 # include "pcre2posix.h" -# pragma comment(lib, "pcre2-posix.lib") #else # include <regex.h> # include <sys/types.h> diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index ca6e4dbc2..24903aa51 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -39,10 +39,6 @@ #include <sqlite3.h> -#ifdef _WIN32 -# pragma comment(lib, "sqlite3.lib") -#endif - class SQLConn; typedef insp::flat_map<std::string, SQLConn*> ConnMap; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 2e2da3ab2..42e120cb1 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -58,10 +58,6 @@ # define GNUTLS_AUTO_DH #endif -#ifdef _WIN32 -# pragma comment(lib, "libgnutls-30.lib") -#endif - static Module* thismod; namespace GnuTLS diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 149486e19..4a62ab316 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -51,8 +51,6 @@ #ifdef _WIN32 # define timegm _mkgmtime -# pragma comment(lib, "libcrypto.lib") -# pragma comment(lib, "libssl.lib") #endif #if OPENSSL_VERSION_NUMBER < 0x10101000L diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp index 9d43b6f80..ecfff323f 100644 --- a/src/modules/m_cloak_sha256.cpp +++ b/src/modules/m_cloak_sha256.cpp @@ -30,7 +30,6 @@ #ifdef _WIN32 # if __has_include(<libpsl.h>) # define HAS_LIBPSL -# pragma comment(lib, "psl.lib") # endif #endif diff --git a/win/.gitignore b/win/.gitignore index 071c0a492..47f02d1b2 100644 --- a/win/.gitignore +++ b/win/.gitignore @@ -1,2 +1,3 @@ +CMakeUserPresets.json config.h inspircd.rc diff --git a/win/build.ps1 b/win/build.ps1 deleted file mode 100644 index b7df5ced9..000000000 --- a/win/build.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -cd $PSScriptRoot/build -conan install --build=missing .. -cmake .. -A x64 -D CMAKE_BUILD_TYPE=Release -msbuild PACKAGE.vcxproj /P:Configuration=Release /P:Platform=x64 /VERBOSITY:MINIMAL diff --git a/win/conanfile.txt b/win/conanfile.txt index ffc41d873..9ee7098ef 100644 --- a/win/conanfile.txt +++ b/win/conanfile.txt @@ -1,36 +1,33 @@ -# Last updated: 2024-06-19 +# Last updated: 2025-04-17 # # Modules we can't legally ship: geo_maxmind, ssl_openssl -# Modules which don't apply to Windows: sslrehashsignal +# Modules which don't apply to Windows: log_syslog, sslrehashsignal # Modules without packages: ssl_gnutls [requires] argon2/20190702 -## libmaxminddb/1.10.0 +## libmaxminddb/1.12.2 libmysqlclient/8.1.0 -libpq/15.5 -libpsl/0.21.1 -## openssl/3.3.2 +libpq/16.8 +libpsl/0.21.5 +## openssl/3.4.1 pcre2/10.44 re2/20240702 -sqlite3/3.47.0 +sqlite3/3.49.1 yyjson/0.10.0 [options] -argon2:shared=True -libmaxminddb:shared=True -libmysqlclient:shared=True -libpq:shared=True -libpsl:shared=True -openssl:shared=True -pcre2:shared=True -re2:shared=True -sqlite3:shared=True -yyjson:shared=True - -[imports] -., *.dll -> extradll @ keep_path=False -., *.lib -> extralib @ keep_path=False +argon2/*:shared=True +libmaxminddb/*:shared=True +libmysqlclient/*:shared=True +libpq/*:shared=True +libpsl/*:shared=True +openssl/*:shared=True +pcre2/*:shared=True +re2/*:shared=True +sqlite3/*:shared=True +yyjson/*:shared=True [generators] -cmake +CMakeDeps +CMakeToolchain diff --git a/win/modules/CMakeLists.txt b/win/modules/CMakeLists.txt index 8fc4c3a81..16aa6b09f 100644 --- a/win/modules/CMakeLists.txt +++ b/win/modules/CMakeLists.txt @@ -28,37 +28,44 @@ file(GLOB INSPIRCD_MODULES list(APPEND INSPIRCD_MODULES "${INSPIRCD_BASE}/src/modules/extra/m_ldap.cpp") -if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") - include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +# The libraries that modules depend on. +set(INSPIRCD_DEPS) - function(enable_extra NAME PACKAGE) - if(DEFINED "CONAN_${PACKAGE}_ROOT") +if(DEFINED CMAKE_TOOLCHAIN_FILE) + function(enable_extra NAME PACKAGE TARGET) + find_package(${PACKAGE}) + if(${PACKAGE}_FOUND) message("Enabling the ${NAME} module") list(APPEND INSPIRCD_MODULES "${INSPIRCD_BASE}/src/modules/extra/m_${NAME}.cpp") set(INSPIRCD_MODULES ${INSPIRCD_MODULES} PARENT_SCOPE) + list(APPEND INSPIRCD_DEPS ${TARGET}) + set(INSPIRCD_DEPS ${INSPIRCD_DEPS} PARENT_SCOPE) else() message("Unable to enable the ${NAME} module (missing library)") endif() endfunction() - enable_extra("argon2" "ARGON2") - enable_extra("geo_maxmind" "LIBMAXMINDDB") - enable_extra("log_json" "YYJSON") - enable_extra("mysql" "LIBMYSQLCLIENT") - enable_extra("pgsql" "LIBPQ") - enable_extra("regex_pcre2" "PCRE2") - enable_extra("regex_posix" "PCRE2") - enable_extra("regex_re2" "RE2") - enable_extra("ssl_openssl" "OPENSSL") - enable_extra("sqlite3" "SQLITE3") + enable_extra("argon2" "argon2" "argon2::argon2") + enable_extra("geo_maxmind" "maxminddb" "maxminddb::maxminddb") + enable_extra("log_json" "yyjson" "yyjson::yyjson") + enable_extra("mysql" "libmysqlclient" "libmysqlclient::libmysqlclient") + enable_extra("pgsql" "PostgreSQL" "PostgreSQL::PostgreSQL") + enable_extra("regex_pcre2" "PCRE2" "pcre2::pcre2") + enable_extra("regex_posix" "PCRE2" "pcre2::pcre2") + enable_extra("regex_re2" "re2" "re2::re2") + enable_extra("ssl_openssl" "OpenSSL" "openssl::openssl") + enable_extra("sqlite3" "SQLite3" "SQLite::SQLite3") + + # Optional dependency of cloak_sha256 + find_package("libpsl") + if (libpsl_FOUND) + list(APPEND INSPIRCD_DEPS "libpsl::libpsl") + endif() - link_directories("${CMAKE_BINARY_DIR}/extradll" "${CMAKE_BINARY_DIR}/extralib") file(GLOB EXTRA_DLLS "${CMAKE_BINARY_DIR}/extradll/*.dll") install(FILES ${EXTRA_DLLS} DESTINATION .) - - conan_basic_setup(TARGETS) else() - message("Unable to build extras: conanbuildinfo.cmake does not exist in the build directory!") + message("Unable to build extras: CMAKE_TOOLCHAIN_FILE is not set to the Conan toolchain!") endif() list(SORT INSPIRCD_MODULES) @@ -82,10 +89,8 @@ foreach(MODULE_NAME ${INSPIRCD_MODULES}) add_dependencies(${BASE_NAME} "inspircd" "win32memory") target_link_libraries(${BASE_NAME} "inspircd" "win32memory") - # Link against any dependencies if available - if(CONAN_CXX_FLAGS) - conan_target_link_libraries(${BASE_NAME}) - endif() + # Link against any Conan dependencies + target_link_libraries(${BASE_NAME} ${INSPIRCD_DEPS}) set_target_properties(${BASE_NAME} PROPERTIES PREFIX "" |
