summaryrefslogtreecommitdiff
blob: 81c3d915316bb6ebc0b29d5b7eb733d384a228b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
commit 291a375000ac8d9cd5548a863ea6b49c46cfb1bb
Author: hasufell <hasufell@gentoo.org>
Date:   Thu Sep 5 12:36:53 2013 +0200

    Use system pnglite. Based on Gentoo Bugzilla
    
    From: Azamat H. Hackimov <azamat.hackimov@gmail.com>
    
    https://bugs.gentoo.org/show_bug.cgi?id=363395

diff --git a/bam.lua b/bam.lua
index 35c1d8d..7902a2c 100644
--- a/bam.lua
+++ b/bam.lua
@@ -11,6 +11,7 @@ config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-p
 config:Add(OptTestCompileC("minmacosxsdk", "int main(){return 0;}", "-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk"))
 config:Add(OptTestCompileC("macosxppc", "int main(){return 0;}", "-arch ppc"))
 config:Add(OptLibrary("zlib", "zlib.h", false))
+config:Add(OptLibrary("pnglite", "pnglite.h", false))
 config:Add(OptLibrary("wavpack", "wavpack/wavpack.h", false))
 config:Add(SDL.OptFind("sdl", true))
 config:Add(FreeType.OptFind("freetype", true))
@@ -199,26 +200,34 @@ function build(settings)
 		settings.cc.includes:Add("src/engine/external/zlib")
 	end
 
+	-- build game components
+	engine_settings = settings:Copy()
+	server_settings = engine_settings:Copy()
+	client_settings = engine_settings:Copy()
+	launcher_settings = engine_settings:Copy()
+
+	if config.pnglite.value == true then
+		client_settings.link.libs:Add("pnglite")
+		if config.pnglite.include_path then
+			client_settings.cc.includes:Add(config.pnglite.include_path)
+		end
+		pnglite = {}
+	else
+		pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
+		client_settings.cc.includes:Add("src/engine/external/pnglite")
+	end
+
 	if config.wavpack.value == true then
-		settings.link.libs:Add("wavpack")
+		client_settings.link.libs:Add("wavpack")
 		if config.wavpack.include_path then
-			settings.cc.includes:Add(config.wavpack.include_path)
+			client_settings.cc.includes:Add(config.wavpack.include_path)
 		end
 		wavpack = {}
 	else
 		wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
-		settings.cc.includes:Add("src/engine/external/") --The header is wavpack/wavpack.h so include the external folder
+		client_settings.cc.includes:Add("src/engine/external/") --The header is wavpack/wavpack.h so include the external folder
 	end
 
-	-- build the small libraries
-	pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
-
-	-- build game components
-	engine_settings = settings:Copy()
-	server_settings = engine_settings:Copy()
-	client_settings = engine_settings:Copy()
-	launcher_settings = engine_settings:Copy()
-
 	if family == "unix" then
 		if platform == "macosx" then
 			client_settings.link.frameworks:Add("OpenGL")
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index 2e8a855..97e4fd7 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -9,7 +9,7 @@
 #include "SDL_opengl.h"
 
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 #include <engine/shared/config.h>
 #include <engine/graphics.h>
diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp
index e34b725..60246d1 100644
--- a/src/engine/client/graphics_threaded.cpp
+++ b/src/engine/client/graphics_threaded.cpp
@@ -6,7 +6,7 @@
 #include <base/tl/threading.h>
 
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 #include <engine/shared/config.h>
 #include <engine/graphics.h>
diff --git a/src/tools/dilate.cpp b/src/tools/dilate.cpp
index 55094a5..42a5b83 100644
--- a/src/tools/dilate.cpp
+++ b/src/tools/dilate.cpp
@@ -2,7 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <base/system.h>
 #include <base/math.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 typedef struct
 {
diff --git a/src/tools/tileset_borderadd.cpp b/src/tools/tileset_borderadd.cpp
index 25e2fa5..88f760a 100644
--- a/src/tools/tileset_borderadd.cpp
+++ b/src/tools/tileset_borderadd.cpp
@@ -2,7 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <base/math.h>
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 typedef struct
 {
diff --git a/src/tools/tileset_borderfix.cpp b/src/tools/tileset_borderfix.cpp
index 0facb9a..ab36292 100644
--- a/src/tools/tileset_borderfix.cpp
+++ b/src/tools/tileset_borderfix.cpp
@@ -1,7 +1,7 @@
 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 typedef struct
 {
diff --git a/src/tools/tileset_borderrem.cpp b/src/tools/tileset_borderrem.cpp
index d604ecb..8673e41 100644
--- a/src/tools/tileset_borderrem.cpp
+++ b/src/tools/tileset_borderrem.cpp
@@ -2,7 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <base/math.h>
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 typedef struct
 {
diff --git a/src/tools/tileset_borderset.cpp b/src/tools/tileset_borderset.cpp
index 8b3e299..c762ee2 100644
--- a/src/tools/tileset_borderset.cpp
+++ b/src/tools/tileset_borderset.cpp
@@ -2,7 +2,7 @@
 /* If you are missing that file, acquire a complete release at teeworlds.com.                */
 #include <base/math.h>
 #include <base/system.h>
-#include <engine/external/pnglite/pnglite.h>
+#include <pnglite.h>
 
 typedef struct
 {