[CMAKE]
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 22 Dec 2010 16:37:32 +0000 (16:37 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 22 Dec 2010 16:37:32 +0000 (16:37 +0000)
- Add rostests to build when the folder exists.
- Alter the importlib target macro to handle definition files along with spec files.

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

CMakeLists.txt
gcc.cmake
modules/CMakeLists.txt [new file with mode: 0644]
msc.cmake

index 8530649..538b57a 100644 (file)
@@ -142,6 +142,7 @@ add_subdirectory(drivers)
 add_subdirectory(hal)
 add_subdirectory(lib)
 add_subdirectory(media)
+add_subdirectory(modules)
 add_subdirectory(ntoskrnl)
 add_subdirectory(subsystems)
 
index 1af51e9..0282756 100644 (file)
--- a/gcc.cmake
+++ b/gcc.cmake
@@ -192,23 +192,37 @@ macro(add_importlibs MODULE)
     endforeach()
 endmacro()
 
-macro(add_importlib_target _spec_file)
-    get_filename_component(_name ${_spec_file} NAME_WE)
+macro(add_importlib_target _exports_file)
+
+    get_filename_component(_name ${_exports_file} NAME_WE)
+    get_filename_component(_extension ${_exports_file} EXT)
+
+    if (${_extension} STREQUAL ".spec")
+        if (${ARGC} GREATER 1)
+            set(DLLNAME_OPTION "-n=${ARGV1}")
+        else()
+            set(DLLNAME_OPTION "")
+        endif()
     
-    if (${ARGC} GREATER 1)
-        set(DLLNAME_OPTION "-n=${ARGV1}")
+        add_custom_command(
+            OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+            COMMAND native-spec2def ${DLLNAME_OPTION} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}.def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
+            COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}.def --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
+        
+    elseif(${_extension} STREQUAL ".def")
+        add_custom_command(
+            OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+            COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+            DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
     else()
-        set(DLLNAME_OPTION "")
+        message(FATAL_ERROR "Unsupported exports file extension: ${_extension}")
     endif()
     
-    add_custom_command(
-        OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
-        COMMAND native-spec2def ${DLLNAME_OPTION} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
-        COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}.def --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
     add_custom_target(
         lib${_name}
         DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a)
+
 endmacro()
 
 macro(spec2def _dllname _spec_file)
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9c8ee98
--- /dev/null
@@ -0,0 +1,4 @@
+
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rostests/)
+add_subdirectory(rostests)
+endif()
index 30c181b..a419ada 100644 (file)
--- a/msc.cmake
+++ b/msc.cmake
@@ -139,14 +139,14 @@ set(IDL_PROXY_ARG /proxy)
 set(IDL_DLLDATA_ARG /dlldata )\r
 \r
 # Thanks MS for creating a stupid linker\r
-macro(add_importlib_target _spec_file)\r
-    get_filename_component(_name ${_spec_file} NAME_WE)\r
+macro(add_importlib_target _exports_file)\r
+    get_filename_component(_name ${_exports_file} NAME_WE)\r
 \r
     # Generate the asm stub file and the export def file\r
     add_custom_command(\r
         OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def\r
-        COMMAND native-spec2def -@ -r -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}\r
-        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})\r
+        COMMAND native-spec2def -@ -r -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}\r
+        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})\r
 \r
     # Assemble the stub file\r
     add_custom_command(\r