-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows support #843
base: master
Are you sure you want to change the base?
Windows support #843
Changes from all commits
749ea81
a58cb96
5d43917
92ba7d1
c00a2f2
a256b9e
4c19ac8
7e13ff4
c386369
f79ddb3
5fb7c2b
32cab31
36a02c8
edd4d7c
dd390d7
a112375
ca348be
5df6ae7
6de90b5
e380b3f
0629be8
ceb39b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
version: 2.1 | ||
orbs: | ||
win: circleci/[email protected] | ||
|
||
parameters: | ||
benchmark: | ||
|
@@ -400,6 +402,34 @@ jobs: | |
cmake_options: -DNATIVE=ON | ||
- test | ||
|
||
release-windows: | ||
executor: win/server-2022 | ||
environment: | ||
CMAKE_BUILD_TYPE: Release | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Setup environment (bash)" | ||
shell: bash | ||
command: | | ||
echo 'export PATH=$PATH:"/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin"' >> $BASH_ENV | ||
- run: | ||
name: 'Configure' | ||
shell: powershell | ||
command: | | ||
$ErrorActionPreference = "Stop" | ||
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64 | ||
which cmake | ||
cmake -S . -B ~/build -G Ninja -DCMAKE_INSTALL_PREFIX=C:\install -DCMAKE_CXX_STANDARD=20 -DFIZZY_TESTING=ON | ||
- run: | ||
name: 'Build' | ||
shell: powershell | ||
command: | | ||
$ErrorActionPreference = "Stop" | ||
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64 | ||
cmake --build ~/build | ||
- test | ||
|
||
coverage-clang: | ||
executor: linux-clang-latest | ||
steps: | ||
|
@@ -789,6 +819,7 @@ workflows: | |
- release-native-linux | ||
- release-macos | ||
- release-native-macos | ||
- release-windows | ||
- coverage-gcc: | ||
requires: | ||
- fetch-spectests | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# Hunter local configuration. | ||
|
||
hunter_config( | ||
GTest | ||
VERSION 1.11.0 | ||
URL https://github.com/google/googletest/archive/release-1.11.0.tar.gz | ||
SHA1 7b100bb68db8df1060e178c495f3cbe941c9b058 | ||
CMAKE_ARGS | ||
HUNTER_INSTALL_LICENSE_FILES=LICENSE | ||
gtest_force_shared_crt=TRUE | ||
) | ||
#hunter_config( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The newer Hunter contains this. |
||
# GTest | ||
# VERSION 1.11.0 | ||
# URL https://github.com/google/googletest/archive/release-1.11.0.tar.gz | ||
# SHA1 7b100bb68db8df1060e178c495f3cbe941c9b058 | ||
# CMAKE_ARGS | ||
# HUNTER_INSTALL_LICENSE_FILES=LICENSE | ||
# gtest_force_shared_crt=TRUE | ||
#) | ||
|
||
hunter_config( | ||
benchmark | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ if(NOT CMAKE_CONFIGURATION_TYPES) | |
endif() | ||
|
||
HunterGate( | ||
URL https://github.com/cpp-pm/hunter/archive/v0.23.294.tar.gz | ||
SHA1 0dd1ee8723d54a15822519c17a877c1f281fce39 | ||
URL https://github.com/cpp-pm/hunter/archive/v0.24.13.tar.gz | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to update to 0.23.371 at least in order to support MSVC 2022. |
||
SHA1 2bc7384b2bf27db5b3847739a6a5361fa04075e7 | ||
LOCAL | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,14 @@ set(include_dir ${source_dir}/include) | |
set(uvwasi_library ${binary_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}uvwasi_a${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
set(uv_library ${binary_dir}/_deps/libuv-build/${CMAKE_STATIC_LIBRARY_PREFIX}uv_a${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
|
||
# This is hack. Should fix proper uvwasi.cmake integration. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theses are imported in https://github.com/nodejs/uvwasi/blob/master/cmake/FindLibUV.cmake, but we do a botched job at cmake-integrating uvwasi. |
||
if(WIN32) | ||
list(APPEND uv_library iphlpapi) | ||
list(APPEND uv_library userenv) | ||
list(APPEND uv_library psapi) | ||
list(APPEND uv_library ws2_32) | ||
endif() | ||
|
||
if(UNIX AND NOT APPLE) | ||
set(system_libs "pthread;dl;rt") | ||
endif() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,22 +31,22 @@ template <typename T> | |
inline T read(const uint8_t*& input) noexcept | ||
{ | ||
T ret; | ||
__builtin_memcpy(&ret, input, sizeof(ret)); | ||
memcpy(&ret, input, sizeof(ret)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be fixed. |
||
input += sizeof(ret); | ||
return ret; | ||
} | ||
|
||
template <typename T> | ||
inline void store(bytes& input, size_t offset, T value) noexcept | ||
{ | ||
__builtin_memcpy(input.data() + offset, &value, sizeof(value)); | ||
memcpy(input.data() + offset, &value, sizeof(value)); | ||
} | ||
|
||
template <typename T> | ||
inline T load(bytes_view input, size_t offset) noexcept | ||
{ | ||
T ret; | ||
__builtin_memcpy(&ret, input.data() + offset, sizeof(ret)); | ||
memcpy(&ret, input.data() + offset, sizeof(ret)); | ||
return ret; | ||
} | ||
|
||
|
@@ -459,7 +459,11 @@ T fnearest(T value) noexcept | |
} | ||
|
||
template <typename T> | ||
__attribute__((no_sanitize("float-divide-by-zero"))) inline constexpr T fdiv(T a, T b) noexcept | ||
#ifndef _MSC_VER | ||
__attribute__((no_sanitize("float-divide-by-zero"))) | ||
#endif | ||
inline constexpr T | ||
fdiv(T a, T b) noexcept | ||
{ | ||
static_assert(std::is_floating_point_v<T>); | ||
static_assert(std::numeric_limits<T>::is_iec559); | ||
|
@@ -494,9 +498,11 @@ inline T fmax(T a, T b) noexcept | |
return a < b ? b : a; | ||
} | ||
|
||
|
||
__attribute__((no_sanitize("float-cast-overflow"))) inline constexpr float demote( | ||
double value) noexcept | ||
#ifndef _MSC_VER | ||
__attribute__((no_sanitize("float-cast-overflow"))) | ||
#endif | ||
inline constexpr float | ||
demote(double value) noexcept | ||
{ | ||
// The float-cast-overflow UBSan check disabled for this conversion. In older clang versions | ||
// (up to 8.0) it reports a failure when non-infinity f64 value is converted to f32 infinity. | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,6 +8,7 @@ | |||||||||
#include "parser.hpp" | ||||||||||
#include "stack.hpp" | ||||||||||
#include <cassert> | ||||||||||
#include <cstring> | ||||||||||
|
||||||||||
namespace fizzy | ||||||||||
{ | ||||||||||
|
@@ -16,7 +17,7 @@ namespace | |||||||||
template <typename T> | ||||||||||
inline void store(uint8_t* dst, T value) noexcept | ||||||||||
{ | ||||||||||
__builtin_memcpy(dst, &value, sizeof(value)); | ||||||||||
memcpy(dst, &value, sizeof(value)); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CWE 805 advisory: suspicious sizeof in strncpy, strncat or memcpy ℹ️ Learn about @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. Was this a good recommendation? |
||||||||||
} | ||||||||||
|
||||||||||
template <typename T> | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ namespace fizzy::test | |
class WabtEngine final : public WasmEngine | ||
{ | ||
// mutable because getting RefPtr from Ref requires non-const Store | ||
mutable wabt::interp::Store m_store{([]() constexpr noexcept { | ||
mutable wabt::interp::Store m_store{([]() noexcept { | ||
wabt::Features features; | ||
features.disable_multi_value(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found by MSVC: [48/103] Building CXX object test\utils\CMakeFiles\test-utils.dir\wabt_engine.cpp.obj
FAILED: test/utils/CMakeFiles/test-utils.dir/wabt_engine.cpp.obj
C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe /nologo /TP -IC:\Users\circleci.PACKER-633B1A5A\project -IC:\Users\circleci.PACKER-633B1A5A\project\lib\fizzy -IC:\Users\circleci.PACKER-633B1A5A\project\include -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wabt -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wabt-build -external:IC:\Users\circleci.PACKER-633B1A5A\build\_deps\src\wasm3 -external:IC:\Users\circleci.PACKER-633B1A5A\.hunter\_Base\2bc7384\4753fe5\c0cf92b\Install\include -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -MD /W4 /WX /wd4068 -std:c++20 /showIncludes /Fotest\utils\CMakeFiles\test-utils.dir\wabt_engine.cpp.obj /Fdtest\utils\CMakeFiles\test-utils.dir\test-utils.pdb /FS -c C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(19): error C3615: constexpr function 'fizzy::test::WabtEngine::<lambda_1>::operator ()' cannot result in a constant expression
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(21): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(21): note: see usage of 'wabt::Features::disable_multi_value'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(22): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(22): note: see usage of 'wabt::Features::disable_sat_float_to_int'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(23): note: failure was caused by call of undefined function or one not declared 'constexpr'
C:\Users\circleci.PACKER-633B1A5A\project\test\utils\wabt_engine.cpp(23): note: see usage of 'wabt::Features::disable_sign_extension'
[49/103] Building CXX object test\utils\CMakeFiles\test-utils.dir\asserts.cpp.obj
`` |
||
features.disable_sat_float_to_int(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++20 is forced here.