Skip to content

Commit a8d5d79

Browse files
committed
wamr: Use more solid wrapper for armasm64 executable
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent b91b3c7 commit a8d5d79

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

lib/wasm-micro-runtime-WAMR-2.4.1/core/iwasm/common/iwasm_common.cmake

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,36 @@ set (IWASM_COMMON_DIR ${CMAKE_CURRENT_LIST_DIR})
66
include_directories (${IWASM_COMMON_DIR})
77
if (MSVC AND WAMR_BUILD_PLATFORM STREQUAL "windows" AND WAMR_BUILD_TARGET MATCHES "AARCH64.*")
88
if (DEFINED ENV{VCToolsInstallDir})
9+
# Detect host tool dir
10+
set(_ARMASM64_CANDIDATES
11+
"$ENV{VCToolsInstallDir}/bin/HostX64/ARM64/armasm64.exe"
12+
"$ENV{VCToolsInstallDir}/bin/HostARM64/arm64/armasm64.exe")
13+
set(_ARMASM64_EXE "")
14+
foreach(_p IN LISTS _ARMASM64_CANDIDATES)
15+
if (EXISTS "${_p}")
16+
set(_ARMASM64_EXE "${_p}")
17+
break()
18+
endif()
19+
endforeach()
20+
if (_ARMASM64_EXE STREQUAL "")
21+
message(FATAL_ERROR "armasm64.exe not found under VCToolsInstallDir")
22+
endif()
23+
24+
# Wrapper without spaces to avoid quoting hell on NMake/cmd.exe
25+
set(_WRAP "${CMAKE_BINARY_DIR}/armasm64_wrapper.bat")
26+
file(WRITE "${_WRAP}"
27+
"@echo off\r\n\"${_ARMASM64_EXE}\" %*\r\n")
28+
29+
# Use wrapper as compiler (no spaces in path)
930
set(CMAKE_ASM_MASM_COMPILER
10-
"$ENV{VCToolsInstallDir}/bin/HostARM64/arm64/armasm64.exe"
31+
"${_WRAP}"
1132
CACHE FILEPATH "" FORCE)
33+
34+
# Quote ONLY object and source (compiler path has no spaces now)
1235
set(CMAKE_ASM_MASM_COMPILE_OBJECT
13-
"<CMAKE_ASM_MASM_COMPILER> /nologo -o <OBJECT> <SOURCE>"
36+
"<CMAKE_ASM_MASM_COMPILER> /nologo -o \"<OBJECT>\" \"<SOURCE>\""
1437
CACHE STRING "" FORCE)
15-
set(_WAMR_ARM64_MASM_SOURCES
16-
${IWASM_COMMON_DIR}/arch/invokeNative_armarm64.asm
17-
${IWASM_COMMON_DIR}/arch/invokeNative_armarm64_simd.asm)
18-
foreach(_s IN LISTS _WAMR_ARM64_MASM_SOURCES)
19-
if (EXISTS "${_s}")
20-
set_source_files_properties("${_s}" PROPERTIES
21-
LANGUAGE ASM_MASM
22-
COMPILE_OPTIONS "/nologo"
23-
)
24-
endif()
25-
endforeach()
38+
2639
else()
2740
message(FATAL_ERROR "VCToolsInstallDir is not defined. Please run from a Developer Command Prompt or specify armasm64.exe manually.")
2841
endif()

0 commit comments

Comments
 (0)