Remove pthreads on Win32 from build files

This commit is contained in:
David Hrdlička 2021-09-23 23:03:26 +02:00
parent 4f57f29836
commit 73cac00119
5 changed files with 7 additions and 50 deletions

View File

@ -88,10 +88,6 @@ CMAKE_DEPENDENT_OPTION(VNC "VNC renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF) CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF) CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF)
if(WIN32)
option(PTHREAD "Use POSIX threads (pthreads) instead of Win32 threads" ON)
endif()
# HACK: Avoid a MSVC2019 compiler bug on ARM64 Debug builds # HACK: Avoid a MSVC2019 compiler bug on ARM64 Debug builds
if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64") if(MSVC_TOOLSET_VERSION GREATER_EQUAL 142 AND ARCH STREQUAL "arm64")
# Define a cache option in case somebody wants to disable this workaround # Define a cache option in case somebody wants to disable this workaround

View File

@ -47,22 +47,6 @@ if(VNC)
endif() endif()
endif() endif()
if(NOT WIN32 OR PTHREAD)
target_sources(86Box PRIVATE thread.c)
if(WIN32 AND VCPKG_TOOLCHAIN)
find_package(pthreads REQUIRED)
if (PThreads4W_FOUND)
target_link_libraries(86Box PThreads4W::PThreads4W)
else()
target_link_libraries(86Box pthreads)
endif()
else()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(86Box Threads::Threads)
endif()
endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid voodoo plat ui) net print scsi sio snd vid voodoo plat ui)

View File

@ -8,10 +8,14 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
else() else()
set(PLAT_SOURCES unix_midi.c) set(PLAT_SOURCES unix_midi.c)
endif() endif()
add_library(plat STATIC ${PLAT_SOURCES}) add_library(plat STATIC ${PLAT_SOURCES} unix_thread.c)
add_library(ui STATIC unix.c unix_sdl.c unix_cdrom.c) add_library(ui STATIC unix.c unix_sdl.c unix_cdrom.c)
target_compile_definitions(ui PUBLIC _FILE_OFFSET_BITS=64) target_compile_definitions(ui PUBLIC _FILE_OFFSET_BITS=64)
target_link_libraries(ui dl) target_link_libraries(ui dl)
if (ALSA_FOUND) if (ALSA_FOUND)
target_link_libraries(plat ALSA::ALSA) target_link_libraries(plat ALSA::ALSA)
endif() endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(86Box Threads::Threads)

View File

@ -15,7 +15,7 @@
enable_language(RC) enable_language(RC)
add_library(plat OBJECT win.c win_dynld.c win_cdrom.c add_library(plat OBJECT win.c win_dynld.c win_cdrom.c win_thread.c
win_keyboard.c win_crashdump.c win_midi.c win_mouse.c) win_keyboard.c win_crashdump.c win_midi.c win_mouse.c)
add_library(ui OBJECT win_ui.c win_stbar.c win_sdl.c win_dialog.c win_about.c add_library(ui OBJECT win_ui.c win_stbar.c win_sdl.c win_dialog.c win_about.c
@ -58,9 +58,5 @@ if(OPENGL)
target_sources(ui PRIVATE glad.c win_opengl.c win_opengl_glslp.c) target_sources(ui PRIVATE glad.c win_opengl.c win_opengl_glslp.c)
endif() endif()
if(NOT PTHREAD)
target_sources(plat PRIVATE win_thread.c)
endif()
target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi
dxguid imm32 hid setupapi uxtheme version winmm psapi) dxguid imm32 hid setupapi uxtheme version winmm psapi)

View File

@ -26,10 +26,6 @@ ifndef DEV_BUILD
DEV_BUILD := n DEV_BUILD := n
endif endif
ifneq ($(PTHREAD), n)
PTHREAD := y
endif
ifeq ($(DEV_BUILD), y) ifeq ($(DEV_BUILD), y)
ifndef DEBUG ifndef DEBUG
DEBUG := y DEBUG := y
@ -611,17 +607,10 @@ CXXFLAGS := $(CFLAGS)
######################################################################### #########################################################################
# Create the (final) list of objects to build. # # Create the (final) list of objects to build. #
######################################################################### #########################################################################
ifeq ($(PTHREAD), y)
MAINOBJ := 86box.o config.o random.o timer.o io.o acpi.o apm.o dma.o ddma.o \
nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o \
usb.o device.o nvr.o nvr_at.o nvr_ps2.o thread.o \
$(VNCOBJ)
else
MAINOBJ := 86box.o config.o random.o timer.o io.o acpi.o apm.o dma.o ddma.o \ MAINOBJ := 86box.o config.o random.o timer.o io.o acpi.o apm.o dma.o ddma.o \
nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o \ nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o \
usb.o device.o nvr.o nvr_at.o nvr_ps2.o \ usb.o device.o nvr.o nvr_at.o nvr_ps2.o \
$(VNCOBJ) $(VNCOBJ)
endif
MEMOBJ := catalyst_flash.o i2c_eeprom.o intel_flash.o mem.o rom.o smram.o spd.o sst_flash.o MEMOBJ := catalyst_flash.o i2c_eeprom.o intel_flash.o mem.o rom.o smram.o spd.o sst_flash.o
@ -802,19 +791,11 @@ VOODOOOBJ := vid_voodoo.o vid_voodoo_banshee.o \
vid_voodoo_render.o vid_voodoo_setup.o \ vid_voodoo_render.o vid_voodoo_setup.o \
vid_voodoo_texture.o vid_voodoo_texture.o
ifeq ($(PTHREAD), y)
PLATOBJ := win.o \
win_dynld.o \
win_cdrom.o win_keyboard.o \
win_crashdump.o win_midi.o \
win_mouse.o
else
PLATOBJ := win.o \ PLATOBJ := win.o \
win_dynld.o win_thread.o \ win_dynld.o win_thread.o \
win_cdrom.o win_keyboard.o \ win_cdrom.o win_keyboard.o \
win_crashdump.o win_midi.o \ win_crashdump.o win_midi.o \
win_mouse.o win_mouse.o
endif
ifeq ($(DINPUT), y) ifeq ($(DINPUT), y)
PLATOBJ += win_joystick.o PLATOBJ += win_joystick.o
@ -840,11 +821,7 @@ endif
ifneq ($(WX), n) ifneq ($(WX), n)
LIBS += $(WX_LIBS) -lm LIBS += $(WX_LIBS) -lm
endif endif
ifeq ($(PTHREAD), y)
LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++ -lpthread
else
LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++ LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -luxtheme -lversion -lwinmm -static -lstdc++
endif
ifneq ($(X64), y) ifneq ($(X64), y)
ifneq ($(ARM64), y) ifneq ($(ARM64), y)
LIBS += -Wl,--large-address-aware LIBS += -Wl,--large-address-aware