mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[CMAKE] Preprocess the ASM files but let msbuild handle their actual compilation
CORE-17423
This commit is contained in:
parent
41130ab5c6
commit
c68739e566
3 changed files with 27 additions and 38 deletions
|
@ -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
|
# Activate support for assembly source files
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS s;S)
|
|
||||||
enable_language(ASM_MASM)
|
enable_language(ASM_MASM)
|
||||||
else()
|
else()
|
||||||
enable_language(ASM)
|
enable_language(ASM)
|
||||||
|
|
|
@ -189,14 +189,13 @@ else()
|
||||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /nologo <INCLUDES> <FLAGS> <DEFINES> ${I18N_DEFS} /fo <OBJECT> <SOURCE>")
|
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> /nologo <INCLUDES> <FLAGS> <DEFINES> ${I18N_DEFS} /fo <OBJECT> <SOURCE>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ARCH STREQUAL "arm")
|
# We don't put <INCLUDES> <DEFINES> <FLAGS> because this is handled in add_asm_files macro
|
||||||
set(CMAKE_ASM_MASM_COMPILE_OBJECT
|
if (NOT MSVC_IDE)
|
||||||
"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"
|
if(ARCH STREQUAL "arm")
|
||||||
"<CMAKE_ASM_MASM_COMPILER> -nologo -o <OBJECT> <OBJECT>.tmp")
|
set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> -nologo -o <OBJECT> <SOURCE>")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_ASM_MASM_COMPILE_OBJECT
|
set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> /nologo /Cp /Fo <OBJECT> /c /Ta <SOURCE>")
|
||||||
"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"
|
endif()
|
||||||
"<CMAKE_ASM_MASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(_VS_ANALYZE_)
|
if(_VS_ANALYZE_)
|
||||||
|
@ -437,37 +436,26 @@ function(allow_warnings __module)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro(add_asm_files _target)
|
macro(add_asm_files _target)
|
||||||
if(MSVC_IDE)
|
get_defines(_directory_defines)
|
||||||
get_defines(_directory_defines)
|
get_includes(_directory_includes)
|
||||||
get_includes(_directory_includes)
|
get_directory_property(_defines COMPILE_DEFINITIONS)
|
||||||
get_directory_property(_defines COMPILE_DEFINITIONS)
|
foreach(_source_file ${ARGN})
|
||||||
foreach(_source_file ${ARGN})
|
get_filename_component(_source_file_base_name ${_source_file} NAME_WE)
|
||||||
get_filename_component(_source_file_base_name ${_source_file} NAME_WE)
|
get_filename_component(_source_file_full_path ${_source_file} ABSOLUTE)
|
||||||
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)
|
||||||
set(_preprocessed_asm_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.tmp)
|
get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS)
|
||||||
set(_object_file ${CMAKE_CURRENT_BINARY_DIR}/asm/${_source_file_base_name}_${_target}.obj)
|
unset(_source_file_defines)
|
||||||
get_source_file_property(_defines_semicolon_list ${_source_file_full_path} COMPILE_DEFINITIONS)
|
foreach(_define ${_defines_semicolon_list})
|
||||||
unset(_source_file_defines)
|
if(NOT ${_define} STREQUAL "NOTFOUND")
|
||||||
foreach(_define ${_defines_semicolon_list})
|
list(APPEND _source_file_defines -D${_define})
|
||||||
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})
|
|
||||||
endif()
|
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()
|
endforeach()
|
||||||
else()
|
add_custom_command(
|
||||||
list(APPEND ${_target} ${ARGN})
|
OUTPUT ${_preprocessed_asm_file}
|
||||||
endif()
|
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()
|
endmacro()
|
||||||
|
|
||||||
function(add_linker_script _target _linker_script_file)
|
function(add_linker_script _target _linker_script_file)
|
||||||
|
|
|
@ -54,12 +54,14 @@ set(CMAKE_MC_COMPILER mc)
|
||||||
set(CMAKE_RC_COMPILER rc)
|
set(CMAKE_RC_COMPILER rc)
|
||||||
if(ARCH STREQUAL "amd64")
|
if(ARCH STREQUAL "amd64")
|
||||||
set(CMAKE_ASM_MASM_COMPILER ml64)
|
set(CMAKE_ASM_MASM_COMPILER ml64)
|
||||||
|
set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp")
|
||||||
elseif(ARCH STREQUAL "arm")
|
elseif(ARCH STREQUAL "arm")
|
||||||
set(CMAKE_ASM_MASM_COMPILER armasm)
|
set(CMAKE_ASM_MASM_COMPILER armasm)
|
||||||
elseif(ARCH STREQUAL "arm64")
|
elseif(ARCH STREQUAL "arm64")
|
||||||
set(CMAKE_ASM_MASM_COMPILER armasm64)
|
set(CMAKE_ASM_MASM_COMPILER armasm64)
|
||||||
else()
|
else()
|
||||||
set(CMAKE_ASM_MASM_COMPILER ml)
|
set(CMAKE_ASM_MASM_COMPILER ml)
|
||||||
|
set(CMAKE_ASM_MASM_FLAGS_INIT "/Cp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue