2011-05-16 13:12:07 +00:00
|
|
|
|
2016-11-05 16:05:02 +00:00
|
|
|
if(ARCH STREQUAL "i386")
|
|
|
|
list(APPEND ASM_SOURCE
|
|
|
|
i386/seh.s
|
|
|
|
i386/seh_prolog.s)
|
2021-01-09 19:32:14 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
|
|
|
list(APPEND ASM_SOURCE
|
|
|
|
amd64/seh.s
|
|
|
|
amd64/seh_prolog.s)
|
|
|
|
elseif(ARCH STREQUAL "arm")
|
|
|
|
list(APPEND ASM_SOURCE
|
|
|
|
arm/seh_prolog.s)
|
2016-11-05 16:05:02 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-22 09:11:34 +00:00
|
|
|
if(MSVC OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (ARCH STREQUAL "amd64")))
|
2021-01-09 19:32:14 +00:00
|
|
|
list(APPEND SOURCE dummy.c)
|
|
|
|
add_asm_files(pseh_asm ${ASM_SOURCE})
|
|
|
|
add_library(pseh ${SOURCE} ${pseh_asm})
|
|
|
|
add_dependencies(pseh asm)
|
2021-04-22 09:11:34 +00:00
|
|
|
elseif((CMAKE_C_COMPILER_ID STREQUAL "GNU") AND (ARCH STREQUAL "amd64"))
|
|
|
|
# for GCC amd64 this is just an interface library, with our home-made plugin
|
|
|
|
add_library(pseh INTERFACE)
|
2021-05-19 12:13:51 +00:00
|
|
|
if (CMAKE_HOST_WIN32)
|
|
|
|
target_compile_options(pseh INTERFACE
|
|
|
|
$<$<COMPILE_LANGUAGE:C>:-fplugin=$<TARGET_FILE:native-gcc_plugin_seh>>
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fplugin=$<TARGET_FILE:native-g++_plugin_seh>>)
|
|
|
|
else()
|
|
|
|
target_compile_options(pseh INTERFACE $<$<COMPILE_LANGUAGE:C,CXX>:-fplugin=$<TARGET_FILE:native-gcc_plugin_seh>>)
|
|
|
|
endif()
|
2021-01-09 19:32:14 +00:00
|
|
|
else()
|
2011-05-16 13:12:07 +00:00
|
|
|
|
2013-09-17 22:31:33 +00:00
|
|
|
if(USE_PSEH3)
|
2016-04-20 12:36:25 +00:00
|
|
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/pseh)
|
2012-09-09 21:12:00 +00:00
|
|
|
list(APPEND SOURCE
|
|
|
|
i386/pseh3.c
|
|
|
|
i386/pseh3_i386.S)
|
2013-11-01 11:58:31 +00:00
|
|
|
elseif(USE_DUMMY_PSEH)
|
|
|
|
list(APPEND SOURCE dummy.c)
|
2012-09-09 21:12:00 +00:00
|
|
|
elseif(ARCH STREQUAL "i386")
|
2011-05-16 13:12:07 +00:00
|
|
|
list(APPEND SOURCE
|
|
|
|
i386/framebased.S
|
|
|
|
i386/framebased-gcchack.c
|
|
|
|
i386/framebased-gcchack-asm.S)
|
2012-08-27 18:58:27 +00:00
|
|
|
elseif(ARCH STREQUAL "amd64")
|
2011-05-16 13:12:07 +00:00
|
|
|
list(APPEND SOURCE amd64/framebased.S)
|
|
|
|
endif()
|
|
|
|
|
2016-11-05 16:05:02 +00:00
|
|
|
add_library(pseh ${SOURCE} ${ASM_SOURCE})
|
2011-06-06 11:44:58 +00:00
|
|
|
target_link_libraries(pseh chkstk)
|
2011-05-16 13:12:07 +00:00
|
|
|
add_dependencies(pseh psdk)
|
|
|
|
|
2021-04-22 09:11:34 +00:00
|
|
|
target_include_directories(pseh PRIVATE include/pseh)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(pseh INTERFACE include)
|
|
|
|
|
|
|
|
# Make it clear that we are using PSEH2
|
|
|
|
if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR
|
|
|
|
((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (NOT (ARCH STREQUAL "amd64"))))
|
|
|
|
target_compile_definitions(pseh INTERFACE __USE_PSEH2__)
|
2011-05-16 13:12:07 +00:00
|
|
|
endif()
|