diff --git a/build/premake/extern_libs.lua b/build/premake/extern_libs.lua index 549e519..6e11d59 100644 --- a/build/premake/extern_libs.lua +++ b/build/premake/extern_libs.lua @@ -56,7 +56,8 @@ end -- library installation rules. extern_lib_defs = { boost = { - unix_names = { "boost_signals", "boost_filesystem" } + unix_names = { "boost_signals", "boost_filesystem" }, + osx_names = { "boost_signals-mt", "boost_filesystem-mt", "boost_system-mt" } }, cryptopp = { }, @@ -220,6 +221,8 @@ local function add_extern_lib(extern_lib, def) if def.win_names then names = def.win_names end + elseif OS == "macosx" and def.osx_names then + names = def.osx_names else if def.unix_names then names = def.unix_names diff --git a/build/premake/premake.lua b/build/premake/premake.lua index 4ce0add..ce04dd7 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -846,7 +846,7 @@ function setup_collada_package(package_name, target_type, rel_source_dirs, rel_i -- define MACOS-something? tinsert(package.buildoptions, "`pkg-config libxml-2.0 --cflags`") - tinsert(package.linkoptions, "`pkg-config libxml-2.0 --libs`") + tinsert(package.linkoptions, "`pkg-config libxml-2.0 --libs` -framework CoreServices") end end diff --git a/libraries/fcollada/include/FUtils/FUStringBuilder.h b/libraries/fcollada/include/FUtils/FUStringBuilder.h index bcb5b00..a2bcba1 100644 --- a/libraries/fcollada/include/FUtils/FUStringBuilder.h +++ b/libraries/fcollada/include/FUtils/FUStringBuilder.h @@ -117,9 +117,9 @@ public: /** Appends the integer value, after converting it to a string, to the content of the builder. @param i An integer value. */ - void append(const int32 i); - void append(const uint32 i); /**< See above. */ - void append(const uint64 i); /**< See above. */ + void append(int32 i); + void append(uint32 i); /**< See above. */ + void append(uint64 i); /**< See above. */ /** Appends the integer value, after converting it to a fm::string, in hexadecimal, to the content of the builder. diff --git a/libraries/fcollada/src/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp b/libraries/fcollada/src/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp index 6c054bf..552fe05 100644 --- a/libraries/fcollada/src/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp +++ b/libraries/fcollada/src/FCollada/FCDocument/FCDGeometryPolygonsTools.cpp @@ -905,10 +905,12 @@ namespace FCDGeometryPolygonsTools } } +#ifdef WIN32 #pragma warning(push) #pragma warning(disable : 4127) // conditional expression constant #pragma warning(disable : 4244) // conversion from 'const float' to 'uint8' - +#endif + #define INVALID_VTX_IDX (uint16(~0)) // This value is the default (invalid) value in the vtx data map template @@ -954,7 +956,9 @@ namespace FCDGeometryPolygonsTools } } +#ifdef WIN32 #pragma warning(pop) +#endif void PackVertexBufferV3(uint8* destBuffer, uint32 destBuffStride, const FCDGeometrySource* source, uint32 vCount, uint16* vtxPackingMap, diff --git a/libraries/fcollada/src/FCollada/FUtils/FUDebug.cpp b/libraries/fcollada/src/FCollada/FUtils/FUDebug.cpp index 4eadfee..90d5db3 100644 --- a/libraries/fcollada/src/FCollada/FUtils/FUDebug.cpp +++ b/libraries/fcollada/src/FCollada/FUtils/FUDebug.cpp @@ -70,7 +70,7 @@ void FUDebug::DebugOut(uint8 verbosity, const char* message, ...) void FUDebug::DebugOutV(uint8 verbosity, const char* filename, uint32 line, const char* message, va_list& vars) { char buffer[256]; - snprintf(buffer, 256, "[%s@%lu] ", filename, line); + snprintf(buffer, 256, "[%s@%u] ", filename, line); buffer[255] = 0; DebugString(buffer); diff --git a/libraries/fcollada/src/FCollada/FUtils/FUFileManager.cpp b/libraries/fcollada/src/FCollada/FUtils/FUFileManager.cpp index d01e991..ee89747 100644 --- a/libraries/fcollada/src/FCollada/FUtils/FUFileManager.cpp +++ b/libraries/fcollada/src/FCollada/FUtils/FUFileManager.cpp @@ -21,10 +21,11 @@ #if defined(WIN32) #include -#elif defined(__APPLE__) +#elif defined(LINUX) +#if defined(__APPLE__) #include typedef int (*NSGetExecutablePathProcPtr)(char *buf, size_t *bufsize); -#elif defined(LINUX) +#endif #include #include #include diff --git a/libraries/fcollada/src/FCollada/FUtils/FUStringBuilder.h b/libraries/fcollada/src/FCollada/FUtils/FUStringBuilder.h index bcb5b00..aefe58a 100644 --- a/libraries/fcollada/src/FCollada/FUtils/FUStringBuilder.h +++ b/libraries/fcollada/src/FCollada/FUtils/FUStringBuilder.h @@ -117,9 +117,12 @@ public: /** Appends the integer value, after converting it to a string, to the content of the builder. @param i An integer value. */ - void append(const int32 i); - void append(const uint32 i); /**< See above. */ - void append(const uint64 i); /**< See above. */ + void append(int32 i); + void append(uint32 i); /**< See above. */ + void append(uint64 i); /**< See above. */ +#if defined(__APPLE__) + void append(size_t i) { append((uint32) i); } +#endif /** Appends the integer value, after converting it to a fm::string, in hexadecimal, to the content of the builder. diff --git a/libraries/fcollada/src/Makefile b/libraries/fcollada/src/Makefile index bd795f9..e6f0ae2 100644 --- a/libraries/fcollada/src/Makefile +++ b/libraries/fcollada/src/Makefile @@ -1,8 +1,16 @@ +OS_ARCH := $(shell uname -s) + +ifeq ($(OS_ARCH),Darwin) +PIC_FLAGS := -fPIC +else +PIC_FLAGS := -fpic +endif + CXX := g++ -CXXFLAGS := -W -Wall -Wno-unused-parameter -Wno-unused-function -DLINUX -fPIC +CXXFLAGS := -W -Wall -Wno-unused-parameter -Wno-unused-function -DLINUX $(PIC_FLAGS) CXXFLAGS_DEBUG := -O0 -g -D_DEBUG CXXFLAGS_RELEASE := -O2 -DNDEBUG -DRETAIL -LDFLAGS := -lxml2 -shared -fPIC +LDFLAGS := -lxml2 -shared $(PIC_FLAGS) INCLUDES := -IFCollada -I/usr/include/libxml2 SOURCE = \ @@ -194,6 +202,7 @@ output/libFColladaSR.a: $(OBJECTS_RELEASE) ar -cr $@ $(OBJECTS_RELEASE); ranlib $@ install: output/libFColladaSD.a output/libFColladaSR.a + if [ ! -d ../lib ]; then mkdir ../lib ; fi cp output/libFColladaSD.a ../lib/libFColladaSD.a cp output/libFColladaSR.a ../lib/libFColladaSR.a diff --git a/source/lib/external_libraries/openal.h b/source/lib/external_libraries/openal.h index 86738d2..0128eb6 100644 --- a/source/lib/external_libraries/openal.h +++ b/source/lib/external_libraries/openal.h @@ -32,11 +32,8 @@ // ALC strings (e.g. device and extension names) are typed differently // between platforms *sigh* -#if OS_MACOSX -typedef ALCubyte* alcString; -#else +// No, they're not... typedef ALCchar* alcString; -#endif #if MSC_VERSION # pragma comment(lib, "openal32.lib") diff --git a/source/lib/secure_crt.h b/source/lib/secure_crt.h index 46daf1a..677714f 100644 --- a/source/lib/secure_crt.h +++ b/source/lib/secure_crt.h @@ -38,7 +38,7 @@ namespace ERR #if EMULATE_SECURE_CRT // (conflicts with glibc definitions) -#if !OS_UNIX +#if !OS_UNIX || OS_MACOSX // return length [in characters] of a string, not including the trailing // null character. to protect against access violations, only the // first characters are examined; if the null character is diff --git a/source/lib/sysdep/os/osx/odbg.cpp b/source/lib/sysdep/os/osx/odbg.cpp index 6f06d58..016b3c3 100644 --- a/source/lib/sysdep/os/osx/odbg.cpp +++ b/source/lib/sysdep/os/osx/odbg.cpp @@ -28,7 +28,7 @@ void* debug_GetCaller(void* UNUSED(context), const char* UNUSED(lastFuncToSkip)) return NULL; } -LibError debug_DumpStack(wchar_t* UNUSED(buf), size_t UNUSED(max_chars), size_t UNUSED(skip), void* UNUSED(context)) +LibError debug_DumpStack(wchar_t* UNUSED(buf), size_t UNUSED(max_chars), void* UNUSED(context), const char* UNUSED(lastFuncToSkip)) { return ERR::NOT_IMPLEMENTED; } diff --git a/source/lib/timer.cpp b/source/lib/timer.cpp index 59653ed..cf19acc 100644 --- a/source/lib/timer.cpp +++ b/source/lib/timer.cpp @@ -53,7 +53,11 @@ // they're also not guaranteed to be monotonic. #if HAVE_GETTIMEOFDAY +#if defined(__APPLE__) +static struct timeval start; +#else static struct timespec start; +#endif #elif HAVE_CLOCK_GETTIME static struct timeval start; #endif diff --git a/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp b/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp index b90d926..bb0e2b5 100644 --- a/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp +++ b/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp @@ -242,7 +242,11 @@ ActorViewer::ActorViewer(wxWindow* parent, ScriptInterface& scriptInterface) std::map treeEntries; +#ifdef wxHAS_REGEX_ADVANCED wxRegEx stripDirs (_T("^([^/]+)/"), wxRE_ADVANCED); // the non-empty string up to the first slash +#else + wxRegEx stripDirs (_T("^([^/]+)/"), wxRE_DEFAULT); // the non-empty string up to the first slash +#endif for (std::vector::iterator it = objects.begin(); it != objects.end(); ++it) { diff --git a/source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.cpp b/source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.cpp index 5372d3c..3708578 100644 --- a/source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.cpp +++ b/source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.cpp @@ -29,7 +29,11 @@ ColourDialog::ColourDialog(wxWindow* parent, const wxString& customColourConfigP // Load custom colours from the config database +#ifdef wxHAS_REGEX_ADVANCED wxRegEx re (_T("(\\d+) (\\d+) (\\d+)"), wxRE_ADVANCED); +#else + wxRegEx re (_T("(\\d+) (\\d+) (\\d+)"), wxRE_DEFAULT); +#endif wxConfigBase* cfg = wxConfigBase::Get(false); if (cfg) diff --git a/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp b/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp index 8ffeea9..3e7df46 100644 --- a/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp +++ b/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp @@ -243,6 +243,7 @@ public: virtual void OnFatalException() { +#if wxUSE_DEBUGREPORT wxDebugReport report; wxDebugReportPreviewStd preview; @@ -254,6 +255,7 @@ public: report.Process(); OpenDirectory(dir); } +#endif } /* Disabled (and should be removed if it turns out to be unnecessary) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp index ac215a8..89131f4 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -30,6 +30,14 @@ #include "General/AtlasEventLoop.h" #include "General/Datafile.h" +#if defined(__APPLE__) + #include "AtlasScript/ScriptInterface.h" + #define _UINT64 + #define _UINT32 + #define _UINT16 + #define _UINT8 +#endif + #include "CustomControls/HighResTimer/HighResTimer.h" #include "CustomControls/Buttons/ToolButton.h" #include "CustomControls/Canvas/Canvas.h" @@ -37,7 +45,9 @@ #include "GameInterface/MessagePasser.h" #include "GameInterface/Messages.h" +#if !defined(__APPLE__) #include "AtlasScript/ScriptInterface.h" +#endif #include "Tools/Common/Tools.h" #include "Tools/Common/Brushes.h"