This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: VS2019 build error. build: revise
- Loading branch information
Showing
8 changed files
with
282 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: build & publish | ||
name: build | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
|
@@ -28,45 +28,12 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
#- name: setup wdk.vsix | ||
# shell: pwsh | ||
# run: | | ||
# $FilePath = Resolve-Path "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\*\WDK.vsix" | ||
# Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion "2022" -InstallOnly | ||
|
||
- name: enable X86 and ARM build support | ||
working-directory: ${{github.workspace}} | ||
shell: pwsh | ||
run: | | ||
.\.github\workflows\EnableX86AndARM.ps1 | ||
- name: build nuspec | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: pwsh | ||
run: | | ||
if($env:GITHUB_REF.StartsWith("refs/tags/v", "CurrentCultureIgnoreCase")) | ||
{ | ||
$BuildVersion = $env:GITHUB_REF.Remove(0, 11); | ||
echo "BuildVersion=$BuildVersion" >> $env:GITHUB_ENV | ||
# github的内置版本有Bug,此行必须添加,否则无法获得内容 | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
$releaseNotes = & git tag -l --format='%(contents)' $env:GITHUB_REF.Remove(0, 10) | ||
$content = [System.IO.File]::ReadAllText("nuget\ucxxrt.nuspec") | ||
$releaseNotesToken = '$releaseNotes$' | ||
$releaseNotesIndex = $content.IndexOf($releaseNotesToken) | ||
if($releaseNotesIndex -ne -1) | ||
{ | ||
echo $content.Substring(0, $releaseNotesIndex) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline | ||
echo $releaseNotes | out-file "nuget\ucxxrt-new.nuspec" -Append | ||
echo $content.Remove(0, $releaseNotesIndex + $releaseNotesToken.Length) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline -Append | ||
} | ||
} | ||
- name: compile | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
|
@@ -78,38 +45,3 @@ jobs: | |
name: ucxxrt | ||
path: ucxxrt\ | ||
if-no-files-found: error | ||
|
||
- name: pack zip | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: 7z a -tzip ucxxrt.zip ucxxrt\ | ||
|
||
- name: pack nuget | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: | | ||
if "${{env.BuildVersion}}" NEQ "" ( | ||
nuget pack nuget\ucxxrt-new.nuspec -Properties version=${{env.BuildVersion}};commit=%GITHUB_SHA% | ||
) | ||
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% | ||
- name: publish a version | ||
if: contains(github.ref, 'tags/') | ||
uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
ucxxrt.zip | ||
*.nupkg | ||
- name: publish nuget | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: | | ||
nuget push ucxxrt.${{env.BuildVersion}}.nupkg -ApiKey ${{ secrets.NUGET_TOKEN }} -Source https://api.nuget.org/v3/index.json | ||
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: publish | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: windows-2022 | ||
|
||
# Any commit that contains [build] will now trigger these jobs, everything else will be skipped. | ||
# if: "contains(github.event.head_commit.message, '[build]')" | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
|
||
#- name: setup wdk.vsix | ||
# shell: pwsh | ||
# run: | | ||
# $FilePath = Resolve-Path "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\*\WDK.vsix" | ||
# Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion "2022" -InstallOnly | ||
|
||
- name: enable X86 and ARM build support | ||
working-directory: ${{github.workspace}} | ||
shell: pwsh | ||
run: | | ||
.\.github\workflows\EnableX86AndARM.ps1 | ||
- name: build nuspec | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: pwsh | ||
run: | | ||
if($env:GITHUB_REF.StartsWith("refs/tags/v", "CurrentCultureIgnoreCase")) | ||
{ | ||
$BuildVersion = $env:GITHUB_REF.Remove(0, 11); | ||
echo "BuildVersion=$BuildVersion" >> $env:GITHUB_ENV | ||
# github的内置版本有Bug,此行必须添加,否则无法获得内容 | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
$releaseNotes = & git tag -l --format='%(contents)' $env:GITHUB_REF.Remove(0, 10) | ||
$content = [System.IO.File]::ReadAllText("nuget\ucxxrt.nuspec") | ||
$releaseNotesToken = '$releaseNotes$' | ||
$releaseNotesIndex = $content.IndexOf($releaseNotesToken) | ||
if($releaseNotesIndex -ne -1) | ||
{ | ||
echo $content.Substring(0, $releaseNotesIndex) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline | ||
echo $releaseNotes | out-file "nuget\ucxxrt-new.nuspec" -Append | ||
echo $content.Remove(0, $releaseNotesIndex + $releaseNotesToken.Length) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline -Append | ||
} | ||
} | ||
- name: compile | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: call .\.github\workflows\build.bat | ||
|
||
- name: upload an artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ucxxrt | ||
path: ucxxrt\ | ||
if-no-files-found: error | ||
|
||
- name: pack zip | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: 7z a -tzip ucxxrt.zip ucxxrt\ | ||
|
||
- name: pack nuget | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: | | ||
if "${{env.BuildVersion}}" NEQ "" ( | ||
nuget pack nuget\ucxxrt-new.nuspec -Properties version=${{env.BuildVersion}};commit=%GITHUB_SHA% | ||
) | ||
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% | ||
- name: publish a version | ||
if: contains(github.ref, 'tags/') | ||
uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
ucxxrt.zip | ||
*.nupkg | ||
- name: publish nuget | ||
if: contains(github.ref, 'tags/') | ||
working-directory: ${{github.workspace}} | ||
shell: cmd | ||
run: | | ||
nuget push ucxxrt.${{env.BuildVersion}}.nupkg -ApiKey ${{ secrets.NUGET_TOKEN }} -Source https://api.nuget.org/v3/index.json | ||
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/* | ||
* PROJECT: Universal C++ RunTime (UCXXRT) | ||
* FILE: kallocator.cpp | ||
* DATA: 2022/11/19 | ||
* | ||
* PURPOSE: Universal C++ RunTime | ||
* | ||
* LICENSE: Relicensed under The MIT License from The CC BY 4.0 License | ||
* | ||
* DEVELOPER: MiroKaku (miro.kaku AT Outlook.com) | ||
*/ | ||
|
||
#pragma once | ||
#include <yvals.h> | ||
#include "knew.h" | ||
#include <type_traits> | ||
|
||
_STD_BEGIN | ||
|
||
#ifndef _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1 | ||
#endif | ||
|
||
#ifndef _CXX20_DEPRECATE_IS_ALWAYS_EQUAL | ||
#define _CXX20_DEPRECATE_IS_ALWAYS_EQUAL | ||
#endif | ||
|
||
#ifndef _NODISCARD_RAW_PTR_ALLOC | ||
#define _NODISCARD_RAW_PTR_ALLOC _NODISCARD | ||
#endif | ||
|
||
|
||
template <class T> | ||
_NODISCARD constexpr void* ___voidify_iter(T iter) noexcept { | ||
if constexpr (::std::is_pointer_v<T>) { | ||
return const_cast<void*>(static_cast<const volatile void*>(iter)); | ||
} | ||
else { | ||
return const_cast<void*>(static_cast<const volatile void*>(::std::addressof(*iter))); | ||
} | ||
} | ||
|
||
template <typename T, POOL_TYPE _Pool = PagedPool, unsigned long _Tag = 'trcu'> | ||
class kallocator { | ||
public: | ||
static_assert(!::std::is_const_v<T>, "The C++ Standard forbids containers of const elements " | ||
"because kallocator<const T> is ill-formed."); | ||
|
||
using value_type = T; | ||
using size_type = size_t; | ||
using difference_type = ptrdiff_t; | ||
using propagate_on_container_move_assignment = true_type; | ||
|
||
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
using pointer _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = T*; | ||
using const_pointer _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = const T*; | ||
using reference _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = T&; | ||
using const_reference _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = const T&; | ||
using is_always_equal _CXX20_DEPRECATE_IS_ALWAYS_EQUAL = true_type; | ||
|
||
template <typename N> | ||
struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind { | ||
using other = kallocator<N, _Pool, _Tag>; | ||
}; | ||
|
||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD T* address(T& value) const noexcept { | ||
return ::std::addressof(value); | ||
} | ||
|
||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD const T* address(const T& value) const noexcept { | ||
return ::std::addressof(value); | ||
} | ||
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
|
||
constexpr kallocator() noexcept {} | ||
constexpr kallocator(const kallocator&) noexcept = default; | ||
|
||
template <typename N> | ||
constexpr kallocator(const kallocator<N, _Pool, _Tag>&) noexcept {} | ||
_CONSTEXPR20 ~kallocator() = default; | ||
_CONSTEXPR20 kallocator& operator=(const kallocator&) = default; | ||
|
||
_CONSTEXPR20 void deallocate(T* const ptr, const size_t count) { | ||
_STL_ASSERT(ptr != nullptr || count == 0, "null pointer cannot point to a block of non-zero size"); | ||
__noop(count); // ignore | ||
|
||
// no overflow check on the following multiply; we assume allocate did that check | ||
::operator delete(ptr, _Pool, _Tag); | ||
} | ||
|
||
_NODISCARD_RAW_PTR_ALLOC _CONSTEXPR20 __declspec(allocator) T* allocate(const size_t count) { | ||
static_assert(sizeof(value_type) > 0, "value_type must be complete before calling allocate."); | ||
return static_cast<T*>(::operator new(sizeof(T) * count, _Pool, _Tag)); | ||
} | ||
|
||
#if _HAS_CXX23 | ||
_NODISCARD_RAW_PTR_ALLOC constexpr allocation_result<T*> allocate_at_least( | ||
_CRT_GUARDOVERFLOW const size_t count) { | ||
return { allocate(count), count }; | ||
} | ||
#endif // _HAS_CXX23 | ||
|
||
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD_RAW_PTR_ALLOC __declspec(allocator) T* allocate( | ||
_CRT_GUARDOVERFLOW const size_t count, const void*) { | ||
return allocate(count); | ||
} | ||
|
||
template <typename N, typename... Ns> | ||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS void construct(N* const ptr, Ns&&... args) { | ||
::new (___voidify_iter(ptr)) N(::std::forward<Ns>(args)...); | ||
} | ||
|
||
template <typename N> | ||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS void destroy(N* const object) { | ||
object->~N(); | ||
} | ||
|
||
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD size_t max_size() const noexcept { | ||
return static_cast<size_t>(-1) / sizeof(T); | ||
} | ||
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
}; | ||
|
||
|
||
#if _HAS_DEPRECATED_ALLOCATOR_VOID || _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
template <> | ||
class kallocator<void> { | ||
public: | ||
using value_type = void; | ||
|
||
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
using pointer _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = void*; | ||
using const_pointer _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = const void*; | ||
|
||
template <class N> | ||
struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind { | ||
using other = kallocator<N>; | ||
}; | ||
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
|
||
#if _HAS_CXX20 | ||
using size_type = size_t; | ||
using difference_type = ptrdiff_t; | ||
|
||
using propagate_on_container_move_assignment = true_type; | ||
using is_always_equal _CXX20_DEPRECATE_IS_ALWAYS_EQUAL = true_type; | ||
#endif // _HAS_CXX20 | ||
}; | ||
#endif // _HAS_DEPRECATED_ALLOCATOR_VOID || _HAS_DEPRECATED_ALLOCATOR_MEMBERS | ||
|
||
|
||
_STD_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.