1 2if(ARCH STREQUAL "i386") 3 list(APPEND ASM_SOURCE 4 i386/seh.s 5 i386/seh_prolog.s) 6elseif(ARCH STREQUAL "amd64") 7 list(APPEND ASM_SOURCE 8 amd64/seh.s 9 amd64/seh_prolog.s) 10elseif(ARCH STREQUAL "arm") 11 list(APPEND ASM_SOURCE 12 arm/seh_prolog.s) 13endif() 14 15if(MSVC OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (ARCH STREQUAL "amd64"))) 16 list(APPEND SOURCE dummy.c) 17 add_asm_files(pseh_asm ${ASM_SOURCE}) 18 add_library(pseh ${SOURCE} ${pseh_asm}) 19 add_dependencies(pseh asm) 20elseif((CMAKE_C_COMPILER_ID STREQUAL "GNU") AND (ARCH STREQUAL "amd64")) 21 # for GCC amd64 this is just an interface library, with our home-made plugin 22 add_library(pseh INTERFACE) 23 if (CMAKE_HOST_WIN32) 24 target_compile_options(pseh INTERFACE 25 $<$<COMPILE_LANGUAGE:C>:-fplugin=$<TARGET_FILE:native-gcc_plugin_seh>> 26 $<$<COMPILE_LANGUAGE:CXX>:-fplugin=$<TARGET_FILE:native-g++_plugin_seh>>) 27 else() 28 target_compile_options(pseh INTERFACE $<$<COMPILE_LANGUAGE:C,CXX>:-fplugin=$<TARGET_FILE:native-gcc_plugin_seh>>) 29 endif() 30else() 31 32 if(USE_PSEH3) 33 include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/pseh) 34 list(APPEND SOURCE 35 i386/pseh3.c 36 i386/pseh3_i386.S) 37 elseif(USE_DUMMY_PSEH) 38 list(APPEND SOURCE dummy.c) 39 elseif(ARCH STREQUAL "i386") 40 list(APPEND SOURCE 41 i386/framebased.S 42 i386/framebased-gcchack.c 43 i386/framebased-gcchack-asm.S) 44 elseif(ARCH STREQUAL "amd64") 45 list(APPEND SOURCE amd64/framebased.S) 46 endif() 47 48 add_library(pseh ${SOURCE} ${ASM_SOURCE}) 49 target_link_libraries(pseh chkstk) 50 add_dependencies(pseh psdk) 51 52 target_include_directories(pseh PRIVATE include/pseh) 53endif() 54 55target_include_directories(pseh INTERFACE include) 56 57# Make it clear that we are using PSEH2 58if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR 59 ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (NOT (ARCH STREQUAL "amd64")))) 60 target_compile_definitions(pseh INTERFACE __USE_PSEH2__) 61endif() 62