* macOS build fixes (#1773)

* macOS build fixes

Add missing headers
Threads_Pthreads: do not call pthread_setname_np() on macOS as it does not do
the same as on Linux
DebugStr() -> os_log()

* Make the project build with Makefiles on macOS

* Fix getting modifier key state on Mac (#1774)

We really need to clean up all Carbon calls here (many will go away when the
project switches to SDL2 for all platforms)

* Fix Xcode build; bump minimum version of macOS (#1775)

* Build fixes for the "Unix Makefiles" generator
Pass CMAKE_BUILD_TYPE to the external projects
* Fix indent

* Fix setting CFBundleExecutable value

* Improve handling of system libpng

Header mismatch can cause a crash, so force the non-system png.h
if WITH_SYSTEM_PNG=no

* Better handling of TRUE/FALSE with newer versions of jpeglib

* Add JPEG include directory
This commit is contained in:
Tatsh
2019-03-10 16:02:55 -04:00
committed by Colby Klein
parent b8a79cd0f6
commit 3c8ee8675d
5 changed files with 20 additions and 9 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
</dict>
</array>
<key>CFBundleExecutable</key>
<string>PRODUCT_NAME</string>
<string>@SM_EXE_NAME@</string>
<key>CFBundleGetInfoString</key>
<string>@SM_EXE_NAME@ @SM_VERSION_TRADITIONAL@</string>
<key>CFBundleIconFile</key>
+3 -1
View File
@@ -441,6 +441,7 @@ else()
endif()
if(WITH_SYSTEM_PNG)
sm_add_compile_definition("${SM_EXE_NAME}" SYSTEM_PNG)
list(APPEND SMDATA_LINK_LIB ${PNG_LIBRARIES})
else()
list(APPEND SMDATA_LINK_LIB "png")
@@ -611,6 +612,7 @@ target_link_libraries("${SM_EXE_NAME}" ${SMDATA_LINK_LIB})
list(APPEND SM_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
"${SM_SRC_DIR}/generated")
list(APPEND SM_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
if(NOT APPLE)
list(APPEND SM_INCLUDE_DIRS
"${SM_EXTERN_DIR}/glew-1.5.8/include"
@@ -628,7 +630,6 @@ if(NOT APPLE)
if(WITH_OGG)
list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/vorbis")
endif()
list(APPEND SM_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
if(HAS_FFMPEG)
if(WITH_SYSTEM_FFMPEG)
list(APPEND SM_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIR}")
@@ -668,6 +669,7 @@ else()
list(APPEND SM_INCLUDE_DIRS "${SM_EXTERN_DIR}/libpng/include")
endif()
target_include_directories("${SM_EXE_NAME}" PUBLIC ${SM_INCLUDE_DIRS})
if(WIN32)
+7 -3
View File
@@ -12,7 +12,11 @@
#endif
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
#else
#ifndef SYSTEM_PNG
#include "../extern/libpng/include/png.h"
#else
#include <png.h>
#endif // SYSTEM_PNG
#endif // _MSC_VER
namespace
@@ -151,7 +155,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
type = PALETTE;
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
case PNG_COLOR_TYPE_GRAY_ALPHA:
type = RGBA;
png_set_gray_to_rgb( png );
break;
@@ -279,7 +283,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_PNG( const RString &sPath, RageSur
/*
* (c) 2004 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -289,7 +293,7 @@ RageSurfaceUtils::OpenResult RageSurface_Load_PNG( const RString &sPath, RageSur
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
+3 -2
View File
@@ -16,8 +16,9 @@ namespace jpeg
}
}
// Only Xcode wants this. FIXME
#if defined(PBBUILD) && defined(SYSTEM_JPEGLIB)
// Newer versions of jpeglib and jpeglib-turbo define TRUE/FALSE in a
// typedef enum {}
#if defined(SYSTEM_JPEGLIB) && JPEG_LIB_VERSION > 80
#define TRUE jpeg::TRUE
#define FALSE jpeg::FALSE
#endif
+6 -2
View File
@@ -13,7 +13,11 @@
#endif
#pragma warning(disable: 4611) /* interaction between '_setjmp' and C++ object destruction is non-portable */
#else
#ifndef SYSTEM_PNG
#include "../extern/libpng/include/png.h"
#else
#include <png.h>
#endif
#endif // _MSC_VER
static void SafePngError( png_struct *pPng, const RString &sStr )
@@ -141,7 +145,7 @@ bool RageSurfaceUtils::SavePNG( RageSurface *pImg, RageFile &f, RString &sError
/*
* (c) 2004-2006 Glenn Maynard
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -151,7 +155,7 @@ bool RageSurfaceUtils::SavePNG( RageSurface *pImg, RageFile &f, RString &sError
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF