diff --git a/.github/workflows/build-libdave.yml b/.github/workflows/build-libdave.yml new file mode 100644 index 00000000..a69bc0f7 --- /dev/null +++ b/.github/workflows/build-libdave.yml @@ -0,0 +1,138 @@ +name: Build Libdave.RID + +on: + pull_request: + branches: + - stable + - alpha + - feature/e2ee-libdave + paths: + - 'NetCord/ThirdParty/Libdave/**' + - '.github/workflows/build-libdave.yml' + push: + branches: + - stable + - alpha + - feature/e2ee-libdave + paths: + - 'NetCord/ThirdParty/Libdave/**' + - '.github/workflows/build-libdave.yml' + workflow_dispatch: + +jobs: + build-libdave: + strategy: + fail-fast: false + matrix: + include: + # Windows builds + - os: windows-2025-vs2026 + rid: win-x86 + arch: Win32 + - os: windows-2025-vs2026 + rid: win-x64 + arch: x64 + - os: windows-2025-vs2026 + rid: win-arm64 + arch: ARM64 + + # Linux builds + - os: ubuntu-latest + rid: linux-x64 + - os: ubuntu-latest + rid: linux-arm64 + + # macOS builds + - os: macos-latest + rid: osx-arm64 + - os: macos-latest-large + rid: osx-x64 + + runs-on: ${{ matrix.os }} + + name: Build ${{ matrix.rid }} + + steps: + - uses: actions/checkout@v6.0.2 + with: + fetch-depth: 0 + filter: tree:0 + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v5.1.0 + with: + global-json-file: global.json + + - name: Install Linux cross-compilation tools (ARM64) + if: matrix.os == 'ubuntu-latest' && matrix.rid == 'linux-arm64' + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + + - name: Restore dependencies + run: dotnet restore NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.csproj -v normal -r ${{ matrix.rid }} /bl:restore-${{ matrix.rid }}.binlog + + # /p:Configurations="RelWithDebInfo,MinSizeRel" + - id: install-nlohmann + name: Install nlohmann-json (vcpkg) + shell: pwsh + run: | + # Use vcpkg installed on the runner + $vcpkgPath = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg' + if (Test-Path "$vcpkgPath.exe") { $vcpkgPath = "$vcpkgPath.exe" } + elseif (-not (Test-Path $vcpkgPath)) { Write-Error "vcpkg executable not found under $env:VCPKG_INSTALLATION_ROOT"; exit 1 } + + switch ("${{ matrix.rid }}") { + 'win-x86' { $triplet = 'x86-windows' } + 'win-x64' { $triplet = 'x64-windows' } + 'win-arm64' { $triplet = 'arm64-windows' } + 'linux-x64' { $triplet = 'x64-linux' } + 'linux-arm64'{ $triplet = 'arm64-linux' } + 'osx-x64' { $triplet = 'x64-osx' } + 'osx-arm64' { $triplet = 'arm64-osx' } + default { Write-Host "Unknown RID '${{ matrix.rid }}' for vcpkg triplet mapping; skipping vcpkg install"; exit 0 } + } + + Write-Host "Installing nlohmann-json for triplet: $triplet" + # Export vcpkg settings as step outputs (do NOT persist to job env) + Add-Content -Path $env:GITHUB_OUTPUT -Value "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" + Add-Content -Path $env:GITHUB_OUTPUT -Value "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" + Add-Content -Path $env:GITHUB_OUTPUT -Value "VCPKG_TARGET_TRIPLET=$triplet" + + & $vcpkgPath install "nlohmann-json:$triplet" + + - name: Build & Pack Libdave.RID (via ) + shell: pwsh + run: | + # Use vcpkg settings exported by the install step + $env:CMAKE_TOOLCHAIN_FILE = '${{ steps.install-nlohmann.outputs.CMAKE_TOOLCHAIN_FILE }}' + $env:VCPKG_TARGET_TRIPLET = '${{ steps.install-nlohmann.outputs.VCPKG_TARGET_TRIPLET }}' + Write-Host "Using vcpkg toolchain: $env:CMAKE_TOOLCHAIN_FILE" + Write-Host "Using vcpkg triplet: $env:VCPKG_TARGET_TRIPLET" + + if ("${{ matrix.arch }}" -ne "") { $env:CMAKE_GENERATOR_PLATFORM = "${{ matrix.arch }}" } + + if ("${{ matrix.rid }}" -eq "linux-arm64") { + $env:CMAKE_CXX_COMPILER = "aarch64-linux-gnu-g++" + $env:CMAKE_C_COMPILER = "aarch64-linux-gnu-gcc" + } + + $env:CMakeArgs = "-DCMAKE_TOOLCHAIN_FILE=$env:CMAKE_TOOLCHAIN_FILE -DVCPKG_TARGET_TRIPLET=$env:VCPKG_TARGET_TRIPLET" + + dotnet build NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.csproj --no-restore -v normal -c MinSizeRel -r ${{ matrix.rid }} /bl:build-${{ matrix.rid }}.binlog + + - name: Upload Binary Log + if: always() && (hashFiles('restore-${{ matrix.rid }}.binlog','build-${{ matrix.rid }}.binlog') != '') + uses: actions/upload-artifact@v6.0.0 + with: + name: BinLog-${{ matrix.rid }} + path: | + restore-${{ matrix.rid }}.binlog + build-${{ matrix.rid }}.binlog + + - name: Upload NuGet Packages + uses: actions/upload-artifact@v6.0.0 + with: + name: NuGet-Libdave-${{ matrix.rid }} + path: NetCord/ThirdParty/Libdave/Libdave.RID/bin/MinSizeRel/*.nupkg diff --git a/.gitignore b/.gitignore index 44c3b430..a03941df 100644 --- a/.gitignore +++ b/.gitignore @@ -364,4 +364,6 @@ FodyWeavers.xsd # Settings file appsettings.json -!Documentation/**/appsettings.json \ No newline at end of file +!Documentation/**/appsettings.json + +/NetCord/ThirdParty/**/*_build* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..49816c0b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "NetCord/ThirdParty/Libdave/libdave"] + path = NetCord/ThirdParty/Libdave/libdave + url = https://github.com/discord/libdave/ + +[submodule "NetCord/ThirdParty/MLSpp/mlspp"] + path = NetCord/ThirdParty/MLSpp/mlspp + url = https://github.com/cisco/mlspp/ diff --git a/Directory.Build.props b/Directory.Build.props index 55e17a34..669d552b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,8 @@  - + + + net10.0 enable enable @@ -16,6 +18,7 @@ bot;discord;discord-api MIT The modern and fully customizable C# Discord library. + KubaZ2; NetCord Contributors README.md ICON.png true @@ -37,6 +40,7 @@ + diff --git a/Directory.Build.targets b/Directory.Build.targets index fb55fc1c..fb6f7d02 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,5 +3,5 @@ $(DefineConstants);$([System.String]::Copy('$(AssemblyName)').Replace('.', '_')) - + diff --git a/NetCord.slnx b/NetCord.slnx index c3ba02e9..dc200601 100644 --- a/NetCord.slnx +++ b/NetCord.slnx @@ -60,6 +60,18 @@ + + + + + + + + + + + + diff --git a/NetCord/NetCord.csproj b/NetCord/NetCord.csproj index 1d3b26c3..dd3cf5af 100644 --- a/NetCord/NetCord.csproj +++ b/NetCord/NetCord.csproj @@ -1,5 +1,10 @@  + + + + + diff --git a/NetCord/ThirdParty/Directory.Build.props b/NetCord/ThirdParty/Directory.Build.props new file mode 100644 index 00000000..a3885274 --- /dev/null +++ b/NetCord/ThirdParty/Directory.Build.props @@ -0,0 +1,71 @@ + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + <_BuildArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) + <_BuildRuntime Condition="$([MSBuild]::IsOSPlatform('Windows'))">win + <_BuildRuntime Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux + <_BuildRuntime Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx + $(_BuildRuntime)-$(_BuildArch.ToLower()) + + + + true + $(PackageOutputPath);$(RestoreSources) + + win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-arm64;osx-x64 + + + $(CMakeArgs) -DCMAKE_POSITION_INDEPENDENT_CODE=ON + + + + $(MSBuildThisFileDirectory)\MLSpp\ + BuildMlsppNative;MlsppOutputs;$(Building_DependsOn) + MlsppInstall;$(Installing_DependsOn) + CleanMlsppNative;$(Cleaning_DependsOn) + PackageMlsppLib;$(Packing_DependsOn) + true + + + + + + + PackageOpenSSLLib;$(Packing_DependsOn) + + + + + diff --git a/NetCord/ThirdParty/Directory.Build.targets b/NetCord/ThirdParty/Directory.Build.targets new file mode 100644 index 00000000..18a7b01e --- /dev/null +++ b/NetCord/ThirdParty/Directory.Build.targets @@ -0,0 +1,46 @@ + + + + + + + + + $([System.Version]::Parse('$(MSBuildVersion)').Major) + + + + + + + + + + + $([System.Text.RegularExpressions.Regex]::Match($(CMakeVersionOutput), 'cmake version (\d+\.\d+\.\d+)').Groups[1].Value) + $([System.Version]::Parse('$(CMakeVersionString)').Major) + $([System.Version]::Parse('$(CMakeVersionString)').Minor) + + + + + + + + + + + + + diff --git a/NetCord/ThirdParty/FindOpenSSL.targets b/NetCord/ThirdParty/FindOpenSSL.targets new file mode 100644 index 00000000..7080355c --- /dev/null +++ b/NetCord/ThirdParty/FindOpenSSL.targets @@ -0,0 +1,266 @@ + + + + + + + false + false + true + + + + + + + <_IsWindows Condition="'$(OS)' == 'Windows_NT'">true + <_IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true + <_IsMacOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true + <_IsUnix Condition="'$(_IsLinux)' == 'true' OR '$(_IsMacOS)' == 'true'">true + + + + + + + + + + $(OPENSSL_ROOT_DIR) + + + + + + $([MSBuild]::GetRegistryValueFromView( + `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenSSL (64-bit)_is1`, + `Inno Setup: App Path`, null, + RegistryView.Registry64)) + + $([MSBuild]::GetRegistryValueFromView( + `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenSSL (32-bit)_is1`, + `Inno Setup: App Path`, null, + RegistryView.Registry32)) + + + + + $(ProgramFiles)\OpenSSL-Win64 + $(ProgramFiles)\OpenSSL + C:\OpenSSL-Win64 + C:\OpenSSL + + + + + /opt/homebrew/opt/openssl@3 + /opt/homebrew/opt/openssl@1.1 + /opt/homebrew/opt/openssl + /usr/local/opt/openssl@3 + /usr/local/opt/openssl@1.1 + /usr/local/opt/openssl + + + + + /usr + /usr/local + + + + + + + + + + + + + $(OpenSSLRoot)\bin\openssl.exe + + + $(OpenSSLRoot)\bin\openssl + + + + + + + + + + $([System.Text.RegularExpressions.Regex]::Match('@(OpenSSLVersionLines->"%(Identity)")','OpenSSL\s+([^\s]+)').Groups[1].Value) + + + + + + + + + + + + <_RTSuffix Condition="'$(CMakeStaticRT)' == 'true'">MT + <_RTSuffix Condition="'$(CMakeStaticRT)' != 'true'">MD + + + + + $(OpenSSLRoot)\lib\VC\x64\$(_RTSuffix) + $(OpenSSLRoot)\lib\VC\static + $(OpenSSLRoot)\lib\VC + $(OpenSSLRoot)\lib64 + $(OpenSSLRoot)\lib + + + + + $(OpenSSLRoot)/lib/x86_64-linux-gnu + $(OpenSSLRoot)/lib64 + $(OpenSSLRoot)/lib + + + + + $(OpenSSLRoot)/lib + + + + + + + + + + + + + + + <_RTSuffix Condition="'$(CMakeStaticRT)' == 'true'">MT + <_RTSuffix Condition="'$(CMakeStaticRT)' != 'true'">MD + + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto_static64$(_RTSuffix).lib')">$(OpenSSLLibPath)\libcrypto_static64$(_RTSuffix).lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto_static$(_RTSuffix).lib')">$(OpenSSLLibPath)\libcrypto_static$(_RTSuffix).lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto_static.lib')">$(OpenSSLLibPath)\libcrypto_static.lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto64$(_RTSuffix).lib')">$(OpenSSLLibPath)\libcrypto64$(_RTSuffix).lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto$(_RTSuffix).lib')">$(OpenSSLLibPath)\libcrypto$(_RTSuffix).lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libcrypto.lib')">$(OpenSSLLibPath)\libcrypto.lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libeay32$(_RTSuffix).lib')">$(OpenSSLLibPath)\libeay32$(_RTSuffix).lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\libeay32.lib')">$(OpenSSLLibPath)\libeay32.lib + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)\crypto.lib')">$(OpenSSLLibPath)\crypto.lib + + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl_static64$(_RTSuffix).lib')">$(OpenSSLLibPath)\libssl_static64$(_RTSuffix).lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl_static$(_RTSuffix).lib')">$(OpenSSLLibPath)\libssl_static$(_RTSuffix).lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl_static.lib')">$(OpenSSLLibPath)\libssl_static.lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl64$(_RTSuffix).lib')">$(OpenSSLLibPath)\libssl64$(_RTSuffix).lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl$(_RTSuffix).lib')">$(OpenSSLLibPath)\libssl$(_RTSuffix).lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\libssl.lib')">$(OpenSSLLibPath)\libssl.lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\ssleay32$(_RTSuffix).lib')">$(OpenSSLLibPath)\ssleay32$(_RTSuffix).lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\ssleay32.lib')">$(OpenSSLLibPath)\ssleay32.lib + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)\ssl.lib')">$(OpenSSLLibPath)\ssl.lib + + + + + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND '$(OpenSSLUseStaticLibs)' == 'true' AND Exists('$(OpenSSLLibPath)/libcrypto.a')">$(OpenSSLLibPath)/libcrypto.a + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)/libcrypto.so')">$(OpenSSLLibPath)/libcrypto.so + + <_SSLLib Condition="'$(_SSLLib)' == '' AND '$(OpenSSLUseStaticLibs)' == 'true' AND Exists('$(OpenSSLLibPath)/libssl.a')">$(OpenSSLLibPath)/libssl.a + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)/libssl.so')">$(OpenSSLLibPath)/libssl.so + + + + + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND '$(OpenSSLUseStaticLibs)' == 'true' AND Exists('$(OpenSSLLibPath)/libcrypto.a')">$(OpenSSLLibPath)/libcrypto.a + <_CryptoLib Condition="'$(_CryptoLib)' == '' AND Exists('$(OpenSSLLibPath)/libcrypto.dylib')">$(OpenSSLLibPath)/libcrypto.dylib + + <_SSLLib Condition="'$(_SSLLib)' == '' AND '$(OpenSSLUseStaticLibs)' == 'true' AND Exists('$(OpenSSLLibPath)/libssl.a')">$(OpenSSLLibPath)/libssl.a + <_SSLLib Condition="'$(_SSLLib)' == '' AND Exists('$(OpenSSLLibPath)/libssl.dylib')">$(OpenSSLLibPath)/libssl.dylib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_OpenSSLPackageFiles Include="@(OpenSSLLib)" Condition="Exists('%(Identity)')"> + true + lib\$(RuntimeIdentifier)\%(_OpenSSLPackageFiles.Filename)%(_OpenSSLPackageFiles.Extension) + + + + <_OpenSSLPackageFiles Include="$(OpenSSLRoot)\license.txt" Condition="Exists('$(OpenSSLRoot)\license.txt')"> + true + lib\$(RuntimeIdentifier)\OPENSSL_LICENSE_$(OpenSSLVersion).txt + lib\$(RuntimeIdentifier)\OPENSSL_LICENSE.txt + + + + + + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/LICENSE.md b/NetCord/ThirdParty/LICENSE.md new file mode 100644 index 00000000..b69955a8 --- /dev/null +++ b/NetCord/ThirdParty/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 ha-ves + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.props b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.props new file mode 100644 index 00000000..c9a48190 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.props @@ -0,0 +1,13 @@ + + + + manage.build.props.in + manage.build.targets.in + + + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.targets b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.targets new file mode 100644 index 00000000..b1512547 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.build.targets @@ -0,0 +1,127 @@ + + + + + + <_PackVer>$(Version) + + + + + + + + <_Rid Include="$(RuntimeIdentifiers)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_TemplateContent>$([System.IO.File]::ReadAllText('$(BuildPropsTemplate)')) + <_TransformedContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__PACK_VER__', + '$(_PackVer)')) + + <_OutBuildFile>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)\build.props + + + + + + + + + <_TemplateContent>$([System.IO.File]::ReadAllText('$(BuildTargetsTemplate)')) + <_TransformedContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__PACK_VER__', + '$(_PackVer)')) + + <_OutBuildFile>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)\build.targets + + + + + + + + + + + + <_PackBuildFiles Include="$(BaseIntermediateOutputPath)\build.*" /> + + true + build\$(PackageId)%(Extension) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.csproj b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.csproj new file mode 100644 index 00000000..60716454 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.Manager/Libdave.Manager.csproj @@ -0,0 +1,32 @@ + + + + NetCord.ThirdParty.Libdave + Pre-built libdave binaries Manager for NetCord, $(Description) + ha-ves;$(Authors) + + + + false + NU5128 + true + false + + MinSizeRel;RelWithDebInfo + MinSizeRel + RelWithDebInfo + + + + + + + + Build Files\%(Filename)%(Extension) + + + Build Files\%(Filename)%(Extension) + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.props.in b/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.props.in new file mode 100644 index 00000000..a9f71818 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.props.in @@ -0,0 +1,17 @@ + + + + __PACK_VER__ + + + + <_LibdaveRefArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) + <_LibdaveRefArch>$(_LibdaveRefArch.ToLower()) + <_LibdaveRuntime Condition="$([MSBuild]::IsOSPlatform('Windows'))">win + <_LibdaveRuntime Condition="$([MSBuild]::IsOSPlatform('Linux'))">linux + <_LibdaveRuntime Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx + + $(_LibdaveRuntime)-$(_LibdaveRefArch) + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.targets.in b/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.targets.in new file mode 100644 index 00000000..acda746b --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.Manager/manage.build.targets.in @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.props b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.props new file mode 100644 index 00000000..4b8ddf33 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.props @@ -0,0 +1,66 @@ + + + + false + + + + + + + + + + + + + + + + true + + false + $(MSBuildThisFileDirectory)\..\libdave\cpp + + true + $(MSBuildThisFileDirectory)\..\libdave_build\ + + out\ + true + + libdave_install\ + + + + + + build.props.in + build.targets.in + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.targets b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.targets new file mode 100644 index 00000000..ecb5a875 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.build.targets @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + $(CMakeFlags) $(LibdaveCMakeFlags) + + <_LibdaveCMakeArgs>$(CMakeArgs) $(_LibdaveCMakeArgs) + <_LibdaveCMakeArgs Condition="'$(LibdaveGenerator)' != ''">-G "$(LibdaveGenerator)" $(_LibdaveCMakeArgs) + + <_LibdaveCMakeArgs Condition="'@(CMakeConfiguration)' != ''" + >$(_LibdaveCMakeArgs) -DCMAKE_CONFIGURATION_TYPES="@(CMakeConfiguration)" + <_LibdaveCMakeArgs Condition="'@(CMakeConfiguration)' == ''" + >$(_LibdaveCMakeArgs) -DCMAKE_BUILD_TYPE="$(Configuration)" + + <_LibdaveCMakeArgs Condition="'$(LibdaveBuildShared)' == 'true'">$(_LibdaveCMakeArgs) -DBUILD_SHARED_LIBS=ON + + <_LibdaveCMakeArgs Condition="'$(LibdaveTesting)' != ''">$(_LibdaveCMakeArgs) -DTESTING=$(LibdaveTesting) -DTESTS=$(LibdaveTesting) + <_LibdaveCMakeArgs Condition="'$(CMakeOpenSSLRoot)' != ''">$(_LibdaveCMakeArgs) -DOpenSSL_ROOT="$(CMakeOpenSSLRoot) " + <_LibdaveCMakeArgs Condition="'$(CMakeOpenSSLDir)' != ''">$(_LibdaveCMakeArgs) -DOpenSSL_DIR="$(CMakeOpenSSLDir) " + <_LibdaveCMakeArgs Condition="'$(CMakeBoringSSLRoot)' != ''">$(_LibdaveCMakeArgs) -DBoringSSL_ROOT="$(CMakeBoringSSLRoot) " + <_LibdaveCMakeArgs Condition="'$(CMakeBoringSSLDir)' != ''">$(_LibdaveCMakeArgs) -DBoringSSL_DIR="$(CMakeBoringSSLDir) " + <_LibdaveCMakeArgs Condition="'$(CMakeNlohmannJsonRoot)' != ''">$(_LibdaveCMakeArgs) -Dnlohmann_json_ROOT="$(CMakeNlohmannJsonRoot) " + <_LibdaveCMakeArgs Condition="'$(CMakeNlohmannJsonDir)' != ''">$(_LibdaveCMakeArgs) -Dnlohmann_json_DIR="$(CMakeNlohmannJsonDir) " + <_LibdaveCMakeArgs Condition="'$(CMakeMlsppRoot)' != ''">$(_LibdaveCMakeArgs) -DMLSPP_ROOT="$(CMakeMlsppRoot) " + <_LibdaveCMakeArgs Condition="'$(CMakeMlsppDir)' != ''">$(_LibdaveCMakeArgs) -DMLSPP_DIR="$(CMakeMlsppDir) " + + <_LibdaveInstallPath Condition="'$(LibdaveBaseInstallPath)' != ''">$(LibdaveBaseInstallPath) + <_LibdaveInstallPath Condition="'$(CMakeInstallPrefix)' != ''">$(CMakeInstallPrefix)\$(_LibdaveInstallPath) + <_LibdaveInstallPath Condition="'$(LibdaveInstallPath)' != ''">$(LibdaveInstallPath) + <_LibdaveCMakeArgs Condition="'$(_LibdaveInstallPath)' != ''">$(_LibdaveCMakeArgs) -DCMAKE_INSTALL_PREFIX="$(_LibdaveInstallPath) " + + $(LibdaveBaseBuildDir)\$(RuntimeIdentifier)\ + + $(CMakeFlags) + + $(CMakeBuildArgs) $(LibdaveCMakeBuildArgs) + --config $(Configuration) --parallel $(LibdaveCMakeBuildArgs) + + <_LibdaveBuildType>static + <_LibdaveBuildType Condition="'$(LibdaveBuildShared)' == 'true'">shared + + + + + + + + + + <_LibdaveLibType Include="static;shared" /> + <_LibdaveRunExt Include="dll;so" /> + <_LibdaveLibExt Include="lib;a" /> + + <_LibdaveConfigType Include="@(CMakeConfiguration)"> + <_BuildType>%(_LibdaveLibType.Identity) + + + <_LibdaveCMakeConfig Include="@(_LibdaveConfigType->'%(Identity)-%(_BuildType)')"> + <_Config>%(Identity) + <_OutputPath>$(LibdaveBuildDir)\%(_BuildType)\%(Identity) + <_OutputPath Condition="'$(CMakeStaticRT)' == 'true' AND '%(_BuildType)' == 'static'" + >$(LibdaveBuildDir)\%(_BuildType)_rt\%(Identity) + %(MSBuildProperties);Configuration=%(Identity);CMakeStaticRT=$(CMakeStaticRT);LibdaveBuildShared=true + %(MSBuildProperties);LibdaveBuildShared=false + + + <_LibdaveCMakeConfig Update="%(Identity)" Condition="'$(LibdaveGenerator)' == '' AND '$(OS)' != 'Windows_NT'"> + <_OutputPath Condition="">%(_OutputPath)\$(LibdaveBuildOutBaseDir) + + + + + $(LibdaveBuildDir)\$(_LibdaveBuildType) + <_LibdaveBuildOutputPath>$(LibdaveBuildDir)\$(LibdaveBuildOutBaseDir) + + + + $(LibdaveBuildDir)_rt + + <_LibdaveBuildMSVC>MultiThreaded + <_LibdaveBuildMSVC Condition="'$(Configuration)' == 'RelWithDebInfo'">$(_LibdaveBuildMSVC)Debug + <_LibdaveCMakeArgs Condition="'$(OS)' == 'Windows_NT'">$(_LibdaveCMakeArgs) -DOPENSSL_MSVC_STATIC_RT=ON -DCMAKE_MSVC_RUNTIME_LIBRARY="$(_LibdaveBuildMSVC)" + + + + + + + $(LibdaveBuildDir)\$(Configuration)\ + + <_LibdaveCMakeOutDir>$(LibdaveBuildDir) + <_LibdaveCMakeOutDir Condition="'$(OS)' != 'Windows_NT'">$(_LibdaveCMakeOutDir)\$(LibdaveBuildOutBaseDir) + + <_LibdaveCMakeArgs>$(_LibdaveCMakeArgs) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(_LibdaveCMakeOutDir) + <_LibdaveCMakeArgs>$(_LibdaveCMakeArgs) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(_LibdaveCMakeOutDir) + <_LibdaveCMakeArgs>$(_LibdaveCMakeArgs) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$(_LibdaveCMakeOutDir) + + <_LibdaveBuildOutputPath>$(LibdaveBuildDir)\$(Configuration) + $(LibdaveCMakeBuildArgs) -- /p:OutDir="$(_LibdaveBuildOutputPath)/" + + <_LibdaveBuildOutputPath Condition="'$(OS)' != 'Windows_NT'">$(LibdaveBuildDir)\$(LibdaveBuildOutBaseDir) + + + + $(_LibdaveCMakeArgs) $(CMakeArgs) $(LibdaveCMakeArgs) + + <_LibdaveConfigureCMakeArgsFile>$(LibdaveBuildDir)\.cmake-args + <_LibdaveConfigureErrorLog>$(LibdaveBuildDir)\.cmake-configure-error.log + + <_LibdaveBuildErrorLog>$(LibdaveBuildDir)\.cmake-build-error_$(Configuration).log + <_LibdaveBuildErrorIdent>$(LibdaveBuildDir)\build_error_$(Configuration) + + <_LibdaveInstallErrorLog>$(LibdaveBuildDir)\.cmake-install-error_$(Configuration).log + + + + + + + + + + + + + + <_PrevCMakeArgsProperty>%(_PrevCMakeArgs.Identity) + + + + + <_PrevCMakeArgsTrimmed>$(_PrevCMakeArgsProperty.Trim()) + <_LibdaveCMakeArgsTrimmed>$(LibdaveCMakeArgs.Trim()) + + <_IsCMakeArgsChanged_> + $([System.String]::Compare('$(_LibdaveCMakeArgsTrimmed)', '$(_PrevCMakeArgsTrimmed)')) + + <_IsCMakeArgsChanged>$(_IsCMakeArgsChanged_.Trim()) + + + + + + + <_IsCMakeArgsChanged Condition="'$(CMakeClearCache)' == 'true' AND '$(_IsCMakeArgsChanged)' != '0'">-1 + + + + + + <_IsCMakeArgsChanged Condition="!Exists('$(LibdaveBuildDir)\CMakeCache.txt')">-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(LibdaveBuildDir) + + + + + <_LibdaveCMakeConfigRemain Include="@(_LibdaveCMakeConfig)" /> + <_LibdaveCMakeConfigRemain Remove="$(Configuration)-$(_LibdaveBuildType)" /> + + + + <_LibdaveBuildOutput Include="$(_LibdaveBuildOutputPath)\**\*" /> + <_LibdaveBuildOutput Update="%(Identity)" Condition="'$(LibdaveCopyBuildOutput)' == 'true'"> + <_CopyPath>-> $(MSBuildProjectDirectory)\$(OutputPath)\$(LibdaveBaseOutputPath)\$([MSBuild]::MakeRelative('$(_LibdaveBuildOutputPath)', '%(FullPath)')) + + + + + + + + + + PreserveNewest + $(LibdaveBaseOutputPath)\$([MSBuild]::MakeRelative('$(_LibdaveBuildOutputPath)', '%(FullPath)')) + + + + + + + + + + + <_LibdaveCMakeConfigRemain Include="@(_LibdaveCMakeConfig)" /> + + + + + <_Args>$(LibdaveCMakeBuildArgs.Replace('=', ' ')) + <_Pattern>(?:^|\s)(?:-j|--parallel)\s*(\d+) + + + <_HasParallel>$([System.Text.RegularExpressions.Regex]::IsMatch('$(_Args)', '$(_Pattern)')) + + + <_TotalJobs Condition="'$(_HasParallel)' == 'True'">$([System.Text.RegularExpressions.Regex]::Match('$(_Args)', '.*(?:-j|--parallel)\s*(\d+)').Groups[1].Value) + <_TotalJobs Condition="'$(_TotalJobs)' == ''">$([System.Environment]::ProcessorCount) + + + <_ConfigCount>@(_LibdaveCMakeConfigRemain->Count()) + <_ConfigCount Condition="'$(_ConfigCount)' == '0' AND '$(Configuration)' != ''">1 + $([MSBuild]::Divide($(_TotalJobs), $(_ConfigCount))) + 1 + + <_LibdaveIntCMakeBuildArgs Condition="'$(JobsPerConfig)' != '1'">LibdaveCMakeBuildArgs=-j$(JobsPerConfig) + + + + + + + <_LibdaveConfigToBuild Include="$(MSBuildProjectFile)"> + $(_LibdaveIntCMakeBuildArgs);%(_LibdaveCMakeConfigRemain.MSBuildProperties) + $(Building_DependsOn);BuildLibdaveNative;LibdaveOutputs + + + + + + + + + + + + <_LibdaveCMakeConfig Update="%(Identity)" + Condition="'%(_BuildType)' == 'static'"> + <_OutputPath>$(LibdaveBaseBuildDir)\$(RuntimeIdentifier)\%(_BuildType)_rt\%(_Config) + + <_LibdaveCMakeConfigRemain Update="%(Identity)" + Condition="'$(CMakeStaticRT)' == 'true' AND '%(_BuildType)' == 'static'"> + %(MSBuildProperties);CMakeStaticRT=true + + + + + + + + + <_LibdaveOutstatic Include="@(_LibdaveCMakeConfig)" Condition="'%(_LibdaveCMakeConfig._BuildType)' == 'static'" /> + <_LibdaveOutshared Include="@(_LibdaveCMakeConfig)" Condition="'%(_LibdaveCMakeConfig._BuildType)' == 'shared'" /> + + <_LibdaveOuts Include="@(_LibdaveOutstatic)"> + <_Ext>%(_LibdaveLibExt.Identity) + + <_LibdaveOuts Include="@(_LibdaveOutshared)"> + <_Ext>%(_LibdaveRunExt.Identity) + + + <_LibdavePackageFiles Include="%(_LibdaveOuts._OutputPath)\**\*.%(_LibdaveOuts._Ext)" > + <_Config>%(_LibdaveOuts._Config) + <_OutputPath>%(_LibdaveOuts._OutputPath) + + <_LibdavePackageFiles Update="%(Identity)"> + true + lib\$(RuntimeIdentifier)\%(_Config)\$([MSBuild]::MakeRelative('%(_OutputPath)', '%(FullPath)')) + + <_LibdavePackageFiles Update="%(Identity)" Condition="'%(Filename)%(Extension)' == 'dave.dll'"> + $([System.IO.Path]::GetDirectoryName('%(PackagePath)'))\libdave%(Extension) + + + <_LibdavePackageFiles Include="$(MSBuildThisFileDirectory)\..\..\LICENSE.md"> + true + + + + + + + + + + + + + + + + + $(RuntimeIdentifier.ToLower()) + + <_OSLib Condition="$(RuntimeIdentifier.StartsWith('win'))">*.lib + <_OSLib Condition="$(RuntimeIdentifier.StartsWith('linux')) OR $(RuntimeIdentifier.StartsWith('osx'))">*.a + + <_OSRun Condition="$(RuntimeIdentifier.StartsWith('win'))">*.dll + <_OSRun Condition="$(RuntimeIdentifier.StartsWith('linux')) OR $(RuntimeIdentifier.StartsWith('osx'))">*.so + + <_DebugableProp Condition="'$(Configuration)' == 'RelWithDebInfo'"> + <_LibDaveConfig Condition="'%24(Configuration)' == 'Debug' OR %24(Configuration.StartsWith('RelWithDeb'))">RelWithDebInfo</_LibDaveConfig> + + + + + <_TemplateContent>$([System.IO.File]::ReadAllText('$(BuildPropsTemplate)')) + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_Lib__', + '$(_OSLib)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_Run__', + '$(_OSRun)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__DebugableProp__', + '$(_DebugableProp)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_ID__', + '$(RuntimeIdentifier)')) + + <_OutBuildFile>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)\$(RuntimeIdentifier)\build.props + + + + + + + + + <_TemplateContent>$([System.IO.File]::ReadAllText('$(BuildTargetsTemplate)')) + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_Lib__', + '$(_OSLib)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_Run__', + '$(_OSRun)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__DebugableProp__', + '$(_DebugableProp)')) + + <_TemplateContent> + $([System.Text.RegularExpressions.Regex]::Replace( + $(_TemplateContent), + '__Runtime_ID__', + '$(RuntimeIdentifier)')) + + <_OutBuildFile>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)\$(RuntimeIdentifier)\build.targets + + + + + + + + + + + + $(PackageId).$(RuntimeIdentifier) + $(BaseIntermediateOutputPath)\$(RuntimeIdentifier)\ + + + + <_PackBuildFilesDir Include="build;buildTransitive" /> + + <_PackBuildFiles Include="$(BaseIntermediateOutputPath)\$(RuntimeIdentifier)\build.*"> + <_BaseDir>%(_PackBuildFilesDir.Identity) + + + + true + %(_PackBuildFiles._BaseDir)\$(PackageId)%(Extension) + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.csproj b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.csproj new file mode 100644 index 00000000..69d322e9 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.RID/Libdave.RID.csproj @@ -0,0 +1,67 @@ + + + + NetCord.Natives.Libdave + Pre-built libdave binaries ($(RuntimeIdentifier), openssl ) for NetCord, $(Description) + ha-ves; $(Authors) + + + + false + NU5128 + true + false + true + + $(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)\$(RuntimeIdentifier)\ + + MinSizeRel;RelWithDebInfo + MinSizeRel + RelWithDebInfo + + + + + MLSpp\%(Filename)%(Extension) + + + + Build Files\%(Filename)%(Extension) + + + + source\libdave\%(RecursiveDir)%(Filename)%(Extension) + + + source\mlspp\%(RecursiveDir)%(Filename)%(Extension) + + + + + + Build Files\%(Filename)%(Extension) + + + Build Files\%(Filename)%(Extension) + + + + + + + + + + + + true + + + + + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.RID/build.props.in b/NetCord/ThirdParty/Libdave/Libdave.RID/build.props.in new file mode 100644 index 00000000..ff23d06e --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.RID/build.props.in @@ -0,0 +1,15 @@ + + + + + + + true + + + + false + $(LibdaveBaseOutputPath)\__Runtime_Id__ + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/Libdave.RID/build.targets.in b/NetCord/ThirdParty/Libdave/Libdave.RID/build.targets.in new file mode 100644 index 00000000..c8662980 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/Libdave.RID/build.targets.in @@ -0,0 +1,62 @@ + + + + + <_LibdaveLinked Include="%(DirectPInvoke.Identity)" Condition="'%(DirectPInvoke.Identity)' == 'libdave'" /> + + + + + + + <_LibDaveConfig>MinSizeRel__DebugableProp__ + <_LibdaveNativePath>$(MSBuildThisFileDirectory)\..\lib\__Runtime_ID__\ + + + + <_LibDaveLinkedLibs Include="$(_LibdaveNativePath)\__Runtime_Lib__" /> + <_LibDaveLinkedLibs Include="$(_LibdaveNativePath)\$(_LibDaveConfig)\__Runtime_Lib__" /> + + + + + + + <_LibDaveLinkedLibs Remove="@(_LibDaveLinkedLibs)" /> + + + + + + + <_LibDaveConfig>MinSizeRel__DebugableProp__ + <_LibdaveNativePath>$(MSBuildThisFileDirectory)\..\lib\__Runtime_ID__\$(_LibDaveConfig) + + + + <_LibdaveNativeFile Include="$(_LibdaveNativePath)\__Runtime_Run__"> + PreserveNewest + PreserveNewest + + <_LibdaveNativeFile Update="%(Identity)"> + <_CopyPath>-> $(MSBuildProjectDirectory)\$(OutputPath)\$(LibdaveBaseOutputPath)\%(Filename)%(Extension) + $(LibdaveBaseOutputPath)\%(Filename)%(Extension) + + + + + <_LibdaveNativeFile Remove="@(_LibdaveNativeFile)" /> + + + + + + \ No newline at end of file diff --git a/NetCord/ThirdParty/Libdave/build_unix.sh b/NetCord/ThirdParty/Libdave/build_unix.sh new file mode 100644 index 00000000..a044a921 --- /dev/null +++ b/NetCord/ThirdParty/Libdave/build_unix.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +BASEDIR=$(dirname "$0") + +CMakeArgs="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" dotnet msbuild -restore -tl:off -tlp:v=n -v:n $BASEDIR/Libdave.RID/Libdave.RID.csproj diff --git a/NetCord/ThirdParty/Libdave/libdave b/NetCord/ThirdParty/Libdave/libdave new file mode 160000 index 00000000..52cd56dc --- /dev/null +++ b/NetCord/ThirdParty/Libdave/libdave @@ -0,0 +1 @@ +Subproject commit 52cd56dc550f447fb354b3a06c9e2d2e2a4309c6 diff --git a/NetCord/ThirdParty/MLSpp/MLSpp.build.props b/NetCord/ThirdParty/MLSpp/MLSpp.build.props new file mode 100644 index 00000000..eca319c8 --- /dev/null +++ b/NetCord/ThirdParty/MLSpp/MLSpp.build.props @@ -0,0 +1,56 @@ + + + + false + + + + $(OPENSSL_ROOT_DIR) + + + + + + + + + + true + + false + $(MSBuildThisFileDirectory)\mlspp + + false + $(MSBuildThisFileDirectory)\mlspp_build\ + + out\ + false + + mlspp_install\ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NetCord/ThirdParty/MLSpp/MLSpp.build.targets b/NetCord/ThirdParty/MLSpp/MLSpp.build.targets new file mode 100644 index 00000000..749e4f93 --- /dev/null +++ b/NetCord/ThirdParty/MLSpp/MLSpp.build.targets @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + <_MlsppCMakeArgs Condition="'$(MlsppGenerator)' != ''">-G "$(MlsppGenerator)" + + <_MlsppCMakeArgs Condition="'@(CMakeConfiguration)' != ''" + >$(_MlsppCMakeArgs) -DCMAKE_CONFIGURATION_TYPES="@(CMakeConfiguration)" + <_MlsppCMakeArgs Condition="'@(CMakeConfiguration)' == ''" + >$(_MlsppCMakeArgs) -DCMAKE_BUILD_TYPE="$(Configuration)" + + <_MlsppCMakeArgs>$(_MlsppCMakeArgs) -DDISABLE_PQ=ON -DMLS_CXX_NAMESPACE="mlspp" -DDISABLE_GREASE=ON + + <_MlsppCMakeArgs Condition="'$(MlsppTesting)' != ''">$(_MlsppCMakeArgs) -DTESTING=$(MlsppTesting) + <_MlsppCMakeArgs Condition="'$(CMakeOpenSSLRoot)' != ''">$(_MlsppCMakeArgs) -DOpenSSL_ROOT="$(CMakeOpenSSLRoot) " + <_MlsppCMakeArgs Condition="'$(CMakeOpenSSLDir)' != ''">$(_MlsppCMakeArgs) -DOpenSSL_DIR="$(CMakeOpenSSLDir) " + <_MlsppCMakeArgs Condition="'$(CMakeBoringSSLRoot)' != ''">$(_MlsppCMakeArgs) -DBoringSSL_ROOT="$(CMakeBoringSSLRoot) " + <_MlsppCMakeArgs Condition="'$(CMakeBoringSSLDir)' != ''">$(_MlsppCMakeArgs) -DBoringSSL_DIR="$(CMakeBoringSSLDir) " + <_MlsppCMakeArgs Condition="'$(CMakeNlohmannJsonRoot)' != ''">$(_MlsppCMakeArgs) -Dnlohmann_json_ROOT="$(CMakeNlohmannJsonRoot) " + <_MlsppCMakeArgs Condition="'$(CMakeNlohmannJsonDir)' != ''">$(_MlsppCMakeArgs) -Dnlohmann_json_DIR="$(CMakeNlohmannJsonDir) " + + <_MlsppInstallPath Condition="'$(MlsppBaseInstallPath)' != ''">$(MlsppBaseInstallPath) + <_MlsppInstallPath Condition="'$(CMakeInstallPrefix)' != ''">$(CMakeInstallPrefix)\$(_MlsppInstallPath) + <_MlsppInstallPath Condition="'$(MlsppInstallPath)' != ''">$(MlsppInstallPath) + <_MlsppCMakeArgs Condition="'$(_MlsppInstallPath)' != ''">$(_MlsppCMakeArgs) -DCMAKE_INSTALL_PREFIX="$(_MlsppInstallPath) " + + $(MlsppBaseBuildDir)\$(RuntimeIdentifier)\ + <_MlsppBuildDirPreType>$(MlsppBuildDir) + + $(CMakeBuildArgs) $(MlsppCMakeBuildArgs) + --config $(Configuration) $(MlsppCMakeBuildArgs) + --parallel $(MlsppCMakeBuildArgs) + + + + + + + + + + $(MlsppBuildDir)\static + + + + $(MlsppBuildDir)_rt + + <_MlsppCMakeArgs Condition="'$(OS)' == 'Windows_NT'">$(_MlsppCMakeArgs) -DOPENSSL_MSVC_STATIC_RT=ON -DCMAKE_PROJECT_mlspp_INCLUDE="$(MSBuildThisFileDirectory)\..\fix_msvc.cmake" + + + + + + + <_MlsppLibExt Include="lib;a" /> + + <_MlsppCMakeConfig Include="@(CMakeConfiguration)"> + %(MSBuildProperties);Configuration=%(Identity);CMakeStaticRT=$(CMakeStaticRT) + <_OutputPath>$(MlsppBuildDir)\%(Identity) + + + <_MlsppCMakeConfig Update="%(Identity)" Condition="'$(MlsppGenerator)' == '' AND '$(OS)' != 'Windows_NT'"> + <_OutputPath>%(_OutputPath)\$(MlsppBuildOutBaseDir) + + + + + $(MlsppBuildDir)\$(Configuration)\ + + <_MlsppCMakeOutDir>$(MlsppBuildDir) + <_MlsppCMakeOutDir Condition="'$(OS)' != 'Windows_NT'">$(_MlsppCMakeOutDir)\$(MlsppBuildOutBaseDir) + + <_MlsppCMakeArgs>$(_MlsppCMakeArgs) -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(_MlsppCMakeOutDir) + <_MlsppCMakeArgs>$(_MlsppCMakeArgs) -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(_MlsppCMakeOutDir) + <_MlsppCMakeArgs>$(_MlsppCMakeArgs) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$(_MlsppCMakeOutDir) + + <_MlsppBuildOutputPath>$(MlsppBuildDir)\$(Configuration) + $(MlsppCMakeBuildArgs) -- /p:OutDir="$(_MlsppBuildOutputPath)/" + + <_MlsppBuildOutputPath Condition="'$(OS)' != 'Windows_NT'">$(MlsppBuildDir)\$(MlsppBuildOutBaseDir) + + + + $(_MlsppCMakeArgs) $(CMakeArgs) $(MlsppCMakeArgs) + + <_MlsppConfigureCMakeArgsFile>$(MlsppBuildDir)\.cmake-args + <_MlsppConfigureErrorLog>$(MlsppBuildDir)\.cmake-configure-error.log + + <_MlsppBuildErrorLog>$(MlsppBuildDir)\.cmake-build-error_$(Configuration).log + <_MlsppBuildErrorIdent>$(MlsppBuildDir)\build_error_$(Configuration) + + <_MlsppInstallErrorLog>$(MlsppBuildDir)\.cmake-install-error_$(Configuration).log + + + + + + + + + + + + + + <_PrevCMakeArgsProperty>%(_PrevCMakeArgs.Identity) + + + + + <_PrevCMakeArgsTrimmed>$(_PrevCMakeArgsProperty.Trim()) + <_MlsppCMakeArgsTrimmed>$(MlsppCMakeArgs.Trim()) + + <_IsCMakeArgsChanged_> + $([System.String]::Compare('$(_MlsppCMakeArgsTrimmed)', '$(_PrevCMakeArgsTrimmed)')) + + <_IsCMakeArgsChanged>$(_IsCMakeArgsChanged_.Trim()) + + + + + + + <_IsCMakeArgsChanged Condition="'$(CMakeClearCache)' == 'true' AND '$(_IsCMakeArgsChanged)' != '0'">-1 + + + + + + <_IsCMakeArgsChanged Condition="!Exists('$(MlsppBuildDir)\CMakeCache.txt')">-1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(MlsppBuildDir) + + + + + <_MlsppCMakeConfigRemain Include="@(_MlsppCMakeConfig)" /> + <_MlsppCMakeConfigRemain Remove="$(Configuration)" /> + + + + <_MlsppBuildOutput Include="$(_MlsppBuildOutputPath)\**\*"/> + <_MlsppBuildOutput Update="%(Identity)" Condition="'$(MlsppCopyBuildOutput)' == 'true'"> + <_CopyPath>-> $(MSBuildProjectDirectory)\$(OutputPath)\$(MlsppBaseOutputPath)\$([MSBuild]::MakeRelative('$(_MlsppBuildOutputPath)', '%(FullPath)')) + + + + + + + + + PreserveNewest + $(MlsppBaseOutputPath)\$([MSBuild]::MakeRelative('$(_MlsppBuildOutputPath)', '%(FullPath)')) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_MlsppInstalled Include="$(_MlsppInstallPath)\**\*"/> + + + + + + + $(_MlsppInstallPath)\share\MLSPP\ + + + + + + + + + <_Args>$(MlsppCMakeBuildArgs.Replace('=', ' ')) + <_Pattern>(?:^|\s)(?:-j|--parallel)\s*(\d+) + + + <_HasParallel>$([System.Text.RegularExpressions.Regex]::IsMatch('$(_Args)', '$(_Pattern)')) + + + <_TotalJobs Condition="'$(_HasParallel)' == 'True'">$([System.Text.RegularExpressions.Regex]::Match('$(_Args)', '.*(?:-j|--parallel)\s*(\d+)').Groups[1].Value) + <_TotalJobs Condition="'$(_TotalJobs)' == ''">$([System.Environment]::ProcessorCount) + + + <_ConfigCount>@(_MlsppCMakeConfigRemain->Count()) + <_ConfigCount Condition="'$(_ConfigCount)' == '0' AND '$(Configuration)' != ''">1 + $([MSBuild]::Divide($(_TotalJobs), $(_ConfigCount))) + 1 + + <_MlsppIntCMakeBuildArgs Condition="'$(JobsPerConfig)' != '1'">MlsppCMakeBuildArgs=-j$(JobsPerConfig) + + + + + + + <_MLsppConfigToBuild Include="$(MSBuildProjectFile)"> + $(_MlsppIntCMakeBuildArgs);%(_MlsppCMakeConfigRemain.MSBuildProperties) + BuildMlsppNative + + + + + + + + + + + + + <_MlsppOuts Include="@(_MlsppCMakeConfig)"> + <_Ext>%(_MlsppLibExt.Identity) + + <_MlsppOuts Update="%(Identity)" Condition="'$(CMakeStaticRT)' == 'true'"> + <_OutputPath>$(_MlsppBuildDirPreType)\static_rt\$([MSBuild]::MakeRelative('$(_MlsppBuildDirPreType)\static', '%(_OutputPath)')) + + + <_MlsppPackageFiles Include="%(_MlsppOuts._OutputPath)\**\*.%(_MlsppOuts._Ext)" > + <_Config>%(_MlsppOuts.Identity) + <_OutputPath>%(_MlsppOuts._OutputPath) + + + + + + true + lib\$(RuntimeIdentifier)\%(_MlsppPackageFiles._Config)\$([MSBuild]::MakeRelative('%(_MlsppPackageFiles._OutputPath)', '%(_MlsppPackageFiles.FullPath)')) + + + + + + + + + + + diff --git a/NetCord/ThirdParty/MLSpp/mlspp b/NetCord/ThirdParty/MLSpp/mlspp new file mode 160000 index 00000000..1cc50a12 --- /dev/null +++ b/NetCord/ThirdParty/MLSpp/mlspp @@ -0,0 +1 @@ +Subproject commit 1cc50a124a3bc4e143a787ec934280dc70c1034d diff --git a/NetCord/ThirdParty/fix_msvc.cmake b/NetCord/ThirdParty/fix_msvc.cmake new file mode 100644 index 00000000..472ad53e --- /dev/null +++ b/NetCord/ThirdParty/fix_msvc.cmake @@ -0,0 +1,13 @@ +if(MSVC) + # Debug, Release, RelWithDebInfo, MinSizeRel ׂĂɑ΂ + # /MD (I) /MT (ÓI) ɒu + foreach(flag_var + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif() + endforeach() +endif() diff --git a/README.md b/README.md index b3d29496..1603f8d8 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ You can install NetCord packages via NuGet package manager: | **[NetCord.Hosting](https://www.nuget.org/packages/NetCord.Hosting)** | Provides .NET Generic Host extensions for the NetCord package. | | **[NetCord.Hosting.Services](https://www.nuget.org/packages/NetCord.Hosting.Services)** | Provides .NET Generic Host extensions for the NetCord.Services package. | | **[NetCord.Hosting.AspNetCore](https://www.nuget.org/packages/NetCord.Hosting.AspNetCore)** | Provides ASP.NET Core extensions for seamless handling of HTTP events. | +| | | +| **[NetCord.ThirdParty.Libdave](https://www.nuget.org/packages/NetCord.ThirdParty.Libdave)** | Provides pre-built binaries for Libdave used by Voice feature | ## 2. 🚀 Showcase diff --git a/Resources/NuGet/README.md b/Resources/NuGet/README.md index 89a1d414..73e08eaf 100644 --- a/Resources/NuGet/README.md +++ b/Resources/NuGet/README.md @@ -25,6 +25,8 @@ You can install NetCord packages via NuGet package manager: | **[NetCord.Hosting](https://www.nuget.org/packages/NetCord.Hosting)** | Provides .NET Generic Host extensions for the NetCord package. | | **[NetCord.Hosting.Services](https://www.nuget.org/packages/NetCord.Hosting.Services)** | Provides .NET Generic Host extensions for the NetCord.Services package. | | **[NetCord.Hosting.AspNetCore](https://www.nuget.org/packages/NetCord.Hosting.AspNetCore)** | Provides ASP.NET Core extensions for seamless handling of HTTP events. | +| | | +| **[NetCord.ThirdParty.Libdave](https://www.nuget.org/packages/NetCord.ThirdParty.Libdave)** | Provides pre-built binaries for Libdave used by Voice feature | ## 2. 🚀 Showcase