[CMAKE]
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 31 Aug 2010 18:40:19 +0000 (18:40 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 31 Aug 2010 18:40:19 +0000 (18:40 +0000)
- Add boot sectors to build.

svn path=/branches/cmake-bringup/; revision=48669

CMakeLists.txt
CMakeMacros.cmake
boot/CMakeLists.txt [new file with mode: 0644]

index b8450cd..d678d30 100644 (file)
@@ -102,6 +102,7 @@ add_subdirectory(include/reactos/idl)
 add_subdirectory(include/reactos/mc)
 
 add_subdirectory(base)
+add_subdirectory(boot)
 add_subdirectory(dll)
 add_subdirectory(drivers)
 add_subdirectory(hal)
index 534891d..94b3a71 100644 (file)
@@ -51,3 +51,27 @@ MACRO(spec2def _target_name _spec_file _def_file)
     add_custom_target(${_target_name}_def ALL DEPENDS ${_def_file})
 
 ENDMACRO(spec2def _target_name _spec_file _def_file)
+
+MACRO(CreateBootSectorTarget _target_name _asm_file _object_file)
+
+    get_filename_component(OBJECT_PATH ${_object_file} PATH)
+    file(MAKE_DIRECTORY ${OBJECT_PATH})
+    get_directory_property(defines COMPILE_DEFINITIONS)
+    get_directory_property(includes INCLUDE_DIRECTORIES)
+
+    foreach(arg ${defines})
+        set(result_defs ${result_defs} -D${arg})
+    endforeach(arg ${defines})
+
+    foreach(arg ${includes})
+        set(result_incs -I${arg} ${result_incs})
+    endforeach(arg ${includes})
+
+    add_custom_command(
+        OUTPUT ${_object_file}
+        COMMAND nasm -o ${_object_file} ${result_incs} ${result_defs} -f bin ${_asm_file}
+        DEPENDS native-winebuild)
+    set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE)
+    add_custom_target(${_target_name} ALL DEPENDS ${_object_file})
+
+ENDMACRO(CreateBootSectorTarget _target_name _asm_file _object_file)
diff --git a/boot/CMakeLists.txt b/boot/CMakeLists.txt
new file mode 100644 (file)
index 0000000..57733ec
--- /dev/null
@@ -0,0 +1,7 @@
+
+CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/dosmbr.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/dosmbr.bin)
+CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/ext2.bin)
+CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/fat32.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat32.bin)
+CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/fat.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/fat.bin)
+CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/isoboot.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin)
+CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/freeldr/bootsect/isobtrt.asm ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin)