-
Notifications
You must be signed in to change notification settings - Fork 786
Fixed build configs and invoke for windows arm64 #4909
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
Open
joevdh
wants to merge
1
commit into
bytecodealliance:main
Choose a base branch
from
joevdh:WindowsOnArm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,12 +4,18 @@ | |
| set (IWASM_COMMON_DIR ${CMAKE_CURRENT_LIST_DIR}) | ||
|
|
||
| include_directories (${IWASM_COMMON_DIR}) | ||
| if (MSVC AND WAMR_BUILD_PLATFORM STREQUAL "windows" AND WAMR_BUILD_TARGET MATCHES "AARCH64.*") | ||
| if (DEFINED ENV{VCToolsInstallDir}) | ||
| if (MSVC AND WAMR_BUILD_PLATFORM STREQUAL "windows" AND WAMR_BUILD_TARGET MATCHES "AARCH64.*" AND NOT WAMR_BUILD_WAMR_COMPILER) | ||
| if (CMAKE_ASM_MARMASM_COMPILER) | ||
|
Contributor
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. Concern:
|
||
| # Use the already detected assembler | ||
| set(_ARMASM64_EXE "${CMAKE_ASM_MARMASM_COMPILER}") | ||
| elseif (DEFINED ENV{VCToolsInstallDir} OR VCToolsInstallDir) | ||
| if (NOT VCToolsInstallDir) | ||
| set(VCToolsInstallDir "$ENV{VCToolsInstallDir}") | ||
| endif() | ||
| # Detect host tool dir | ||
| set(_ARMASM64_CANDIDATES | ||
| "$ENV{VCToolsInstallDir}/bin/HostX64/ARM64/armasm64.exe" | ||
| "$ENV{VCToolsInstallDir}/bin/HostARM64/arm64/armasm64.exe") | ||
| "${VCToolsInstallDir}bin/Hostx64/arm64/armasm64.exe" | ||
| "${VCToolsInstallDir}bin/Hostarm64/arm64/armasm64.exe") | ||
| set(_ARMASM64_EXE "") | ||
| foreach(_p IN LISTS _ARMASM64_CANDIDATES) | ||
| if (EXISTS "${_p}") | ||
|
|
@@ -18,27 +24,42 @@ if (MSVC AND WAMR_BUILD_PLATFORM STREQUAL "windows" AND WAMR_BUILD_TARGET MATCHE | |
| endif() | ||
| endforeach() | ||
| if (_ARMASM64_EXE STREQUAL "") | ||
| message(FATAL_ERROR "armasm64.exe not found under VCToolsInstallDir") | ||
| message(FATAL_ERROR "armasm64.exe not found under VCToolsInstallDir: ${VCToolsInstallDir}") | ||
| endif() | ||
| else() | ||
| message(FATAL_ERROR "VCToolsInstallDir is not defined. Please run from a Developer Command Prompt or specify armasm64.exe manually.") | ||
| endif() | ||
|
|
||
| # Wrapper without spaces to avoid quoting hell on NMake/cmd.exe | ||
| set(_WRAP "${CMAKE_BINARY_DIR}/armasm64_wrapper.bat") | ||
| file(WRITE "${_WRAP}" | ||
| "@echo off\r\n\"${_ARMASM64_EXE}\" %*\r\n") | ||
| # Wrapper without spaces to avoid quoting hell on NMake/cmd.exe | ||
| set(_WRAP "${CMAKE_BINARY_DIR}/armasm64_wrapper.bat") | ||
| file(WRITE "${_WRAP}" | ||
| "@echo off\r\n" | ||
| "setlocal enabledelayedexpansion\r\n" | ||
| "set ARGS=\r\n" | ||
| "for %%A in (%*) do (\r\n" | ||
| " if /I not \"%%~A\"==\"/experimental:c11atomics\" (\r\n" | ||
| " set ARGS=!ARGS! %%A\r\n" | ||
| " )\r\n" | ||
| ")\r\n" | ||
| "\"${_ARMASM64_EXE}\" !ARGS!\r\n") | ||
|
|
||
| # Use wrapper as compiler (no spaces in path) | ||
| set(CMAKE_ASM_MASM_COMPILER | ||
| "${_WRAP}" | ||
| CACHE FILEPATH "" FORCE) | ||
| # Use wrapper as compiler (no spaces in path) | ||
| set(CMAKE_ASM_MASM_COMPILER | ||
| "${_WRAP}" | ||
| CACHE FILEPATH "" FORCE) | ||
|
|
||
| # Quote ONLY object and source (compiler path has no spaces now) | ||
| set(CMAKE_ASM_MASM_COMPILE_OBJECT | ||
| "<CMAKE_ASM_MASM_COMPILER> /nologo -o \"<OBJECT>\" \"<SOURCE>\"" | ||
| CACHE STRING "" FORCE) | ||
| set(CMAKE_ASM_MARMASM_COMPILER | ||
| "${_WRAP}" | ||
| CACHE FILEPATH "" FORCE) | ||
|
|
||
| else() | ||
| message(FATAL_ERROR "VCToolsInstallDir is not defined. Please run from a Developer Command Prompt or specify armasm64.exe manually.") | ||
| endif() | ||
| # Quote ONLY object and source (compiler path has no spaces now) | ||
| set(CMAKE_ASM_MASM_COMPILE_OBJECT | ||
| "<CMAKE_ASM_MASM_COMPILER> /nologo -o \"<OBJECT>\" \"<SOURCE>\"" | ||
| CACHE STRING "" FORCE) | ||
|
|
||
| set(CMAKE_ASM_MARMASM_COMPILE_OBJECT | ||
| "<CMAKE_ASM_MARMASM_COMPILER> /nologo -o \"<OBJECT>\" \"<SOURCE>\"" | ||
| CACHE STRING "" FORCE) | ||
| endif() | ||
|
|
||
| add_definitions(-DBH_MALLOC=wasm_runtime_malloc) | ||
|
|
@@ -61,7 +82,7 @@ if (CMAKE_OSX_ARCHITECTURES) | |
| endif() | ||
| endif() | ||
|
|
||
| if (WAMR_BUILD_INVOKE_NATIVE_GENERAL EQUAL 1) | ||
| if (WAMR_BUILD_INVOKE_NATIVE_GENERAL EQUAL 1 AND NOT (MSVC AND WAMR_BUILD_PLATFORM STREQUAL "windows" AND WAMR_BUILD_TARGET MATCHES "AARCH64.*")) | ||
| # Use invokeNative C version instead of asm code version | ||
| # if WAMR_BUILD_INVOKE_NATIVE_GENERAL is explicitly set. | ||
| # Note: | ||
|
|
@@ -117,31 +138,43 @@ elseif (WAMR_BUILD_TARGET MATCHES "AARCH64.*") | |
| if (NOT WAMR_BUILD_SIMD EQUAL 1) | ||
| if (WAMR_BUILD_PLATFORM STREQUAL "windows") | ||
| if (MSVC) | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64.asm) | ||
| set(_WAMR_ARM64_MASM_SOURCES ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64.asm) | ||
| set_source_files_properties(${_WAMR_ARM64_MASM_SOURCES} | ||
| PROPERTIES | ||
| LANGUAGE ASM_MASM | ||
| COMPILE_DEFINITIONS "" | ||
| INCLUDE_DIRECTORIES "" | ||
| COMPILE_OPTIONS "/nologo" | ||
| set(_WAMR_ARM64_MASM_SOURCE ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64.asm) | ||
| set(_WAMR_ARM64_MASM_OBJ ${CMAKE_CURRENT_BINARY_DIR}/invokeNative_armasm64.obj) | ||
| add_custom_command( | ||
| OUTPUT ${_WAMR_ARM64_MASM_OBJ} | ||
| COMMAND ${CMAKE_ASM_MASM_COMPILER} /nologo -o "${_WAMR_ARM64_MASM_OBJ}" "${_WAMR_ARM64_MASM_SOURCE}" | ||
| DEPENDS ${_WAMR_ARM64_MASM_SOURCE} | ||
| COMMENT "Assembling invokeNative_armasm64.asm" | ||
| VERBATIM | ||
| ) | ||
| set_source_files_properties(${_WAMR_ARM64_MASM_OBJ} | ||
| PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE | ||
| ) | ||
| set (source_all ${c_source_all} ${_WAMR_ARM64_MASM_OBJ}) | ||
| else () | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_aarch64.s) | ||
| endif () | ||
| else () | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_aarch64.s) | ||
| endif () | ||
| else() | ||
| if (WAMR_BUILD_PLATFORM STREQUAL "windows") | ||
| if (MSVC) | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64_simd.asm) | ||
| set(_WAMR_ARM64_MASM_SOURCES_SIMD ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64_simd.asm) | ||
| set_source_files_properties(${_WAMR_ARM64_MASM_SOURCES_SIMD} | ||
| PROPERTIES | ||
| LANGUAGE ASM_MASM | ||
| COMPILE_DEFINITIONS "" | ||
| INCLUDE_DIRECTORIES "" | ||
| COMPILE_OPTIONS "/nologo" | ||
| set(_WAMR_ARM64_MASM_SIMD_SOURCE ${IWASM_COMMON_DIR}/arch/invokeNative_armasm64_simd.asm) | ||
| set(_WAMR_ARM64_MASM_SIMD_OBJ ${CMAKE_CURRENT_BINARY_DIR}/invokeNative_armasm64_simd.obj) | ||
| add_custom_command( | ||
| OUTPUT ${_WAMR_ARM64_MASM_SIMD_OBJ} | ||
| COMMAND ${CMAKE_ASM_MASM_COMPILER} /nologo -o "${_WAMR_ARM64_MASM_SIMD_OBJ}" "${_WAMR_ARM64_MASM_SIMD_SOURCE}" | ||
| DEPENDS ${_WAMR_ARM64_MASM_SIMD_SOURCE} | ||
| COMMENT "Assembling invokeNative_armasm64_simd.asm" | ||
| VERBATIM | ||
| ) | ||
| set_source_files_properties(${_WAMR_ARM64_MASM_SIMD_OBJ} | ||
| PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE | ||
| ) | ||
| set (source_all ${c_source_all} ${_WAMR_ARM64_MASM_SIMD_OBJ}) | ||
| else () | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_aarch64_simd.s) | ||
| endif () | ||
| else () | ||
| set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_aarch64_simd.s) | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What specific build issue does skipping
WAMR_BUILD_WAMR_COMPILERsolve? The wamr-compiler also needs to compile for Windows ARM64, so it's not clear why thisscenario should be excluded from the ARM64 assembly settings. Could you provide more context on this?