mirror of
https://github.com/reactos/reactos.git
synced 2024-08-20 02:13:29 +00:00
[CMAKE]
- Move generated precompiled headers to binary folders. - Enable auto image base for ntdll. - Update the location of generated PCH files for rtl, ntdll and crt. svn path=/branches/cmake-bringup/; revision=48459
This commit is contained in:
parent
fc5ac84ba5
commit
7c99b62e1f
|
@ -1,40 +1,42 @@
|
|||
|
||||
MACRO(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename)
|
||||
|
||||
# Add the precompiled header to the build
|
||||
set(_gch_filename "${_header_filename}.gch")
|
||||
list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename})
|
||||
# Add the precompiled header to the build
|
||||
get_filename_component(FILE ${_header_filename} NAME)
|
||||
set(_gch_filename "${_target_name}_${FILE}.gch")
|
||||
list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename})
|
||||
|
||||
# This gets us our includes
|
||||
get_directory_property(DIRINC INCLUDE_DIRECTORIES)
|
||||
foreach(item ${DIRINC})
|
||||
list(APPEND ${_out_compile_flags} -I${item})
|
||||
endforeach(item)
|
||||
# This gets us our includes
|
||||
get_directory_property(DIRINC INCLUDE_DIRECTORIES)
|
||||
foreach(item ${DIRINC})
|
||||
list(APPEND ${_out_compile_flags} -I${item})
|
||||
endforeach(item)
|
||||
|
||||
# This is a particular bit of undocumented/hacky magic I'm quite proud of
|
||||
get_directory_property(_compiler_flags DEFINITIONS)
|
||||
STRING(REPLACE "\ " "\t" _compiler_flags ${_compiler_flags})
|
||||
list(APPEND ${_out_compile_flags} ${_compiler_flags})
|
||||
# This is a particular bit of undocumented/hacky magic I'm quite proud of
|
||||
get_directory_property(_compiler_flags DEFINITIONS)
|
||||
string(REPLACE "\ " "\t" _compiler_flags ${_compiler_flags})
|
||||
list(APPEND ${_out_compile_flags} ${_compiler_flags})
|
||||
|
||||
# This gets any specific definitions that were added with set-target-property
|
||||
GET_TARGET_PROPERTY(_target_defs ${_target_name} COMPILE_DEFINITIONS)
|
||||
if (_target_defs)
|
||||
foreach(item ${_target_defs})
|
||||
list(APPEND ${_out_compile_flags} -D${item})
|
||||
endforeach(item)
|
||||
endif()
|
||||
# This gets any specific definitions that were added with set-target-property
|
||||
get_target_property(_target_defs ${_target_name} COMPILE_DEFINITIONS)
|
||||
if (_target_defs)
|
||||
foreach(item ${_target_defs})
|
||||
list(APPEND ${_out_compile_flags} -D${item})
|
||||
endforeach(item)
|
||||
endif()
|
||||
|
||||
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
|
||||
|
||||
MACRO(add_pch _target_name _header_filename _src_list)
|
||||
|
||||
set(_gch_filename "${_header_filename}.gch")
|
||||
list(APPEND ${_src_list} ${_gch_filename})
|
||||
_PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename})
|
||||
file(REMOVE ${_gch_filename})
|
||||
add_custom_command(
|
||||
OUTPUT ${_gch_filename}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args}
|
||||
DEPENDS ${_header_filename})
|
||||
|
||||
get_filename_component(FILE ${_header_filename} NAME)
|
||||
set(_gch_filename "${_target_name}_${FILE}.gch")
|
||||
list(APPEND ${_src_list} ${_gch_filename})
|
||||
_PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename})
|
||||
file(REMOVE ${_gch_filename})
|
||||
add_custom_command(
|
||||
OUTPUT ${_gch_filename}
|
||||
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args}
|
||||
DEPENDS ${_header_filename})
|
||||
|
||||
ENDMACRO(add_pch _target_name _header_filename _src_list)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
add_definitions(-D__NTDLL__)
|
||||
add_definitions(-D_NTOSKRNL_)
|
||||
add_definitions(-DCRTDLL)
|
||||
|
@ -17,7 +18,7 @@ file(GLOB_RECURSE ARCH_SOURCE
|
|||
add_library(ntdll SHARED
|
||||
${ARCH_SOURCE} ${SOURCE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/def/ntdll.rc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ntdll.h.gch)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ntdll_ntdll.h.gch)
|
||||
|
||||
set_target_properties(ntdll PROPERTIES LINK_FLAGS "-Wl,-entry,0")
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/avlsupp.c
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/mem.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memgen.c)
|
||||
|
||||
add_library(rtl ${ARCH_SOURCE} ${SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/rtl.h.gch)
|
||||
add_library(rtl ${ARCH_SOURCE} ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/rtl_rtl.h.gch)
|
||||
add_pch(rtl ${CMAKE_CURRENT_SOURCE_DIR}/rtl.h ${SOURCE})
|
||||
add_dependencies(rtl psdk)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
include_directories(./include)
|
||||
|
||||
include_directories(include)
|
||||
|
||||
add_definitions(-D_CRTBLD)
|
||||
|
||||
|
@ -6,7 +7,7 @@ file(GLOB_RECURSE CRT_SOURCE "*.c")
|
|||
LIST(REMOVE_ITEM CRT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/stdio/findgen.c)
|
||||
LIST(REMOVE_ITEM CRT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/string/strtold.c)
|
||||
|
||||
add_library(crt ${CRT_SOURCE} ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h.gch)
|
||||
add_library(crt ${CRT_SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/crt_precomp.h.gch)
|
||||
set_property(TARGET crt PROPERTY COMPILE_DEFINITIONS __MINGW_IMPORT=extern USE_MSVCRT_PREFIX _MSVCRT_LIB_ _MSVCRT_ _MT)
|
||||
add_pch(crt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${CRT_SOURCE})
|
||||
add_dependencies(crt psdk)
|
||||
|
|
Loading…
Reference in a new issue