mirror of https://github.com/OpenTTD/OpenTTD
(svn r16221) -Change: support building 64 bits OSX binaries and add optional support for 64 bits binaries in OSX universal binaries. However, do not default to adding 64 bits binaries because benchmarking has shown that they are slower than the 32 bits binaries.
parent
d685ca0619
commit
5f4eeee5f0
62
config.lib
62
config.lib
|
@ -491,7 +491,11 @@ check_params() {
|
||||||
if [ "$enable_universal" = "0" ]; then
|
if [ "$enable_universal" = "0" ]; then
|
||||||
log 1 "checking universal build... no"
|
log 1 "checking universal build... no"
|
||||||
else
|
else
|
||||||
log 1 "checking universal build... yes"
|
if [ "$enable_universal" = "64" ]; then
|
||||||
|
log 1 "checking universal build... yes (including 64 bits)"
|
||||||
|
else
|
||||||
|
log 1 "checking universal build... yes (without 64 bits)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Already detected by check_build
|
# Already detected by check_build
|
||||||
|
@ -1173,8 +1177,14 @@ make_cflags_and_ldflags() {
|
||||||
|
|
||||||
if [ "$os" = "OSX" ]; then
|
if [ "$os" = "OSX" ]; then
|
||||||
LDFLAGS="$LDFLAGS -framework Cocoa"
|
LDFLAGS="$LDFLAGS -framework Cocoa"
|
||||||
if [ "$enable_dedicated" = "0" ]; then
|
if [ "$enable_dedicated" = "0" ] && [ "$cpu_type" = "32" ]; then
|
||||||
LIBS="$LIBS -framework QuickTime"
|
LIBS="$LIBS -framework QuickTime"
|
||||||
|
else
|
||||||
|
CFLAGS="$CFLAGS -DNO_QUICKTIME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$cpu_type" = "64" ]; then
|
||||||
|
CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1378,7 +1388,7 @@ make_cflags_and_ldflags() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$enable_osx_g5" != "0" ]; then
|
if [ "$enable_osx_g5" != "0" ]; then
|
||||||
CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt"
|
CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$personal_dir" ]; then
|
if [ -n "$personal_dir" ]; then
|
||||||
|
@ -1962,6 +1972,11 @@ detect_cocoa() {
|
||||||
log 1 "checking whether to enable the Quartz window subdriver... no"
|
log 1 "checking whether to enable the Quartz window subdriver... no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 64 bits doesn't have quickdraw
|
||||||
|
if [ "$cpu_type" = "64" ]; then
|
||||||
|
enable_cocoa_quickdraw="0"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$enable_cocoa_quickdraw" != "0" ]; then
|
if [ "$enable_cocoa_quickdraw" != "0" ]; then
|
||||||
log 1 "checking whether to enable the Quickdraw window subdriver... yes"
|
log 1 "checking whether to enable the Quickdraw window subdriver... yes"
|
||||||
else
|
else
|
||||||
|
@ -2503,7 +2518,8 @@ detect_cputype() {
|
||||||
log 1 "forcing cpu-type... $cpu_type bits"
|
log 1 "forcing cpu-type... $cpu_type bits"
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp
|
echo "#define _SQ64 1" > tmp.64bit.cpp
|
||||||
|
echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
|
||||||
echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
|
echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
|
||||||
echo "int main() { return 0; }" >> tmp.64bit.cpp
|
echo "int main() { return 0; }" >> tmp.64bit.cpp
|
||||||
execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
|
execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
|
||||||
|
@ -2699,24 +2715,52 @@ generate_src_normal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_src_osx() {
|
generate_src_osx() {
|
||||||
|
CLEAN_CFLAGS="$CFLAGS"
|
||||||
|
CLEAN_LDFLAGS="$LDFLAGS"
|
||||||
cc_host_orig="$cc_host"
|
cc_host_orig="$cc_host"
|
||||||
cxx_host_orig="$cxx_host"
|
cxx_host_orig="$cxx_host"
|
||||||
|
|
||||||
|
# 10.3(.9) can run on PPC, but not on i386
|
||||||
|
CFLAGS="$CLEAN_CFLAGS -mmacosx-version-min=10.3"
|
||||||
|
LDFLAGS="$CLEAN_CFLAGS -mmacosx-version-min=10.3"
|
||||||
|
|
||||||
BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
|
BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
|
||||||
cc_host="$cc_host_orig -arch ppc"
|
cc_host="$cc_host_orig -arch ppc"
|
||||||
cxx_host="$cxx_host_orig -arch ppc"
|
cxx_host="$cxx_host_orig -arch ppc"
|
||||||
generate_src_normal "[PowerPC]" "objs/ppc"
|
generate_src_normal "[PowerPC]" "objs/ppc"
|
||||||
|
|
||||||
|
BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
|
||||||
|
cc_host="$cc_host_orig -arch ppc970"
|
||||||
|
cxx_host="$cxx_host_orig -arch ppc970"
|
||||||
|
CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
|
||||||
|
generate_src_normal "[PowerPC G5]" "objs/ppc970"
|
||||||
|
|
||||||
|
# 10.4.0 starts supporting i386
|
||||||
|
CFLAGS="$CLEAN_CFLAGS -mmacosx-version-min=10.4"
|
||||||
|
LDFLAGS="$CLEAN_CFLAGS -mmacosx-version-min=10.4"
|
||||||
|
|
||||||
BASE_SRC_OBJS_DIR="$OBJS_DIR/intel"
|
BASE_SRC_OBJS_DIR="$OBJS_DIR/intel"
|
||||||
cc_host="$cc_host_orig -arch i386"
|
cc_host="$cc_host_orig -arch i386"
|
||||||
cxx_host="$cxx_host_orig -arch i386"
|
cxx_host="$cxx_host_orig -arch i386"
|
||||||
generate_src_normal "[Intel]" "objs/intel"
|
generate_src_normal "[Intel]" "objs/intel"
|
||||||
|
|
||||||
BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
|
if [ "$enable_universal" = "64" ]; then
|
||||||
cc_host="$cc_host_orig -arch ppc970"
|
# 64 bits is always 10.5 or higher. Furthermore it has a broken ICONV
|
||||||
cxx_host="$cxx_host_orig -arch ppc970"
|
# and they also removed support for QuickTime/QuickDraw
|
||||||
CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt"
|
CFLAGS="$CLEAN_CFLAGS -D_SQ64 -DHAVE_BROKEN_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW -mmacosx-version-min=10.5"
|
||||||
generate_src_normal "[PowerPC G5]" "objs/ppc970"
|
LDFLAGS="$CLEAN_CFLAGS -mmacosx-version-min=10.5"
|
||||||
|
LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
|
||||||
|
|
||||||
|
BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
|
||||||
|
cc_host="$cc_host_orig -arch ppc64"
|
||||||
|
cxx_host="$cxx_host_orig -arch ppc64"
|
||||||
|
generate_src_normal "[PowerPC 64 bits]" "objs/ppc64"
|
||||||
|
|
||||||
|
BASE_SRC_OBJS_DIR="$OBJS_DIR/intel64"
|
||||||
|
cc_host="$cc_host_orig -arch x86_64"
|
||||||
|
cxx_host="$cxx_host_orig -arch x86_64"
|
||||||
|
generate_src_normal "[Intel 64 bits]" "objs/intel64"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_src() {
|
generate_src() {
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NO_QUICKTIME
|
||||||
|
|
||||||
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
|
#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
|
|
||||||
|
@ -347,3 +349,4 @@ void MusicDriver_QtMidi::SetVolume(byte vol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* NO_QUICKTIME */
|
||||||
|
|
|
@ -71,7 +71,10 @@ struct OTTD_QuartzGammaTable {
|
||||||
@implementation NSScreen (NSScreenAccess)
|
@implementation NSScreen (NSScreenAccess)
|
||||||
- (void) setFrame:(NSRect)frame;
|
- (void) setFrame:(NSRect)frame;
|
||||||
{
|
{
|
||||||
|
/* The 64 bits libraries don't seem to know about _frame, so this hack won't work. */
|
||||||
|
#if !__LP64__
|
||||||
_frame = frame;
|
_frame = frame;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue