mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[CMAKE][CONFIGURE] Enable runtime checks on MSVC by default.
Remove RTC switch from configure.cmd, now MSVC runtime checks are supposed to be enabled/disabled via CMake define (-DRUNTIME_CHECKS=1) Prepare for adding more dynamic analysis options
This commit is contained in:
parent
2a6bccb4ce
commit
92dfec219d
9 changed files with 32 additions and 21 deletions
|
@ -103,9 +103,12 @@ set_entrypoint(bootmgfw EfiEntry)
|
||||||
|
|
||||||
target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr)
|
target_link_libraries(bootmgfw bootlib cportlib cmlib rtl libcntpr)
|
||||||
|
|
||||||
|
# dynamic analysis switches
|
||||||
if(STACK_PROTECTOR)
|
if(STACK_PROTECTOR)
|
||||||
target_link_libraries(bootmgfw gcc_ssp)
|
target_link_libraries(bootmgfw gcc_ssp)
|
||||||
elseif(RUNTIME_CHECKS)
|
endif()
|
||||||
|
|
||||||
|
if(RUNTIME_CHECKS)
|
||||||
target_link_libraries(bootmgfw runtmchk)
|
target_link_libraries(bootmgfw runtmchk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -148,9 +151,12 @@ endif()
|
||||||
|
|
||||||
target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr)
|
target_link_libraries(rosload bootlib cportlib cmlib rtl libcntpr)
|
||||||
|
|
||||||
|
# dynamic analysis switches
|
||||||
if(STACK_PROTECTOR)
|
if(STACK_PROTECTOR)
|
||||||
target_link_libraries(rosload gcc_ssp)
|
target_link_libraries(rosload gcc_ssp)
|
||||||
elseif(RUNTIME_CHECKS)
|
endif()
|
||||||
|
|
||||||
|
if(RUNTIME_CHECKS)
|
||||||
target_link_libraries(rosload runtmchk)
|
target_link_libraries(rosload runtmchk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ endif()
|
||||||
add_executable(freeldr_pe ${FREELDR_BASE_SOURCE})
|
add_executable(freeldr_pe ${FREELDR_BASE_SOURCE})
|
||||||
add_executable(freeldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE})
|
add_executable(freeldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE})
|
||||||
|
|
||||||
set_target_properties(freeldr_pe freeldr_pe_dbg
|
set_target_properties(freeldr_pe freeldr_pe_dbg
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
ENABLE_EXPORTS TRUE
|
ENABLE_EXPORTS TRUE
|
||||||
DEFINE_SYMBOL "")
|
DEFINE_SYMBOL "")
|
||||||
|
@ -308,10 +308,13 @@ endif()
|
||||||
target_link_libraries(freeldr_pe freeldr_common cportlib cmlib rtl libcntpr)
|
target_link_libraries(freeldr_pe freeldr_common cportlib cmlib rtl libcntpr)
|
||||||
target_link_libraries(freeldr_pe_dbg freeldr_common cportlib cmlib rtl libcntpr)
|
target_link_libraries(freeldr_pe_dbg freeldr_common cportlib cmlib rtl libcntpr)
|
||||||
|
|
||||||
|
# dynamic analysis switches
|
||||||
if(STACK_PROTECTOR)
|
if(STACK_PROTECTOR)
|
||||||
target_link_libraries(freeldr_pe gcc_ssp)
|
target_link_libraries(freeldr_pe gcc_ssp)
|
||||||
target_link_libraries(freeldr_pe_dbg gcc_ssp)
|
target_link_libraries(freeldr_pe_dbg gcc_ssp)
|
||||||
elseif(RUNTIME_CHECKS)
|
endif()
|
||||||
|
|
||||||
|
if(RUNTIME_CHECKS)
|
||||||
target_link_libraries(freeldr_pe runtmchk)
|
target_link_libraries(freeldr_pe runtmchk)
|
||||||
target_link_libraries(freeldr_pe_dbg runtmchk)
|
target_link_libraries(freeldr_pe_dbg runtmchk)
|
||||||
add_target_link_flags(freeldr_pe "/MERGE:.rtc=.text")
|
add_target_link_flags(freeldr_pe "/MERGE:.rtc=.text")
|
||||||
|
|
|
@ -13,7 +13,7 @@ if /I "%1" == "/?" (
|
||||||
:help
|
:help
|
||||||
echo Help for configure script
|
echo Help for configure script
|
||||||
echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options]
|
echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options]
|
||||||
echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC
|
echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution
|
||||||
echo Cmake-options: -DVARIABLE:TYPE=VALUE
|
echo Cmake-options: -DVARIABLE:TYPE=VALUE
|
||||||
goto quit
|
goto quit
|
||||||
)
|
)
|
||||||
|
@ -62,7 +62,6 @@ if defined ROS_ARCH (
|
||||||
)
|
)
|
||||||
set BUILD_ENVIRONMENT=VS
|
set BUILD_ENVIRONMENT=VS
|
||||||
set VS_SOLUTION=0
|
set VS_SOLUTION=0
|
||||||
set VS_RUNTIME_CHECKS=0
|
|
||||||
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!
|
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!
|
||||||
) else (
|
) else (
|
||||||
echo Error: Unable to detect build environment. Configure script failure.
|
echo Error: Unable to detect build environment. Configure script failure.
|
||||||
|
@ -90,8 +89,6 @@ REM Parse command line parameters
|
||||||
echo. && echo Error: Creation of VS Solution files is not supported in a MinGW environment.
|
echo. && echo Error: Creation of VS Solution files is not supported in a MinGW environment.
|
||||||
echo Please run this command in a [Developer] Command Prompt for Visual Studio.
|
echo Please run this command in a [Developer] Command Prompt for Visual Studio.
|
||||||
goto quit
|
goto quit
|
||||||
) else if /I "%1" == "RTC" (
|
|
||||||
echo. && echo Warning: RTC switch is ignored outside of a Visual Studio environment. && echo.
|
|
||||||
) else if /I "%1" NEQ "" (
|
) else if /I "%1" NEQ "" (
|
||||||
echo %1| find /I "-D" > NUL
|
echo %1| find /I "-D" > NUL
|
||||||
if %ERRORLEVEL% == 0 (
|
if %ERRORLEVEL% == 0 (
|
||||||
|
@ -128,9 +125,6 @@ REM Parse command line parameters
|
||||||
) else if "!ARCH!" == "arm" (
|
) else if "!ARCH!" == "arm" (
|
||||||
set CMAKE_ARCH=-A ARM
|
set CMAKE_ARCH=-A ARM
|
||||||
)
|
)
|
||||||
) else if /I "%1" == "RTC" (
|
|
||||||
echo Runtime checks enabled
|
|
||||||
set VS_RUNTIME_CHECKS=1
|
|
||||||
) else if /I "%1" NEQ "" (
|
) else if /I "%1" NEQ "" (
|
||||||
echo %1| find /I "-D" > NUL
|
echo %1| find /I "-D" > NUL
|
||||||
if %ERRORLEVEL% == 0 (
|
if %ERRORLEVEL% == 0 (
|
||||||
|
@ -197,9 +191,9 @@ if EXIST CMakeCache.txt (
|
||||||
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
||||||
cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
|
cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
|
||||||
) else if %USE_CLANG_CL% == 1 (
|
) else if %USE_CLANG_CL% == 1 (
|
||||||
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
|
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DUSE_CLANG_CL:BOOL=1 %* "%REACTOS_SOURCE_DIR%"
|
||||||
) else (
|
) else (
|
||||||
cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
|
cmake -G %CMAKE_GENERATOR% %CMAKE_ARCH% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
|
||||||
)
|
)
|
||||||
|
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
if %ERRORLEVEL% NEQ 0 (
|
||||||
|
|
|
@ -107,6 +107,7 @@ foreach(_keyboard_layout ${_keyboard_layouts})
|
||||||
set_property(TARGET ${_keyboard_layout} PROPERTY C_STANDARD 99)
|
set_property(TARGET ${_keyboard_layout} PROPERTY C_STANDARD 99)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# dynamic analysis switches
|
||||||
if (STACK_PROTECTOR)
|
if (STACK_PROTECTOR)
|
||||||
target_link_libraries(${_keyboard_layout} gcc_ssp)
|
target_link_libraries(${_keyboard_layout} gcc_ssp)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -34,9 +34,12 @@ else()
|
||||||
set_image_base(ntkrnlmp 0x80800000)
|
set_image_base(ntkrnlmp 0x80800000)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# dynamic analysis switches
|
||||||
if(STACK_PROTECTOR)
|
if(STACK_PROTECTOR)
|
||||||
target_link_libraries(ntkrnlmp gcc_ssp)
|
target_link_libraries(ntkrnlmp gcc_ssp)
|
||||||
elseif(RUNTIME_CHECKS)
|
endif()
|
||||||
|
|
||||||
|
if(RUNTIME_CHECKS)
|
||||||
target_link_libraries(ntkrnlmp runtmchk)
|
target_link_libraries(ntkrnlmp runtmchk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -44,4 +44,5 @@ set(USERMODE TRUE CACHE BOOL
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(_PREFAST_ FALSE CACHE BOOL
|
set(_PREFAST_ FALSE CACHE BOOL
|
||||||
"Whether to enable PREFAST while compiling.")
|
"Whether to enable PREFAST while compiling.")
|
||||||
|
option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -43,3 +43,7 @@ set(BUILD_MP TRUE CACHE BOOL
|
||||||
|
|
||||||
set(NEWSPRINTF FALSE CACHE BOOL
|
set(NEWSPRINTF FALSE CACHE BOOL
|
||||||
"Whether to compile the new sprintf.")
|
"Whether to compile the new sprintf.")
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON)
|
||||||
|
endif()
|
||||||
|
|
|
@ -83,9 +83,12 @@ set(_PREFAST_ FALSE CACHE BOOL
|
||||||
"Whether to enable PREFAST while compiling.")
|
"Whether to enable PREFAST while compiling.")
|
||||||
set(_VS_ANALYZE_ FALSE CACHE BOOL
|
set(_VS_ANALYZE_ FALSE CACHE BOOL
|
||||||
"Whether to enable static analysis while compiling.")
|
"Whether to enable static analysis while compiling.")
|
||||||
else()
|
|
||||||
set(STACK_PROTECTOR FALSE CACHE BOOL
|
option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON)
|
||||||
"Whether to enbable the GCC stack checker while compiling")
|
endif()
|
||||||
|
|
||||||
|
if(GCC)
|
||||||
|
option(STACK_PROTECTOR "Whether to enable the GCC stack checker while compiling" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(USE_DUMMY_PSEH FALSE CACHE BOOL
|
set(USE_DUMMY_PSEH FALSE CACHE BOOL
|
||||||
|
|
|
@ -151,10 +151,6 @@ if(MSVC_IDE AND (NOT DEFINED USE_FOLDER_STRUCTURE))
|
||||||
set(USE_FOLDER_STRUCTURE TRUE)
|
set(USE_FOLDER_STRUCTURE TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED RUNTIME_CHECKS)
|
|
||||||
set(RUNTIME_CHECKS FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(RUNTIME_CHECKS)
|
if(RUNTIME_CHECKS)
|
||||||
add_definitions(-D__RUNTIME_CHECKS__)
|
add_definitions(-D__RUNTIME_CHECKS__)
|
||||||
add_compile_flags("/RTC1")
|
add_compile_flags("/RTC1")
|
||||||
|
|
Loading…
Reference in a new issue