diff --git a/Xcode/Info.plist.in.xml b/Xcode/Info.plist.in.xml
index 81bc3b383f..34d6ffee4d 100644
--- a/Xcode/Info.plist.in.xml
+++ b/Xcode/Info.plist.in.xml
@@ -28,7 +28,7 @@
CFBundleExecutable
- PRODUCT_NAME
+ @SM_EXE_NAME@
CFBundleGetInfoString
@SM_EXE_NAME@ @SM_VERSION_TRADITIONAL@
CFBundleIconFile
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82a7866d5c..bb8b669591 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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)
diff --git a/src/RageSurface_Load_PNG.cpp b/src/RageSurface_Load_PNG.cpp
index aa4ab5f47f..0425ad23cf 100644
--- a/src/RageSurface_Load_PNG.cpp
+++ b/src/RageSurface_Load_PNG.cpp
@@ -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
+#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
diff --git a/src/RageSurface_Save_JPEG.cpp b/src/RageSurface_Save_JPEG.cpp
index 79028505ff..52365acb44 100644
--- a/src/RageSurface_Save_JPEG.cpp
+++ b/src/RageSurface_Save_JPEG.cpp
@@ -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
diff --git a/src/RageSurface_Save_PNG.cpp b/src/RageSurface_Save_PNG.cpp
index 25cf308bfe..49d832e7b5 100644
--- a/src/RageSurface_Save_PNG.cpp
+++ b/src/RageSurface_Save_PNG.cpp
@@ -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
+#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