Skip to content

Commit

Permalink
Merge pull request #17 from triplef/win-msvc-fixes
Browse files Browse the repository at this point in the history
Windows MSVC fixes
  • Loading branch information
rfm authored Mar 17, 2021
2 parents 1005016 + f4ec7e8 commit b262b4f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2021-03-09 Frederik Seiffert <[email protected]>

* target.make:
Link against debug or release UCRT DLLs for Windows MSVC and remove
unused -pthread flag.
* configure:
* configure.ac:
Fix CFLAGS for Windows MSVC.

2021-02-12 Frederik Seiffert <[email protected]>

* common.make: Silence PATH warning on Windows MSVC.
Expand Down
2 changes: 1 addition & 1 deletion TestFramework/Testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <string.h>

#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDate.h>
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSException.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSObject.h>
Expand Down
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -4918,6 +4918,12 @@ fi

fi

# On Windows MSVC, AC_PROG_CC will not detect Clang in MSVC mode as a
# GNU C compiler and therefore set CFLAGS to just "-g", so we fix it.
if test "$target_os" = windows -a x"${GCC}" != x"yes" -a x"$gs_cv_cc_is_clang" = x"yes"; then
CFLAGS="-g -O2"
fi

# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ else
AC_PROG_RANLIB
fi

# On Windows MSVC, AC_PROG_CC will not detect Clang in MSVC mode as a
# GNU C compiler and therefore set CFLAGS to just "-g", so we fix it.
if test "$target_os" = windows -a x"${GCC}" != x"yes" -a x"$gs_cv_cc_is_clang" = x"yes"; then
CFLAGS="-g -O2"
fi

AC_PROG_INSTALL

AC_MSG_CHECKING([if 'install -p' works])
Expand Down
19 changes: 15 additions & 4 deletions target.make
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ endif
# All code we build needs to be thread-safe nowadays
INTERNAL_CFLAGS = -pthread
INTERNAL_OBJCFLAGS = -pthread
ifeq ($(findstring android, $(GNUSTEP_TARGET_OS)), android)
INTERNAL_LDFLAGS =
else
INTERNAL_LDFLAGS = -pthread
INTERNAL_LDFLAGS =
ifneq ($(findstring android, $(GNUSTEP_TARGET_OS)), android)
ifneq ($(GNUSTEP_TARGET_OS), windows)
INTERNAL_LDFLAGS = -pthread
endif
endif

ifneq ("$(objc_threaded)","")
Expand All @@ -63,6 +64,16 @@ else ifeq ($(GNUSTEP_TARGET_OS), windows)
TARGET_SYSTEM_LIBS = $(CONFIG_SYSTEM_LIBS) \
-lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 \
-lmpr -lnetapi32 -lkernel32 -lshell32

# link against debug or release UCRT DLLs (i.e. /MDd or /MD)
ifeq ($(debug),)
debug = $(GNUSTEP_DEFAULT_DEBUG)
endif
ifeq ($(debug), yes)
TARGET_SYSTEM_LIBS += -lmsvcrtd -lvcruntimed -lucrtd
else
TARGET_SYSTEM_LIBS += -lmsvcrt -lvcruntime -lucrt
endif
endif

ifeq ($(findstring solaris, $(GNUSTEP_TARGET_OS)), solaris)
Expand Down

0 comments on commit b262b4f

Please sign in to comment.