From 2dc7c4a9cc669427851a57c3548ad568d782d5f0 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Sun, 2 Apr 2017 16:57:56 +0100 Subject: [PATCH] move log.h include in each file instead of pch, link libcurl and compile for mac --- engine.xcodeproj/project.pbxproj | 14 ++++++++++++++ engine/app.cpp | 1 + engine/asset.cpp | 1 + engine/bezier.cpp | 1 + engine/brush.cpp | 3 +-- engine/canvas.cpp | 3 +-- engine/font.cpp | 1 + engine/image.cpp | 1 + engine/layout.cpp | 1 + engine/layout.h | 5 +++-- engine/log.cpp | 2 +- engine/main.cpp | 3 ++- engine/pch.h | 3 +-- engine/rtt.cpp | 2 +- engine/shader.cpp | 1 + engine/shape.cpp | 1 + engine/texture.cpp | 1 + engine/util.cpp | 1 + 18 files changed, 34 insertions(+), 11 deletions(-) diff --git a/engine.xcodeproj/project.pbxproj b/engine.xcodeproj/project.pbxproj index 6c3b398..6b077b8 100644 --- a/engine.xcodeproj/project.pbxproj +++ b/engine.xcodeproj/project.pbxproj @@ -27,6 +27,8 @@ AD58E0761E3421F2006ACC15 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0741E3421F2006ACC15 /* YGNodeList.c */; }; AD58E0771E3421F2006ACC15 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0751E3421F2006ACC15 /* Yoga.c */; }; AD58E0791E342205006ACC15 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0781E342205006ACC15 /* tinyxml2.cpp */; }; + AD8CF7211E913F0500083FFD /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD8CF71F1E913F0500083FFD /* log.cpp */; }; + AD8CF7231E914DE400083FFD /* libcurl.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8CF7221E914DE400083FFD /* libcurl.tbd */; }; AD95AEC61E41EDEC002DD03A /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC31E41EDEC002DD03A /* font.cpp */; }; AD95AEC71E41EDEC002DD03A /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC51E41EDEC002DD03A /* pch.cpp */; }; ADB61C821E3D38450093280F /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB61C801E3D38450093280F /* util.cpp */; }; @@ -79,6 +81,9 @@ AD58E0741E3421F2006ACC15 /* YGNodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = YGNodeList.c; path = libs/yoga/yoga/YGNodeList.c; sourceTree = ""; }; AD58E0751E3421F2006ACC15 /* Yoga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Yoga.c; path = libs/yoga/yoga/Yoga.c; sourceTree = ""; }; AD58E0781E342205006ACC15 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tinyxml2.cpp; path = libs/tinyxml2/tinyxml2.cpp; sourceTree = ""; }; + AD8CF71F1E913F0500083FFD /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = log.cpp; sourceTree = ""; }; + AD8CF7201E913F0500083FFD /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; + AD8CF7221E914DE400083FFD /* libcurl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.tbd; path = usr/lib/libcurl.tbd; sourceTree = SDKROOT; }; AD95AEC31E41EDEC002DD03A /* font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = font.cpp; sourceTree = ""; }; AD95AEC41E41EDEC002DD03A /* font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = font.h; sourceTree = ""; }; AD95AEC51E41EDEC002DD03A /* pch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pch.cpp; sourceTree = ""; }; @@ -91,6 +96,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + AD8CF7231E914DE400083FFD /* libcurl.tbd in Frameworks */, AD58E0601E12DA86006ACC15 /* CoreVideo.framework in Frameworks */, AD58E05E1E10754F006ACC15 /* CoreFoundation.framework in Frameworks */, AD58E05C1E107536006ACC15 /* Cocoa.framework in Frameworks */, @@ -104,6 +110,7 @@ AD58E0461E107411006ACC15 = { isa = PBXGroup; children = ( + AD8CF7221E914DE400083FFD /* libcurl.tbd */, AD58E0731E3421CB006ACC15 /* libs */, AD58E0611E17F23D006ACC15 /* data */, AD58E05F1E12DA86006ACC15 /* CoreVideo.framework */, @@ -126,6 +133,8 @@ AD58E0511E107411006ACC15 /* engine */ = { isa = PBXGroup; children = ( + AD8CF71F1E913F0500083FFD /* log.cpp */, + AD8CF7201E913F0500083FFD /* log.h */, AD4C08CF1E89BD0F0051D85F /* asset.cpp */, AD4C08D01E89BD0F0051D85F /* asset.h */, AD4C08D11E89BD0F0051D85F /* bezier.cpp */, @@ -242,6 +251,7 @@ AD58E0681E2A7741006ACC15 /* image.cpp in Sources */, AD58E0771E3421F2006ACC15 /* Yoga.c in Sources */, AD4C08DB1E89BD0F0051D85F /* brush.cpp in Sources */, + AD8CF7211E913F0500083FFD /* log.cpp in Sources */, AD95AEC71E41EDEC002DD03A /* pch.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -292,7 +302,9 @@ libs/glm, libs/yoga, libs/tinyxml2, + /opt/local/include, ); + LIBRARY_SEARCH_PATHS = /opt/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -337,7 +349,9 @@ libs/glm, libs/yoga, libs/tinyxml2, + /opt/local/include, ); + LIBRARY_SEARCH_PATHS = /opt/local/lib; MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; diff --git a/engine/app.cpp b/engine/app.cpp index abafa0b..be4078b 100644 --- a/engine/app.cpp +++ b/engine/app.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "app.h" using namespace ui; diff --git a/engine/asset.cpp b/engine/asset.cpp index 63e726e..6004f43 100644 --- a/engine/asset.cpp +++ b/engine/asset.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "asset.h" #ifdef __ANDROID__ diff --git a/engine/bezier.cpp b/engine/bezier.cpp index 37d2979..9e1ea20 100644 --- a/engine/bezier.cpp +++ b/engine/bezier.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "bezier.h" diff --git a/engine/brush.cpp b/engine/brush.cpp index afcd1c4..df62c41 100644 --- a/engine/brush.cpp +++ b/engine/brush.cpp @@ -1,8 +1,7 @@ #include "pch.h" +#include "log.h" #include "brush.h" - - void ui::BrushMesh::draw(const std::vector& samples, const glm::mat4& proj) { std::vector attributes; diff --git a/engine/canvas.cpp b/engine/canvas.cpp index 1862899..41c9e9f 100644 --- a/engine/canvas.cpp +++ b/engine/canvas.cpp @@ -1,8 +1,7 @@ #include "pch.h" +#include "log.h" #include "canvas.h" - - void ui::Canvas::clear() { m_fb.bindFramebuffer(); diff --git a/engine/font.cpp b/engine/font.cpp index 99d083d..b632e2a 100644 --- a/engine/font.cpp +++ b/engine/font.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "font.h" #include "shader.h" #include "asset.h" diff --git a/engine/image.cpp b/engine/image.cpp index f63aa0f..bd89d1a 100644 --- a/engine/image.cpp +++ b/engine/image.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "image.h" #include "asset.h" diff --git a/engine/layout.cpp b/engine/layout.cpp index e0a16b0..6255da8 100644 --- a/engine/layout.cpp +++ b/engine/layout.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "layout.h" #include "util.h" #include "asset.h" diff --git a/engine/layout.h b/engine/layout.h index df90fd4..8757fae 100644 --- a/engine/layout.h +++ b/engine/layout.h @@ -1544,8 +1544,9 @@ public: if (dp != NULL) { - while (ep = readdir (dp)) - names.push_back(ep->d_name); + while ((ep = readdir(dp))) + if (ep->d_type != DT_DIR) + names.push_back(ep->d_name); closedir(dp); } else diff --git a/engine/log.cpp b/engine/log.cpp index 286dd31..8f0cd83 100644 --- a/engine/log.cpp +++ b/engine/log.cpp @@ -67,7 +67,7 @@ void LogRemote::log(const wchar_t* format, ...) static wchar_t buffer[4096]; va_list arglist; va_start(arglist, format); - int n = _vsnwprintf(buffer, sizeof(buffer)/sizeof(wchar_t), format, arglist); + int n = vswprintf(buffer, sizeof(buffer)/sizeof(wchar_t), format, arglist); va_end(arglist); std::wstring string_to_convert(buffer, n); diff --git a/engine/main.cpp b/engine/main.cpp index 065c702..11eaf91 100644 --- a/engine/main.cpp +++ b/engine/main.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "shader.h" #include "shape.h" #include "texture.h" @@ -264,7 +265,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime { App::I.initLog(); App::I.create(); - NSRect r = NSMakeRect(0, 0, app.width, app.height); + NSRect r = NSMakeRect(0, 0, App::I.width, App::I.height); view = [[View alloc] initWithFrame:r]; diff --git a/engine/pch.h b/engine/pch.h index f5cf364..a63751f 100644 --- a/engine/pch.h +++ b/engine/pch.h @@ -5,6 +5,7 @@ #ifdef __APPLE__ #include + #include #include #include #include @@ -73,5 +74,3 @@ #include #include #include - -#include "log.h" diff --git a/engine/rtt.cpp b/engine/rtt.cpp index b191559..88ddc86 100644 --- a/engine/rtt.cpp +++ b/engine/rtt.cpp @@ -1,7 +1,7 @@ #include "pch.h" +#include "log.h" #include "rtt.h" - RTT::RTT() { fboID = 0; diff --git a/engine/shader.cpp b/engine/shader.cpp index 4a4e2d5..d6f7d27 100644 --- a/engine/shader.cpp +++ b/engine/shader.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "shader.h" using namespace ui; diff --git a/engine/shape.cpp b/engine/shape.cpp index e92d3ed..ccbde24 100644 --- a/engine/shape.cpp +++ b/engine/shape.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "shape.h" using namespace ui; diff --git a/engine/texture.cpp b/engine/texture.cpp index ab518aa..36ccf3b 100644 --- a/engine/texture.cpp +++ b/engine/texture.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "texture.h" #include "util.h" diff --git a/engine/util.cpp b/engine/util.cpp index 8e77485..f586e0a 100644 --- a/engine/util.cpp +++ b/engine/util.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "log.h" #include "util.h" bool point_in_rect(const glm::vec2& p, const glm::vec4& r)