[CMAKE][FREELDR] Take the global defines into account when compiling ASM files.

Now the SARCH_xxx can be used in ASM files too.
Dedicated to Dmitry Borisov ;)
This commit is contained in:
Hermès Bélusca-Maïto 2020-03-06 22:55:12 +01:00
parent b596a2cc31
commit 93beefacbe
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 16 additions and 8 deletions

View file

@ -1,4 +1,6 @@
include_directories(${REACTOS_SOURCE_DIR}/boot/freeldr)
if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00)

View file

@ -444,9 +444,12 @@ endif()
function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_address)
set(_object_file ${_binary_file}.o)
get_defines(_defines)
get_includes(_includes)
add_custom_command(
OUTPUT ${_object_file}
COMMAND ${CMAKE_ASM_COMPILER} -x assembler-with-cpp -o ${_object_file} -I${REACTOS_SOURCE_DIR}/sdk/include/asm -I${REACTOS_BINARY_DIR}/sdk/include/asm -I${REACTOS_SOURCE_DIR}/boot/freeldr -D__ASM__ -c ${_asm_file}
COMMAND ${CMAKE_ASM_COMPILER} -x assembler-with-cpp -o ${_object_file} -I${REACTOS_SOURCE_DIR}/sdk/include/asm -I${REACTOS_BINARY_DIR}/sdk/include/asm ${_includes} ${_defines} -D__ASM__ -c ${_asm_file}
DEPENDS ${_asm_file})
add_custom_command(

View file

@ -486,6 +486,9 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
set(_object_file ${_binary_file}.obj)
set(_temp_file ${_binary_file}.tmp)
get_defines(_defines)
get_includes(_includes)
if(USE_CLANG_CL)
set(_no_std_includes_flag "-nostdinc")
else()
@ -494,7 +497,7 @@ function(CreateBootSectorTarget _target_name _asm_file _binary_file _base_addres
add_custom_command(
OUTPUT ${_temp_file}
COMMAND ${CMAKE_C_COMPILER} /nologo ${_no_std_includes_flag} /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm /I${REACTOS_SOURCE_DIR}/boot/freeldr /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file}
COMMAND ${CMAKE_C_COMPILER} /nologo ${_no_std_includes_flag} /I${REACTOS_SOURCE_DIR}/sdk/include/asm /I${REACTOS_BINARY_DIR}/sdk/include/asm ${_includes} ${_defines} /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file}
DEPENDS ${_asm_file})
if(ARCH STREQUAL "arm")

View file

@ -100,12 +100,6 @@ function(add_asm16_bin _target _binary_file _base_address)
##
## All this part is the same as CreateBootSectorTarget
##
if(ARCH STREQUAL "arm")
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} -nologo -o ${_object_file} ${_preprocessed_asm_file})
else()
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
endif()
if(USE_CLANG_CL)
set(_no_std_includes_flag "-nostdinc")
else()
@ -118,6 +112,12 @@ function(add_asm16_bin _target _binary_file _base_address)
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 ${_concatenated_asm_file} > ${_preprocessed_asm_file}
DEPENDS ${_concatenated_asm_file})
if(ARCH STREQUAL "arm")
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} -nologo -o ${_object_file} ${_preprocessed_asm_file})
else()
set(_pp_asm16_compile_command ${CMAKE_ASM16_COMPILER} /nologo /Cp /Fo${_object_file} /c /Ta ${_preprocessed_asm_file})
endif()
add_custom_command(
OUTPUT ${_object_file}
COMMAND ${_pp_asm16_compile_command}