Skip to content

Commit

Permalink
Merge branch 'macos-develop' into macos-3-0-0
Browse files Browse the repository at this point in the history
  • Loading branch information
backwardsEric committed Dec 15, 2024
2 parents 07db850 + 7104f68 commit 8b1c884
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ if test x"$enable_cocoa" = xyes ; then
AC_DEFINE(VERSION_STRING, "3.0.0", [Version string to use for var directory])
fi

dnl Set minimum targeted version of macOS.
AC_ARG_VAR([MACOS_MIN], [minimum version number of macOS to target; default is 10.15 which is the oldest version that the source code can handle])
if test x"$MACOS_MIN" = x ; then
AC_SUBST(MACOS_MIN_INTERNAL, 10.15)
else
AC_SUBST(MACOS_MIN_INTERNAL, $MACOS_MIN)
fi

dnl Checks for libraries.
dnl Replace `main' with a function in -lncurses:
if test x"$enable_cocoa" != xyes ; then
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1143,11 +1143,11 @@ hengband_SOURCES += \
cocoa/AngbandAudio.mm \
cocoa/SoundAndMusic.h \
cocoa/SoundAndMusic.mm
AM_CFLAGS = -mmacosx-version-min=10.15 -Wunguarded-availability
AM_OBJCXXFLAGS = -std=c++20 -fobjc-arc -mmacosx-version-min=10.15 -Wunguarded-availability -stdlib=libc++
AM_CXXFLAGS = -mmacosx-version-min=10.15 -Wunguarded-availability -stdlib=libc++
AM_CFLAGS = -mmacosx-version-min=${MACOS_MIN_INTERNAL} -Wunguarded-availability
AM_OBJCXXFLAGS = -std=c++20 -fobjc-arc -mmacosx-version-min=${MACOS_MIN_INTERNAL} -Wunguarded-availability -stdlib=libc++
AM_CXXFLAGS = -mmacosx-version-min=${MACOS_MIN_INTERNAL} -Wunguarded-availability -stdlib=libc++
hengband_LDFLAGS = -framework cocoa -framework AVFoundation $(AM_LDFLAGS)
hengband_LINK = MACOSX_DEPLOYMENT_TARGET=10.15 $(OBJCXXLINK) $(hengband_LDFLAGS) $(LDFLAGS) -o $@
hengband_LINK = MACOSX_DEPLOYMENT_TARGET=${MACOS_MIN_INTERNAL} $(OBJCXXLINK) $(hengband_LDFLAGS) $(LDFLAGS) -o $@
APPNAME = $(PACKAGE_NAME)
APPEXE = hengband
APPDIR = $(APPNAME).app
Expand Down
13 changes: 7 additions & 6 deletions src/main-cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1917,8 +1917,8 @@ static BOOL graphics_will_be_enabled(void)

#pragma mark Prototypes
static void wakeup_event_loop(void);
static void hook_plog(const char *str);
static void hook_quit(const char * str);
static void hook_plog(std::string_view str);
static void hook_quit(std::string_view str);
static NSString* get_lib_directory(void);
static NSString* get_doc_directory(void);
static NSString* AngbandCorrectedDirectoryPath(NSString *originalPath);
Expand Down Expand Up @@ -5182,14 +5182,15 @@ static BOOL check_events(int wait)
/**
* Hook to tell the user something important
*/
static void hook_plog(const char * str)
static void hook_plog(std::string_view str)
{
if (str)
if (str.size() > 0)
{
NSString *msg = NSLocalizedStringWithDefaultValue(
@"Warning", AngbandMessageCatalog, [NSBundle mainBundle],
@"Warning", @"Alert text for generic warning");
NSString *info = [NSString stringWithCString:str
NSString *info = [[NSString alloc] initWithBytes:str.data()
length:str.size()
#ifdef JP
encoding:NSJapaneseEUCStringEncoding
#else
Expand All @@ -5208,7 +5209,7 @@ static void hook_plog(const char * str)
/**
* Hook to tell the user something, and then quit
*/
static void hook_quit(const char * str)
static void hook_quit(std::string_view str)
{
for (int i = ANGBAND_TERM_MAX - 1; i >= 0; --i) {
if (angband_terms[i]) {
Expand Down
3 changes: 3 additions & 0 deletions src/util/angband-files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ static std::optional<std::string> read_line(FILE *fp)
int c = fgetc(fp);

if (c == EOF) {
buf[i] = '\0';
std::string_view sv(buf);
line_buf.append(sv.begin(), sv.end());
break;
}
/*
Expand Down

0 comments on commit 8b1c884

Please sign in to comment.