2019-12-28 18:17:55 +00:00
|
|
|
# The libcontext library is only included inside common, so we create it as an
|
|
|
|
# object library and then add the objects to common.
|
|
|
|
|
|
|
|
# Link-time optimization (LTO) on GCC conflicts with embedded assembly (__asm),
|
|
|
|
# following GCC's recommendation to disable LTO per translation unit.
|
|
|
|
if( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
set_source_files_properties( libcontext.cpp PROPERTIES
|
|
|
|
COMPILE_FLAGS "-fno-lto"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-03-04 01:27:37 +00:00
|
|
|
list(APPEND LIBCONTEXT_SOURCES
|
|
|
|
libcontext.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
if( MSVC )
|
|
|
|
enable_language(ASM_MASM)
|
|
|
|
|
2021-03-05 02:31:53 +00:00
|
|
|
if( NOT LIBCONTEXT_USE_WINFIBER )
|
2021-03-12 15:05:38 +00:00
|
|
|
if ( KICAD_BUILD_ARCH_X86 )
|
2021-03-05 03:20:45 +00:00
|
|
|
set( CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh" )
|
2021-03-05 02:31:53 +00:00
|
|
|
list(APPEND LIBCONTEXT_SOURCES
|
|
|
|
make_i386_ms_pe_masm.asm
|
|
|
|
jump_i386_ms_pe_masm.asm
|
|
|
|
)
|
2021-03-11 02:43:41 +00:00
|
|
|
elseif( KICAD_BUILD_ARCH_X64 )
|
2021-03-05 02:31:53 +00:00
|
|
|
list(APPEND LIBCONTEXT_SOURCES
|
|
|
|
make_x86_64_ms_pe_masm.asm
|
|
|
|
jump_x86_64_ms_pe_masm.asm
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
add_compile_definitions(LIBCONTEXT_USE_WINFIBER)
|
2021-03-04 01:27:37 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-12-28 18:17:55 +00:00
|
|
|
|
|
|
|
add_library( libcontext OBJECT
|
2021-03-04 01:27:37 +00:00
|
|
|
${LIBCONTEXT_SOURCES}
|
2019-12-28 18:17:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories( libcontext PUBLIC
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|