diff --git a/CMakeLists.txt b/CMakeLists.txt index 99488e38702..d090b2f79c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,7 +214,6 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to # Activate support for assembly source files if (MSVC) - set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS s;S) enable_language(ASM_MASM) else() enable_language(ASM) diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index abd935821a4..33fdbea00f0 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -189,14 +189,13 @@ else() set(CMAKE_RC_COMPILE_OBJECT " /nologo ${I18N_DEFS} /fo ") 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 /D__ASM__ /D_USE_ML /EP /c > .tmp" - " -nologo -o .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 /D__ASM__ /D_USE_ML /EP /c > .tmp" - " /nologo /Cp /Fo /c /Ta .tmp") +# We don't put because this is handled in add_asm_files macro +if (NOT MSVC_IDE) + if(ARCH STREQUAL "arm") + set(CMAKE_ASM_MASM_COMPILE_OBJECT " -nologo -o ") + else() + set(CMAKE_ASM_MASM_COMPILE_OBJECT " /nologo /Cp /Fo /c /Ta ") + endif() endif() if(_VS_ANALYZE_) @@ -437,37 +436,26 @@ function(allow_warnings __module) endfunction() macro(add_asm_files _target) - if(MSVC_IDE) - get_defines(_directory_defines) - get_includes(_directory_includes) - get_directory_property(_defines COMPILE_DEFINITIONS) - foreach(_source_file ${ARGN}) - get_filename_component(_source_file_base_name ${_source_file} NAME_WE) - get_filename_component(_source_file_full_path ${_source_file} ABSOLUTE) - set(_preprocessed_asm_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.tmp) - set(_object_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.obj) - get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS) - unset(_source_file_defines) - foreach(_define ${_defines_semicolon_list}) - if(NOT ${_define} STREQUAL "NOTFOUND") - list(APPEND _source_file_defines -D${_define}) - endif() - endforeach() - if(ARCH STREQUAL "arm") - set(_pp_asm_compile_command ${CMAKE_ASM_MASM_COMPILER} -nologo -o ${_object_file} ${_preprocessed_asm_file}) - else() - set(_pp_asm_compile_command ${CMAKE_ASM_MASM_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file}) + get_defines(_directory_defines) + get_includes(_directory_includes) + get_directory_property(_defines COMPILE_DEFINITIONS) + foreach(_source_file ${ARGN}) + get_filename_component(_source_file_base_name ${_source_file} NAME_WE) + get_filename_component(_source_file_full_path ${_source_file} ABSOLUTE) + set(_preprocessed_asm_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.asm) + get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS) + unset(_source_file_defines) + foreach(_define ${_defines_semicolon_list}) + if(NOT ${_define} STREQUAL "NOTFOUND") + list(APPEND _source_file_defines -D${_define}) endif() - add_custom_command( - OUTPUT ${_preprocessed_asm_file} ${_object_file} - COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_source_file_full_path} > ${_preprocessed_asm_file} && ${_pp_asm_compile_command} - DEPENDS ${_source_file_full_path}) - set_source_files_properties(${_object_file} PROPERTIES EXTERNAL_OBJECT TRUE) - list(APPEND ${_target} ${_object_file}) endforeach() - else() - list(APPEND ${_target} ${ARGN}) - endif() + add_custom_command( + OUTPUT ${_preprocessed_asm_file} + COMMAND cl /nologo /X /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_directory_includes} ${_source_file_defines} ${_directory_defines} /D__ASM__ /D_USE_ML /EP /c ${_source_file_full_path} > ${_preprocessed_asm_file} + DEPENDS ${_source_file_full_path}) + list(APPEND ${_target} ${_preprocessed_asm_file}) + endforeach() endmacro() function(add_linker_script _target _linker_script_file) diff --git a/toolchain-msvc.cmake b/toolchain-msvc.cmake index bde0f0ae6a7..dbb901ae874 100644 --- a/toolchain-msvc.cmake +++ b/toolchain-msvc.cmake @@ -54,12 +54,14 @@ set(CMAKE_MC_COMPILER mc) set(CMAKE_RC_COMPILER rc) if(ARCH STREQUAL "amd64") set(CMAKE_ASM_MASM_COMPILER ml64) + set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp") elseif(ARCH STREQUAL "arm") set(CMAKE_ASM_MASM_COMPILER armasm) elseif(ARCH STREQUAL "arm64") set(CMAKE_ASM_MASM_COMPILER armasm64) else() set(CMAKE_ASM_MASM_COMPILER ml) + set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp") endif()