https://git.reactos.org/?p=reactos.git;a=commitdiff;h=93beefacbefdb3eba2429…
commit 93beefacbefdb3eba2429375393b982d4cdda867
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Fri Mar 6 22:55:12 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Mar 6 22:55:12 2020 +0100
[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 ;)
---
boot/freeldr/bootsect/CMakeLists.txt | 2 ++
sdk/cmake/gcc.cmake | 5 ++++-
sdk/cmake/msvc.cmake | 5 ++++-
subsystems/mvdm/asm16.cmake | 12 ++++++------
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/boot/freeldr/bootsect/CMakeLists.txt b/boot/freeldr/bootsect/CMakeLists.txt
index c847a998fa2..d0c527779d5 100644
--- a/boot/freeldr/bootsect/CMakeLists.txt
+++ b/boot/freeldr/bootsect/CMakeLists.txt
@@ -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)
diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake
index 2493d999bf5..d91a9483e83 100644
--- a/sdk/cmake/gcc.cmake
+++ b/sdk/cmake/gcc.cmake
@@ -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(
diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake
index c1aad7a01fe..d18c42251ea 100644
--- a/sdk/cmake/msvc.cmake
+++ b/sdk/cmake/msvc.cmake
@@ -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")
diff --git a/subsystems/mvdm/asm16.cmake b/subsystems/mvdm/asm16.cmake
index 7d4832f354f..3848aa1f129 100644
--- a/subsystems/mvdm/asm16.cmake
+++ b/subsystems/mvdm/asm16.cmake
@@ -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}