Skip to content

Commit

Permalink
Win32 cleanups:
Browse files Browse the repository at this point in the history
if is not a function call.
Clang-cl does not appear to support x86.
B3DPlugin needs user32.dll
  • Loading branch information
eliotmiranda committed Sep 7, 2020
1 parent 9d44f97 commit d04e683
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 86 deletions.
30 changes: 8 additions & 22 deletions build.win32x86/common/Makefile.msvc.flags 100644 → 100755
Expand Up @@ -27,37 +27,23 @@ override VCINSTALLDIR:=$(shell echo "$(VCINSTALLDIR)" | sed 's/ /\\ /g')
override VCINSTALLDIRSH:=$(shell echo "$(VCINSTALLDIR)" | sed 's/[()]/\\&/g')

#############################################################################
# C compiler settings Visual C++ 2017 Community Edition
# C compiler settings assuming Visual C++ 2017 Community Edition
#
# Try and choose a compiler. Alas clang-cl does not appear to support x86.
# And ClangC2 is broken. So just use MSVC
#
# Now choose the compiler. If Clang/C2 has been installed use it, otherwise
# use MSVC

$(info VCINSTALLDIR=$(VCINSTALLDIR))
$(info VCINSTALLDIRSH=$(VCINSTALLDIRSH))
#$(info wildcard VCINSTALLDIR $(wildcard $(VCINSTALLDIR)/.*))
#$(info wildcard VCINSTALLDIR/Tools/ClangC2 $(wildcard $(VCINSTALLDIR)/Tools/ClangC2/.*))
#$(info wildcard VCINSTALLDIR/Tools/ClangC3 $(wildcard $(VCINSTALLDIR)/Tools/ClangC3/.*))
ifneq ($(wildcard $(VCINSTALLDIR)/Tools/ClangC2/.*),)
$(info Clang/C2 detected)
#$(info shell echo VCINST...SH/./clang.exe $(shell echo $(VCINSTALLDIRSH)Tools/ClangC2/*/bin/HostX64/clang.exe))
CC:="$(shell echo $(VCINSTALLDIRSH)Tools/ClangC2/*/bin/HostX64/clang.exe)"
ClangC2:=ClangC2
undefine MSVC
LINKERARGS=-Xlinker
CLANG_ADAPT:=-fmsc-version=1916 # as reported by boost for MSVC Community 2017
CLANG_LINK_ADAPT:=-defaultlib:libcmt
CLANG_VERSION:=$(basename $(dir $(dir $(dir $(CC)))))
$(info CLANG_VERSION=$(CLANG_VERSION))
PATH:=$(PATH):$(dir $(shell echo $(VCINSTALLDIRSH)Tools/ClangC2/*/bin/HostX64/clang.exe))x86
$(info $$PATH=$(PATH))
else
$(info Clang/C2 not found)
$(info wildcard C:/Program\ Files/LLVM/bin/.* $(wildcard C:/Program\ Files/LLVM/bin/.*))

override TOOLPREFIX:="$(VCToolsInstallDir)bin/HostX64/x86/"
MSVC:=MSVC
undefine Clang
undefine ClangC2
LINKERARGS=/link
CC:=$(TOOLPREFIX)cl.exe -nologo
endif

$(info CC=$(CC))


Expand Down
9 changes: 4 additions & 5 deletions build.win32x86/common/Makefile.msvc.tools
Expand Up @@ -86,11 +86,10 @@ CONSOLELDFLAGS:= /subsystem:console $(BASELDFLAGS)
DL:=/DEFAULTLIB:
NDL:=/NODEFAULTLIB:

STDLIBS:=$(NDL)libc $(NDL)libcmt $(DL)msvcrt \
$(DL)ddraw $(DL)dinput8 $(DL)opengl32 $(DL)ws2_32 $(DL)comdlg32 \
$(DL)ole32 $(DL)winmm $(DL)version $(DL)wininet $(DL)user32 $(DL)gdi32\
$(DL)psapi $(DL)advapi32 $(DL)kernel32 $(DL)dsound $(DL)secur32 \
$(DL)shell32 $(DL)shfolder
STDLIBS:=$(STDLIBS) $(NDL)libc $(NDL)libcmt $(DL)msvcrt \
dinput8.lib ws2_32.lib comdlg32.lib ole32.lib winmm.lib \
version.lib wininet.lib user32.lib gdi32.lib psapi.lib \
advapi32.lib kernel32.lib secur32.lib shell32.lib shfolder.lib

#############################################################################
# Tools to use
Expand Down
4 changes: 2 additions & 2 deletions build.win64x64/common/Makefile.tools
Expand Up @@ -46,7 +46,7 @@ COGDEFS:= $(COGDEFS) -DBIT_IDENTICAL_FLOATING_POINT=1
endif

ifeq ($(COMPILER_TO_USE),clang)
COGDEFS:=$(COGDEFS) -mno-stack-arg-probe
COGDEFS:=$(COGDEFS) -mno-stack-arg-probe -fno-stack-protector
endif

# Set minimum version to WindowsXP (see /cygwin/usr/include/w32api/w32api.h)
Expand All @@ -73,7 +73,7 @@ LD:= $(CC)
LDCXX := $(TOOLPREFIX)clang++ # For linking c++ bundles

EXPORT:=--export-all-symbols
BASELDFLAGS:=-m64 -mthreads -Wl,$(EXPORT)
BASELDFLAGS:=-m64 -mthreads -Wl,--stack -Xlinker 2097152,2097152 -Wl,$(EXPORT)
LDFLAGS:= -mwindows $(BASELDFLAGS)
CONSOLELDFLAGS:= -mconsole $(BASELDFLAGS)
STDLIBS:= -lddraw -ldinput -lopengl32 -lws2_32 -lcomdlg32 -lole32 -lwinmm \
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/plugins/B3DAcceleratorPlugin/Makefile.msvc
Expand Up @@ -3,6 +3,6 @@
# Copyright (c) 2020 3D Immersive Collaboration Consulting, LLC
#############################################################################

EXTRALIBS:=opengl32.lib ddraw.lib dxguid.lib gdi32.lib
EXTRALIBS:=opengl32.lib ddraw.lib dxguid.lib gdi32.lib user32.lib

include ../common/Makefile.msvc.plugin

0 comments on commit d04e683

Please sign in to comment.