mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:12:58 +00:00
[ASMPP] Implement asm preprocessor
This converts ML style assembly to GAS compatible syntax
This commit is contained in:
parent
7277e26944
commit
61cc62d1b2
10 changed files with 1700 additions and 18 deletions
|
@ -467,8 +467,37 @@ function(allow_warnings __module)
|
|||
#target_compile_options(${__module} PRIVATE "-Wno-error")
|
||||
endfunction()
|
||||
|
||||
function(convert_asm_file _source_file _target_file)
|
||||
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}/${_target_file})
|
||||
add_custom_command(
|
||||
OUTPUT ${_preprocessed_asm_file}
|
||||
COMMAND native-asmpp ${_source_file_full_path} > ${_preprocessed_asm_file}
|
||||
DEPENDS native-asmpp ${_source_file_full_path})
|
||||
|
||||
endfunction()
|
||||
|
||||
function(convert_asm_files)
|
||||
foreach(_source_file ${ARGN})
|
||||
convert_asm_file(${_source_file} ${_source_file}.s)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
macro(add_asm_files _target)
|
||||
list(APPEND ${_target} ${ARGN})
|
||||
foreach(_source_file ${ARGN})
|
||||
get_filename_component(_extension ${_source_file} EXT)
|
||||
get_filename_component(_source_file_base_name ${_source_file} NAME_WE)
|
||||
if (${_extension} STREQUAL ".asm")
|
||||
convert_asm_file(${_source_file} ${_source_file}.s)
|
||||
list(APPEND ${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_source_file}.s)
|
||||
elseif (${_extension} STREQUAL ".inc")
|
||||
convert_asm_file(${_source_file} ${_source_file}.h)
|
||||
list(APPEND ${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_source_file}.h)
|
||||
else()
|
||||
list(APPEND ${_target} ${_source_file})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
function(add_linker_script _target _linker_script_file)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
include(ExternalProject)
|
||||
|
||||
function(setup_host_tools)
|
||||
list(APPEND HOST_TOOLS bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink txt2nls utf16le xml2sdb)
|
||||
list(APPEND HOST_TOOLS asmpp bin2c widl gendib cabman fatten hpp isohybrid mkhive mkisofs obj2bin spec2def geninc mkshelllink txt2nls utf16le xml2sdb)
|
||||
if(NOT MSVC)
|
||||
list(APPEND HOST_TOOLS rsym pefixup)
|
||||
endif()
|
||||
|
|
|
@ -475,21 +475,26 @@ macro(add_asm_files _target)
|
|||
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()
|
||||
endforeach()
|
||||
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})
|
||||
get_filename_component(_extension ${_source_file} EXT)
|
||||
if (("${_extension}" STREQUAL ".asm") OR ("${_extension}" STREQUAL ".inc"))
|
||||
list(APPEND ${_target} ${_source_file})
|
||||
else()
|
||||
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()
|
||||
endforeach()
|
||||
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})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue