Author: akhaldi
Date: Thu Dec 2 21:56:40 2010
New Revision: 49903
URL:
http://svn.reactos.org/svn/reactos?rev=49903&view=rev
Log:
[CMAKE]
- Group some cross compiling related sections.
- Implement add_importlib_target() for gcc.
- Improve the msvc version.
Modified:
branches/cmake-bringup/CMakeLists.txt
branches/cmake-bringup/gcc.cmake
branches/cmake-bringup/msc.cmake
Modified: branches/cmake-bringup/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/CMakeLists.txt?re…
==============================================================================
--- branches/cmake-bringup/CMakeLists.txt [iso-8859-1] (original)
+++ branches/cmake-bringup/CMakeLists.txt [iso-8859-1] Thu Dec 2 21:56:40 2010
@@ -1,29 +1,9 @@
+
cmake_minimum_required(VERSION 2.8)
project(REACTOS)
# Compile options
include(config.cmake)
-
-# Compiler specific definitions and macros
-if(MSVC)
-include(msc.cmake)
-else()
-include(gcc.cmake)
-endif(MSVC)
-
-# Generic macros
-include(CMakeMacros.cmake)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
-set(CMAKE_SHARED_LIBRARY_PREFIX "")
-
-set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
-set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
-
-set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
-
-add_definitions(-D__REACTOS__)
if(NOT CMAKE_CROSSCOMPILING)
@@ -47,6 +27,40 @@
endif()
else()
+
+if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
+ set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
+endif()
+
+set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake"
CACHE FILEPATH "Host executables")
+include(${IMPORT_EXECUTABLES})
+
+endif(NOT CMAKE_CROSSCOMPILING)
+
+# Compiler specific definitions and macros
+if(MSVC)
+include(msc.cmake)
+else()
+include(gcc.cmake)
+endif(MSVC)
+
+# Generic macros
+include(CMakeMacros.cmake)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
+set(CMAKE_SHARED_LIBRARY_PREFIX "")
+
+set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
+set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
+
+set(CMAKE_COLOR_MAKEFILE OFF)
+
+set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
+
+add_definitions(-D__REACTOS__)
+
+if(CMAKE_CROSSCOMPILING)
#Some cleanup
file(REMOVE
@@ -66,13 +80,6 @@
# Activate language support for resource files
enable_language(RC)
-
-if(NOT DEFINED REACTOS_BUILD_TOOLS_DIR)
- set(REACTOS_BUILD_TOOLS_DIR ${REACTOS_SOURCE_DIR}/build)
-endif()
-
-set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake"
CACHE FILEPATH "Host executables")
-include(${IMPORT_EXECUTABLES})
add_definitions(-DDBG=${DBG} -DKDBG=${KDBG})
@@ -189,6 +196,8 @@
add_custom_target(gendib_generated ALL DEPENDS ${OUTPUT_FILES})
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs)
+
#bootcd and livecd
include(ros_cd.cmake)
Modified: branches/cmake-bringup/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/gcc.cmake?rev=499…
==============================================================================
--- branches/cmake-bringup/gcc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/gcc.cmake [iso-8859-1] Thu Dec 2 21:56:40 2010
@@ -96,12 +96,6 @@
add_linkerflag(${MODULE} "-Wl,--image-base,${IMAGE_BASE}")
endmacro()
-macro(add_importlibs MODULE)
- foreach(LIB ${ARGN})
- target_link_libraries(${MODULE} ${LIB}.dll.a)
- endforeach()
-endmacro()
-
macro(set_module_type MODULE TYPE)
add_dependencies(${MODULE} psdk buildno_header)
@@ -193,8 +187,23 @@
set(IDL_PROXY_ARG -p -P)
set(IDL_DLLDATA_ARG --dlldata-only --dlldata=)
-macro(add_importlib_target _def_file)
- # empty for now, while import libs are shipped
+macro(add_importlibs MODULE)
+ foreach(LIB ${ARGN})
+ target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}.a)
+ add_dependencies(${MODULE} lib${LIB})
+ endforeach()
+endmacro()
+
+macro(add_importlib_target _spec_file)
+ get_filename_component(_name ${_spec_file} NAME_WE)
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a
+ COMMAND native-spec2def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
${CMAKE_CURRENT_BINARY_DIR}/${_name}.def
+ 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)
Modified: branches/cmake-bringup/msc.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/msc.cmake?rev=499…
==============================================================================
--- branches/cmake-bringup/msc.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/msc.cmake [iso-8859-1] Thu Dec 2 21:56:40 2010
@@ -6,7 +6,6 @@
add_definitions(-Dinline=__inline)
if(NOT CMAKE_CROSSCOMPILING)
-
else()
@@ -143,15 +142,11 @@
macro(add_importlib_target _spec_file)
get_filename_component(_name ${_spec_file} NAME_WE)
- # Generate the asm stub file
- add_custom_command(
- OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
+ # Generate the asm stub file
COMMAND native-spec2def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
-
- # Generate a the export def file
- add_custom_command(
- OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
+ # Generate a the export def file
COMMAND native-spec2def -@ -r
-d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
@@ -159,8 +154,7 @@
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj
COMMAND ${CMAKE_ASM_COMPILER} /nologo
/Fo${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj /c /Ta
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
- DEPENDS "${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm"
- )
+ DEPENDS "${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm")
# Add neccessary importlibs for redirections
set(_libraries "")
@@ -173,14 +167,12 @@
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
COMMAND LINK /LIB /NOLOGO /MACHINE:X86
/DEF:${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
/OUT:${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${_libraries}
- DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
- )
+ DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def)
# Add the importlib target
add_custom_target(
lib${_name}
- DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
- )
+ DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib)
add_dependencies(lib${_name} asm ${_dependencies})
endmacro()