https://git.reactos.org/?p=reactos.git;a=commitdiff;h=41130ab5c6a9173a5bac7…
commit 41130ab5c6a9173a5bac7ef2d6ea7e33c385cedd
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Thu Jan 21 10:20:21 2021 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Mar 3 08:34:32 2021 +0100
[CMAKE] Use ASM_MASM language when building with MSVC toolchain
CORE-17423
---
CMakeLists.txt | 7 ++++++-
sdk/cmake/Compiler/VISUAL-ASM.cmake | 2 --
sdk/cmake/msvc.cmake | 39 ++++++++++++++++---------------------
toolchain-msvc.cmake | 8 ++++----
4 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5795482d782..99488e38702 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,7 +213,12 @@ Enable this if the module uses typeid or dynamic_cast. You will
probably need to
endif()
# Activate support for assembly source files
- enable_language(ASM)
+ if (MSVC)
+ set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS s;S)
+ enable_language(ASM_MASM)
+ else()
+ enable_language(ASM)
+ endif()
# Activate language support for resource files
enable_language(RC)
diff --git a/sdk/cmake/Compiler/VISUAL-ASM.cmake b/sdk/cmake/Compiler/VISUAL-ASM.cmake
deleted file mode 100644
index 0f8019a8e80..00000000000
--- a/sdk/cmake/Compiler/VISUAL-ASM.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-
-set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index 3b70fd92744..abd935821a4 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -187,15 +187,16 @@ if(MSVC_IDE)
add_definitions(/DLANGUAGE_EN_US)
else()
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /nologo <INCLUDES>
<FLAGS> <DEFINES> ${I18N_DEFS} /fo <OBJECT> <SOURCE>")
- if(ARCH STREQUAL "arm")
- set(CMAKE_ASM_COMPILE_OBJECT
- "cl ${cl_includes_flag} /nologo /X
/I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm
<INCLUDES> <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE>
> <OBJECT>.tmp"
- "<CMAKE_ASM_COMPILER> -nologo -o <OBJECT>
<OBJECT>.tmp")
- else()
- set(CMAKE_ASM_COMPILE_OBJECT
- "cl ${cl_includes_flag} /nologo /X
/I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm
<INCLUDES> <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE>
> <OBJECT>.tmp"
- "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta
<OBJECT>.tmp")
- endif()
+endif()
+
+if(ARCH STREQUAL "arm")
+ set(CMAKE_ASM_MASM_COMPILE_OBJECT
+ "cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm
/I${REACTOS_BINARY_DIR}/sdk/include/asm <INCLUDES> <FLAGS> <DEFINES>
/D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
+ "<CMAKE_ASM_MASM_COMPILER> -nologo -o <OBJECT>
<OBJECT>.tmp")
+else()
+ set(CMAKE_ASM_MASM_COMPILE_OBJECT
+ "cl ${cl_includes_flag} /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm
/I${REACTOS_BINARY_DIR}/sdk/include/asm <INCLUDES> <FLAGS> <DEFINES>
/D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
+ "<CMAKE_ASM_MASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta
<OBJECT>.tmp")
endif()
if(_VS_ANALYZE_)
@@ -214,9 +215,9 @@ elseif(_PREFAST_)
endif()
set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})
-set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})
+set(CMAKE_ASM_MASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})
set(CMAKE_RC_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})
-set(CMAKE_ASM_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})
+set(CMAKE_ASM_MASM_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_MODULE})
set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
function(set_entrypoint _module _entrypoint)
@@ -264,12 +265,6 @@ function(set_module_type_toolchain MODULE TYPE)
endfunction()
-if(ARCH STREQUAL "arm")
- set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -nologo -o
<OBJECT> <SOURCE>")
-else()
- set(CMAKE_STUB_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> /nologo /Cp
/Fo<OBJECT> /c /Ta <SOURCE>")
-endif()
-
function(add_delay_importlibs _module)
get_target_property(_module_type ${_module} TYPE)
if(_module_type STREQUAL "STATIC_LIBRARY")
@@ -304,9 +299,9 @@ function(generate_import_lib _libname _dllname _spec_file)
# Compile the generated asm stub file
if(ARCH STREQUAL "arm")
- set(_asm_stub_command ${CMAKE_ASM_COMPILER} -nologo -o ${_asm_stubs_file}.obj
${_asm_stubs_file})
+ set(_asm_stub_command ${CMAKE_ASM_MASM_COMPILER} -nologo -o
${_asm_stubs_file}.obj ${_asm_stubs_file})
else()
- set(_asm_stub_command ${CMAKE_ASM_COMPILER} /nologo /Cp /Fo${_asm_stubs_file}.obj
/c /Ta ${_asm_stubs_file})
+ set(_asm_stub_command ${CMAKE_ASM_MASM_COMPILER} /nologo /Cp
/Fo${_asm_stubs_file}.obj /c /Ta ${_asm_stubs_file})
endif()
add_custom_command(
OUTPUT ${_asm_stubs_file}.obj
@@ -459,9 +454,9 @@ macro(add_asm_files _target)
endif()
endforeach()
if(ARCH STREQUAL "arm")
- set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} -nologo -o
${_object_file} ${_preprocessed_asm_file})
+ set(_pp_asm_compile_command ${CMAKE_ASM_MASM_COMPILER} -nologo -o
${_object_file} ${_preprocessed_asm_file})
else()
- set(_pp_asm_compile_command ${CMAKE_ASM_COMPILER} /nologo /Cp
/Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
+ set(_pp_asm_compile_command ${CMAKE_ASM_MASM_COMPILER} /nologo /Cp
/Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
endif()
add_custom_command(
OUTPUT ${_preprocessed_asm_file} ${_object_file}
@@ -486,7 +481,7 @@ function(add_linker_script _target _linker_script_file)
OUTPUT ${_generated_file}
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${_file_full_path}" "${_generated_file}"
DEPENDS ${_file_full_path})
- set_source_files_properties(${_generated_file} PROPERTIES LANGUAGE "ASM"
GENERATED TRUE)
+ set_source_files_properties(${_generated_file} PROPERTIES LANGUAGE
"ASM_MASM" GENERATED TRUE)
add_asm_files(${_target}_linker_file ${_generated_file})
# Generate the C module containing extra sections specifications and layout,
diff --git a/toolchain-msvc.cmake b/toolchain-msvc.cmake
index e30e075cba0..bde0f0ae6a7 100644
--- a/toolchain-msvc.cmake
+++ b/toolchain-msvc.cmake
@@ -53,13 +53,13 @@ endif()
set(CMAKE_MC_COMPILER mc)
set(CMAKE_RC_COMPILER rc)
if(ARCH STREQUAL "amd64")
- set(CMAKE_ASM_COMPILER ml64)
+ set(CMAKE_ASM_MASM_COMPILER ml64)
elseif(ARCH STREQUAL "arm")
- set(CMAKE_ASM_COMPILER armasm)
+ set(CMAKE_ASM_MASM_COMPILER armasm)
elseif(ARCH STREQUAL "arm64")
- set(CMAKE_ASM_COMPILER armasm64)
+ set(CMAKE_ASM_MASM_COMPILER armasm64)
else()
- set(CMAKE_ASM_COMPILER ml)
+ set(CMAKE_ASM_MASM_COMPILER ml)
endif()