Skip to content

Commit

Permalink
Implement building on Win64
Browse files Browse the repository at this point in the history
Signed-off-by: Seonghyun Kim <[email protected]>
  • Loading branch information
ksh8281 authored and clover2123 committed Jun 29, 2023
1 parent 0596de7 commit 3a3ef88
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/es-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,39 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
with:
detached: true
- uses: lukka/get-cmake@latest
- uses: GuillaumeFalourd/[email protected]
with:
sdk-version: 20348
- uses: ilammy/[email protected]
with:
arch: x86
sdk: "10.0.20348.0"
- uses: lukka/get-cmake@latest
- name: Build Win32 Release
- name: Install msvc redist package
run: |
(new-object System.Net.WebClient).DownloadFile('https://github.com/abbodi1406/vcredist/releases/download/v0.73.0/VisualCppRedist_AIO_x86_x64.exe','VisualCppRedist_AIO_x86_x64.exe')
.\VisualCppRedist_AIO_x86_x64.exe /y
- name: Copy octane
run: |
copy test\octane\*.js
dir
- name: Build Win32 Release
run: |
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_ARCH=x86 -DESCARGOT_MODE=release -Bout/win32_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
cd out/win32_release_ninja
ninja
copy ..\..\test\octane\*.js
.\escargot.exe run.js
CMake --build out/win32_release_ninja/ --config Release
.\out\win32_release_ninja\escargot.exe run.js
- uses: ilammy/[email protected]
with:
arch: x64
sdk: "10.0.20348.0"
- name: Build Win64 Release
run: |
CMake -G "Visual Studio 16 2019" -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=x64 -DESCARGOT_ARCH=x64 -DESCARGOT_MODE=release -Bout/win64_release_ninja/ -DESCARGOT_HOST=windows -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
CMake --build out/win64_release_ninja/ --config Release
.\out\win64_release_ninja\escargot.exe run.js
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
build-test-on-android:
runs-on: macos-12
strategy:
Expand Down
4 changes: 2 additions & 2 deletions src/Escargot.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ void customEscargotErrorLogger(const char* format, ...);
#define FALLTHROUGH
#endif

#if defined(__BYTE_ORDER__) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(_M_IX86) || defined(__ia64) || defined(__ia64__) || defined(_M_IA64) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(ANDROID)
#if (defined(__BYTE_ORDER__) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(_M_IX86) || defined(__ia64) || defined(__ia64__) || defined(_M_IA64) || defined(_M_IX86) || defined(_M_X64) || defined(__ARMEL__) || defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(ANDROID)
#define ESCARGOT_LITTLE_ENDIAN
// #pragma message "little endian"
#elif defined(__BYTE_ORDER__) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
#elif (defined(__BYTE_ORDER__) && __BYTE_ORDER == __BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
#define ESCARGOT_BIG_ENDIAN
// #pragma message "big endian"
#else
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/BigInt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ BigInt* BigInt::leftShift(ExecutionState& state, BigInt* src) const
bf_init(ThreadLocal::bfContext(), &r);

slimb_t v2;
#if defined(ESCARGOT_32)
#if defined(ESCARGOT_32) || defined(COMPILER_MSVC)
bf_get_int32(&v2, src->bf(), 0);
if (v2 == std::numeric_limits<int32_t>::min()) {
v2 = std::numeric_limits<int32_t>::min() + 1;
Expand Down Expand Up @@ -502,7 +502,7 @@ BigInt* BigInt::rightShift(ExecutionState& state, BigInt* src) const
bf_init(ThreadLocal::bfContext(), &r);

slimb_t v2;
#if defined(ESCARGOT_32)
#if defined(ESCARGOT_32) || defined(COMPILER_MSVC)
bf_get_int32(&v2, src->bf(), 0);
if (v2 == std::numeric_limits<int32_t>::min()) {
v2 = std::numeric_limits<int32_t>::min() + 1;
Expand Down
9 changes: 9 additions & 0 deletions third_party/libbf/libbf.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@

#define LIMB_BITS (1 << LIMB_LOG2_BITS)

#if defined(_MSC_VER) && LIMB_BITS == 64
// use 32-bit mode for msvc
// msvc could not support __int128
#undef LIMB_LOG2_BITS
#undef LIMB_BITS
#define LIMB_LOG2_BITS 5
#define LIMB_BITS 32
#endif

#if LIMB_BITS == 64
typedef __int128 int128_t;
typedef unsigned __int128 uint128_t;
Expand Down

0 comments on commit 3a3ef88

Please sign in to comment.