From 85b8f895b9437568bc3e9efdba149e70ac34b324 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Thu, 17 Apr 2014 00:27:47 +0400 Subject: [PATCH] fix DUB build of library under windows --- dub.json | 66 +++++++++++++++++++++++++++++++--- src/dlangui/graphics/ftfonts.d | 2 +- src/dlangui/graphics/images.d | 12 ++++--- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/dub.json b/dub.json index d8797e9d..2352b98e 100644 --- a/dub.json +++ b/dub.json @@ -1,14 +1,72 @@ { "name": "dlangui", - "description": "D language GUI library", + "description": "D language cross platform GUI library, inspired by Android UI API. Supports OpenGL based hardware acceleration, i18n, styles and themes.", "homepage": "https://github.com/buggins/dlangui", "license": "Boost", - "authors": [ - "Vadim Lopatin" - ], + "authors": ["Vadim Lopatin"], "targetName": "dlangui", "targetPath": "lib", + "targetType": "staticLibrary", + + "sourceFiles-windows": [ + "3rdparty/win32/basetsd.d", + "3rdparty/win32/basetyps.d", + "3rdparty/win32/cderr.d", + "3rdparty/win32/cguid.d", + "3rdparty/win32/commdlg.d", + "3rdparty/win32/commctrl.d", + "3rdparty/win32/core.d", + "3rdparty/win32/dde.d", + "3rdparty/win32/ddeml.d", + "3rdparty/win32/dlgs.d", + "3rdparty/win32/imm.d", + "3rdparty/win32/lzexpand.d", + "3rdparty/win32/mmsystem.d", + "3rdparty/win32/nb30.d", + "3rdparty/win32/oaidl.d", + "3rdparty/win32/objbase.d", + "3rdparty/win32/objfwd.d", + "3rdparty/win32/objidl.d", + "3rdparty/win32/ole.d", + "3rdparty/win32/ole2.d", + "3rdparty/win32/oleauto.d", + "3rdparty/win32/olectlid.d", + "3rdparty/win32/oleidl.d", + "3rdparty/win32/prsht.d", + "3rdparty/win32/rpc.d", + "3rdparty/win32/rpcdce.d", + "3rdparty/win32/rpcdcep.d", + "3rdparty/win32/rpcndr.d", + "3rdparty/win32/rpcnsi.d", + "3rdparty/win32/rpcnsip.d", + "3rdparty/win32/rpcnterr.d", + "3rdparty/win32/shellapi.d", + "3rdparty/win32/shlobj.d", + "3rdparty/win32/shlguid.d", + "3rdparty/win32/unknwn.d", + "3rdparty/win32/uuid.d", + "3rdparty/win32/w32api.d", + "3rdparty/win32/winbase.d", + "3rdparty/win32/wincon.d", + "3rdparty/win32/windef.d", + "3rdparty/win32/windows.d", + "3rdparty/win32/winerror.d", + "3rdparty/win32/wingdi.d", + "3rdparty/win32/winnetwk.d", + "3rdparty/win32/winnls.d", + "3rdparty/win32/winnt.d", + "3rdparty/win32/winperf.d", + "3rdparty/win32/winsock2.d", + "3rdparty/win32/winspool.d", + "3rdparty/win32/winsvc.d", + "3rdparty/win32/winuser.d", + "3rdparty/win32/winver.d", + "3rdparty/win32/ws2tcpip.d", + "3rdparty/win32/wtypes.d", + ], + + "versions-windows": ["USE_OPENGL", "Unicode"], "dependencies": { "derelict-gl3": "~master", diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d index 38fe0b22..41f7bd8f 100644 --- a/src/dlangui/graphics/ftfonts.d +++ b/src/dlangui/graphics/ftfonts.d @@ -28,7 +28,7 @@ private struct FontDef { const bool opEquals(ref const FontDef v) { return _family == v._family && _italic == v._italic && _weight == v._weight && _face.equal(v._face); } - const hash_t toHash() { + const hash_t toHash() const nothrow @safe { hash_t res = 123; res = res * 31 + cast(hash_t)_italic; res = res * 31 + cast(hash_t)_weight; diff --git a/src/dlangui/graphics/images.d b/src/dlangui/graphics/images.d index 0ab182d6..a658b0fe 100644 --- a/src/dlangui/graphics/images.d +++ b/src/dlangui/graphics/images.d @@ -22,11 +22,16 @@ Authors: $(WEB coolreader.org, Vadim Lopatin) */ module dlangui.graphics.images; +immutable bool USE_LIBPNG = false; +immutable bool USE_FREEIMAGE = true; + import dlangui.core.logger; import dlangui.core.types; import dlangui.graphics.drawbuf; import std.stream; -import libpng.png; +static if (USE_LIBPNG) { + import libpng.png; +} /// load and decode image from file to ColorDrawBuf, returns null if loading or decoding is failed ColorDrawBuf loadImage(string filename) { @@ -57,9 +62,6 @@ class ImageDecodingException : Exception { } } -immutable bool USE_LIBPNG = false; -immutable bool USE_FREEIMAGE = true; - shared static this() { //import derelict.freeimage.freeimage; //DerelictFI.load(); @@ -126,6 +128,8 @@ static if (USE_FREEIMAGE) { switch (pixelSize) { case 4: a = src[3] ^ 255; + // fall through + goto case; case 3: r = src[2]; g = src[1];