Author: akhaldi
Date: Sun Sep 6 16:44:30 2015
New Revision: 69060
URL:
http://svn.reactos.org/svn/reactos?rev=69060&view=rev
Log:
[CMAKE] Introduce a way to compile ReactOS without invoking CMake twice. You can enable it
by running configure with -DNEW_STYLE_BUILD=1. Once the transition goes smoothly we can
enable this by default. CORE-10121
Added:
trunk/reactos/cmake/host-tools.cmake (with props)
Modified:
trunk/reactos/CMakeLists.txt
trunk/reactos/cmake/gcc.cmake
trunk/reactos/tools/CMakeLists.txt
trunk/reactos/tools/cabman/CMakeLists.txt
trunk/reactos/tools/cdmake/CMakeLists.txt
trunk/reactos/tools/hpp/CMakeLists.txt
trunk/reactos/tools/kbdtool/CMakeLists.txt
trunk/reactos/tools/log2lines/CMakeLists.txt
trunk/reactos/tools/mkhive/CMakeLists.txt
trunk/reactos/tools/rsym/CMakeLists.txt
trunk/reactos/tools/widl/CMakeLists.txt
Modified: trunk/reactos/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=69060&a…
==============================================================================
--- trunk/reactos/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -41,6 +41,10 @@
set(CMAKE_DISABLE_NINJA_DEPSLOG TRUE)
endif()
+if(NOT DEFINED NEW_STYLE_BUILD)
+ set(NEW_STYLE_BUILD FALSE)
+endif()
+
if(NOT ARCH)
set(ARCH i386)
endif()
@@ -80,6 +84,10 @@
if(NOT CMAKE_CROSSCOMPILING)
+ if(NEW_STYLE_BUILD)
+ set(TOOLS_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+
add_definitions(-DTARGET_${ARCH})
if(MSVC)
@@ -102,13 +110,19 @@
add_subdirectory(tools)
add_subdirectory(lib)
- if(NOT MSVC)
- export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc
rsym mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE
native- )
- else()
- export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc
mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+ if(NOT NEW_STYLE_BUILD)
+ if(NOT MSVC)
+ export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc
rsym mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE
native- )
+ else()
+ export(TARGETS bin2c widl gendib cabman cdmake mkhive obj2bin spec2def geninc
mkshelllink utf16le FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
+ endif()
endif()
else()
+
+ if(NEW_STYLE_BUILD)
+ include(cmake/host-tools.cmake)
+ endif()
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
@@ -130,12 +144,13 @@
${REACTOS_BINARY_DIR}/boot/ros_cab.txt
${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt)
- 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})
+ if(NOT NEW_STYLE_BUILD)
+ 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()
if(DBG)
add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=69060&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -225,7 +225,13 @@
set(CMAKE_RC_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS}
<CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS>
<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS>
<LINK_LIBRARIES>")
else()
# Normal rsym build
- get_target_property(RSYM native-rsym IMPORTED_LOCATION_NOCONFIG)
+ if(NEW_STYLE_BUILD)
+ string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
+ get_target_property(RSYM native-rsym IMPORTED_LOCATION_${_build_type})
+ else()
+ get_target_property(RSYM native-rsym IMPORTED_LOCATION_NOCONFIG)
+ endif()
+
set(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS} <CMAKE_C_LINK_FLAGS>
<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
"${RSYM} -s ${REACTOS_SOURCE_DIR} <TARGET> <TARGET>")
Added: trunk/reactos/cmake/host-tools.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/host-tools.cmake?rev…
==============================================================================
--- trunk/reactos/cmake/host-tools.cmake (added)
+++ trunk/reactos/cmake/host-tools.cmake [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -0,0 +1,37 @@
+
+if(CMAKE_HOST_WIN32)
+ set(native_suffix ".exe")
+endif()
+
+string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
+
+# List of host tools
+list(APPEND host_tools_list bin2c widl gendib cabman cdmake mkhive obj2bin spec2def
geninc mkshelllink utf16le)
+if(NOT MSVC)
+ list(APPEND host_tools_list rsym)
+endif()
+
+foreach(_host_tool ${host_tools_list})
+ if(MSVC_IDE)
+ get_filename_component(_tool_location
"${CMAKE_CURRENT_BINARY_DIR}/host-tools/${CMAKE_BUILD_TYPE}/${_host_tool}${native_suffix}"
ABSOLUTE)
+ else()
+ get_filename_component(_tool_location
"${CMAKE_CURRENT_BINARY_DIR}/host-tools/${_host_tool}${native_suffix}"
ABSOLUTE)
+ endif()
+ list(APPEND tools_binaries ${_tool_location})
+ add_executable(native-${_host_tool} IMPORTED)
+ set_property(TARGET native-${_host_tool} PROPERTY IMPORTED_LOCATION_${_build_type}
${_tool_location})
+ add_dependencies(native-${_host_tool} host-tools)
+endforeach()
+
+include(ExternalProject)
+
+ExternalProject_Add(host-tools
+ SOURCE_DIR ${REACTOS_SOURCE_DIR}
+ BINARY_DIR ${REACTOS_BINARY_DIR}/host-tools
+ STAMP_DIR ${REACTOS_BINARY_DIR}/host-tools/stamps
+ BUILD_ALWAYS 1
+ PREFIX host-tools
+ EXCLUDE_FROM_ALL 1
+ CMAKE_ARGS "-DNEW_STYLE_BUILD=1"
+ INSTALL_COMMAND ""
+ BUILD_BYPRODUCTS ${tools_binaries})
Propchange: trunk/reactos/cmake/host-tools.cmake
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/tools/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/CMakeLists.txt?rev=6…
==============================================================================
--- trunk/reactos/tools/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -1,3 +1,10 @@
+
+function(add_host_tool _tool)
+ add_executable(${_tool} ${ARGN})
+ if(NEW_STYLE_BUILD)
+ set_target_properties(${_tool} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${TOOLS_FOLDER})
+ endif()
+endfunction()
#add_executable(pefixup pefixup.c)
@@ -5,17 +12,17 @@
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
-add_executable(bin2c bin2c.c)
-add_executable(gendib gendib/gendib.c)
-add_executable(geninc geninc/geninc.c)
-add_executable(mkshelllink mkshelllink/mkshelllink.c)
-add_executable(obj2bin obj2bin/obj2bin.c)
-add_executable(spec2def spec2def/spec2def.c)
+add_host_tool(bin2c bin2c.c)
+add_host_tool(gendib gendib/gendib.c)
+add_host_tool(geninc geninc/geninc.c)
+add_host_tool(mkshelllink mkshelllink/mkshelllink.c)
+add_host_tool(obj2bin obj2bin/obj2bin.c)
+add_host_tool(spec2def spec2def/spec2def.c)
if(MSVC)
set_property(SOURCE utf16le/utf16le.cpp APPEND_STRING PROPERTY COMPILE_FLAGS "
/EHsc")
endif()
-add_executable(utf16le utf16le/utf16le.cpp)
+add_host_tool(utf16le utf16le/utf16le.cpp)
add_subdirectory(cabman)
add_subdirectory(cdmake)
Modified: trunk/reactos/tools/cabman/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cabman/CMakeLists.tx…
==============================================================================
--- trunk/reactos/tools/cabman/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/cabman/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -7,5 +7,5 @@
raw.cxx)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/zlib)
-add_executable(cabman ${SOURCE})
+add_host_tool(cabman ${SOURCE})
target_link_libraries(cabman zlibhost)
Modified: trunk/reactos/tools/cdmake/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/CMakeLists.tx…
==============================================================================
--- trunk/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -1,2 +1,2 @@
-add_executable(cdmake cdmake.c dirhash.c llmsort.c)
+add_host_tool(cdmake cdmake.c dirhash.c llmsort.c)
Modified: trunk/reactos/tools/hpp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/hpp/CMakeLists.txt?r…
==============================================================================
--- trunk/reactos/tools/hpp/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/hpp/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -1,2 +1,2 @@
-add_executable(hpp hpp.c)
+add_host_tool(hpp hpp.c)
Modified: trunk/reactos/tools/kbdtool/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/kbdtool/CMakeLists.t…
==============================================================================
--- trunk/reactos/tools/kbdtool/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/kbdtool/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -1,2 +1,2 @@
-add_executable(kbdtool data.c main.c output.c parser.c)
+add_host_tool(kbdtool data.c main.c output.c parser.c)
Modified: trunk/reactos/tools/log2lines/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/log2lines/CMakeLists…
==============================================================================
--- trunk/reactos/tools/log2lines/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/log2lines/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -13,5 +13,5 @@
util.c)
include_directories(${REACTOS_SOURCE_DIR}/tools/rsym)
-add_executable(log2lines ${SOURCE})
+add_host_tool(log2lines ${SOURCE})
target_link_libraries(log2lines rsym_common)
Modified: trunk/reactos/tools/mkhive/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/CMakeLists.tx…
==============================================================================
--- trunk/reactos/tools/mkhive/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/mkhive/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -16,5 +16,5 @@
registry.c
rtl.c)
-add_executable(mkhive ${SOURCE})
+add_host_tool(mkhive ${SOURCE})
target_link_libraries(mkhive unicode cmlibhost inflibhost)
Modified: trunk/reactos/tools/rsym/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rsym/CMakeLists.txt?…
==============================================================================
--- trunk/reactos/tools/rsym/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/rsym/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -4,12 +4,12 @@
if(ARCH STREQUAL "i386")
add_definitions(-D_X86_)
- add_executable(rsym rsym.c)
+ add_host_tool(rsym rsym.c)
elseif(ARCH STREQUAL "amd64")
- add_executable(rsym rsym64.c)
+ add_host_tool(rsym rsym64.c)
elseif(ARCH STREQUAL "arm")
add_executable(rsym rsym64.c)
endif()
target_link_libraries(rsym rsym_common dbghelphost zlibhost unicode)
-add_executable(raddr2line rsym_common.c raddr2line.c)
+add_host_tool(raddr2line rsym_common.c raddr2line.c)
Modified: trunk/reactos/tools/widl/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/CMakeLists.txt?…
==============================================================================
--- trunk/reactos/tools/widl/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/widl/CMakeLists.txt [iso-8859-1] Sun Sep 6 16:44:30 2015
@@ -32,5 +32,5 @@
# Taken from widl.rbuild
add_definitions(-DINT16=SHORT)
-add_executable(widl ${SOURCE})
+add_host_tool(widl ${SOURCE})
target_link_libraries(widl wpphost)