Browse Source

Add cmake option to enable win32 fibers

6.0.7
Marek Roszko 5 years ago
parent
commit
2bf488e0c7
  1. 11
      CMakeLists.txt
  2. 24
      thirdparty/libcontext/CMakeLists.txt
  3. 5
      thirdparty/libcontext/libcontext.cpp

11
CMakeLists.txt

@ -135,6 +135,10 @@ cmake_dependent_option( KICAD_WIN32_DPI_AWARE
"Turn on DPI awareness for Windows builds only"
OFF "WIN32" OFF )
cmake_dependent_option( KICAD_WIN32_CONTEXT_WINFIBER
"Use win32 fibers for libcontext"
OFF "WIN32" OFF )
option( KICAD_USE_EGL
"Build KiCad with EGL backend support for Wayland."
OFF )
@ -219,6 +223,13 @@ perform_feature_checks()
# Setup the compiler warnings
include( ${CMAKE_MODULE_PATH}/Warnings.cmake )
if( KICAD_WIN32_CONTEXT_WINFIBER )
set(LIBCONTEXT_USE_WINFIBER true)
add_compile_definitions(LIBCONTEXT_USE_WINFIBER)
else()
set(LIBCONTEXT_USE_WINFIBER false)
endif()
if( WIN32 )
# define UNICODE and_UNICODE definition on Windows. KiCad uses unicode.
# Both definitions are required

24
thirdparty/libcontext/CMakeLists.txt

@ -16,16 +16,20 @@ list(APPEND LIBCONTEXT_SOURCES
if( MSVC )
enable_language(ASM_MASM)
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
list(APPEND LIBCONTEXT_SOURCES
make_i386_ms_pe_masm.asm
jump_i386_ms_pe_masm.asm
)
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
list(APPEND LIBCONTEXT_SOURCES
make_x86_64_ms_pe_masm.asm
jump_x86_64_ms_pe_masm.asm
)
if( NOT LIBCONTEXT_USE_WINFIBER )
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
list(APPEND LIBCONTEXT_SOURCES
make_i386_ms_pe_masm.asm
jump_i386_ms_pe_masm.asm
)
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
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)
endif()
endif()

5
thirdparty/libcontext/libcontext.cpp

@ -1398,10 +1398,15 @@ intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext( fcontext_t* ofc, fcontext_t n
void LIBCONTEXT_CALL_CONVENTION release_fcontext( fcontext_t ctx )
{
if( ctx == nullptr )
return;
if( fiberParams.find( ctx ) != fiberParams.end() )
{
fiberParams.erase( ctx );
}
DeleteFiber( ctx );
}

Loading…
Cancel
Save