1--*****************************************************************************
2--*	Author:		RJP Computing <rjpcomputing@gmail.com>
3--*	Date:		12/15/2006
4--*	Version:	1.00-beta
5--* Copyright (C) 2006 RJP Computing
6--*
7--* This program is free software; you can redistribute it and/or
8--* modify it under the terms of the GNU General Public License
9--* as published by the Free Software Foundation; either version 2
10--* of the License, or (at your option) any later version.
11--*
12--* This program is distributed in the hope that it will be useful,
13--* but WITHOUT ANY WARRANTY; without even the implied warranty of
14--* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15--* GNU General Public License for more details.
16--*
17--* You should have received a copy of the GNU General Public License
18--* along with this program; if not, write to the Free Software
19--* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20--*
21--*	NOTES:
22--*		- use the '/' slash for all paths.
23--*****************************************************************************
24
25-- wxWidgets version
26local wx_ver = "28"
27
28--******* Initial Setup ************
29--*	Most of the setting are set here.
30--**********************************
31
32-- Set the name of your package.
33package.name = "plugin-interface"
34-- Set this if you want a different name for your target than the package's name.
35local targetName = "fbPluginInterface"
36-- Set the kind of package you want to create.
37--		Options: exe | winexe | lib | dll
38package.kind = "lib"
39-- Set the files to include.
40package.files = { matchrecursive( "*.cpp", "*.h", "*.rc", "*.fbp" ) }
41-- Set the include paths.
42package.includepaths = { "../tinyxml" }
43-- Set the libraries it links to.
44package.links = { "TiCPP" }
45package.libdir = "../lib"
46-- Set the defines.
47package.defines = { "TIXML_USE_TICPP" }
48
49-- Hack the dll output to prefix 'lib' to the begining.
50package.targetprefix = "lib"
51
52--------------------------- DO NOT EDIT BELOW ----------------------------------
53
54--******* GENAERAL SETUP **********
55--*	Settings that are not dependant
56--*	on the operating system.
57--*********************************
58-- Package options
59addoption( "unicode", "Use the Unicode character set" )
60addoption( "with-wx-shared", "Link against wxWidgets as a shared library" )
61if ( not windows ) then
62	addoption( "disable-wx-debug", "Compile against a wxWidgets library without debugging" )
63end
64
65-- Common setup
66package.language = "c++"
67
68-- Set object output directory.
69if ( options["unicode"] ) then
70	package.config["Debug"].objdir = ".objsud"
71	package.config["Release"].objdir = ".objsu"
72else
73	package.config["Debug"].objdir = ".objsd"
74	package.config["Release"].objdir = ".objs"
75end
76
77-- Set debug flags
78if ( options["disable-wx-debug"] and ( not windows ) ) then
79	debug_option = "--debug=no"
80	debug_macro = { "NDEBUG", "__WXFB_DEBUG__" }
81else
82	debug_option = "--debug=yes"
83	debug_macro = { "DEBUG", "_DEBUG", "__WXDEBUG__", "__WXFB_DEBUG__"}
84end
85
86-- Set the default targetName if none is specified.
87if ( string.len( targetName ) == 0 ) then
88	targetName = package.name
89end
90
91-- Set the targets.
92package.config["Release"].target = targetName
93package.config["Debug"].target = targetName.."d"
94
95-- Set the build options.
96package.buildflags = { "extra-warnings" }
97package.config["Release"].buildflags = { "no-symbols", "optimize-speed" }
98if ( options["unicode"] ) then
99	table.insert( package.buildflags, "unicode" )
100end
101if ( string.find( target or "", ".*-gcc" ) or target == "gnu" ) then
102	table.insert( package.config["Debug"].buildoptions, "-O0" )
103	table.insert( package.config["Release"].buildoptions, "-fno-strict-aliasing" )
104end
105
106-- Set the defines.
107if ( options["with-wx-shared"] ) then
108	table.insert( package.defines, "WXUSINGDLL" )
109end
110if ( options["unicode"] ) then
111	table.insert( package.defines, { "UNICODE", "_UNICODE" } )
112end
113table.insert( package.defines, "__WX__" )
114table.insert( package.config["Debug"].defines, debug_macro )
115table.insert( package.config["Release"].defines, "NDEBUG" )
116
117if ( windows ) then
118--******* WINDOWS SETUP ***********
119--*	Settings that are Windows specific.
120--*********************************
121	-- Set wxWidgets include paths
122	if ( target == "cb-gcc" ) then
123		table.insert( package.includepaths, "$(#WX.include)" )
124	else
125		table.insert( package.includepaths, "$(WXWIN)/include" )
126	end
127
128	-- Set the correct 'setup.h' include path.
129	if ( options["with-wx-shared"] ) then
130		if ( options["unicode"] ) then
131			if ( target == "cb-gcc" ) then
132				table.insert( package.config["Debug"].includepaths, "$(#WX.lib)/gcc_dll/mswud" )
133				table.insert( package.config["Release"].includepaths, "$(#WX.lib)/gcc_dll/mswu" )
134			elseif ( target == "gnu" or target == "cl-gcc" ) then
135				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/gcc_dll/mswud" )
136				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/gcc_dll/mswu" )
137			else
138				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/vc_dll/mswud" )
139				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/vc_dll/mswu" )
140			end
141		else
142			if ( target == "cb-gcc" ) then
143				table.insert( package.config["Debug"].includepaths, "$(#WX.lib)/gcc_dll/mswd" )
144				table.insert( package.config["Release"].includepaths, "$(#WX.lib)/gcc_dll/msw" )
145			elseif ( target == "gnu" or target == "cl-gcc" ) then
146				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/gcc_dll/mswd" )
147				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/gcc_dll/msw" )
148			else
149				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/vc_dll/mswd" )
150				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/vc_dll/msw" )
151			end
152		end
153	else
154		if ( options["unicode"] ) then
155			if ( target == "cb-gcc" ) then
156				table.insert( package.config["Debug"].includepaths, "$(#WX.lib)/gcc_lib/mswud" )
157				table.insert( package.config["Release"].includepaths, "$(#WX.lib)/gcc_lib/mswu" )
158			elseif ( target == "gnu" or target == "cl-gcc" ) then
159				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/gcc_lib/mswud" )
160				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/gcc_lib/mswu" )
161			else
162				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/vc_lib/mswud" )
163				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/vc_lib/mswu" )
164			end
165		else
166			if ( target == "cb-gcc" ) then
167				table.insert( package.config["Debug"].includepaths, "$(#WX.lib)/gcc_lib/mswd" )
168				table.insert( package.config["Release"].includepaths, "$(#WX.lib)/gcc_lib/msw" )
169			elseif ( target == "gnu" or target == "cl-gcc" ) then
170				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/gcc_lib/mswd" )
171				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/gcc_lib/msw" )
172			else
173				table.insert( package.config["Debug"].includepaths, "$(WXWIN)/lib/vc_lib/mswd" )
174				table.insert( package.config["Release"].includepaths, "$(WXWIN)/lib/vc_lib/msw" )
175			end
176		end
177	end
178
179	-- Set the linker options.
180	if ( options["with-wx-shared"] ) then
181		if ( target == "cb-gcc" ) then
182			table.insert( package.libpaths, "$(#WX.lib)/gcc_dll" )
183		elseif ( target == "gnu" or target == "cl-gcc" ) then
184			table.insert( package.libpaths, "$(WXWIN)/lib/gcc_dll" )
185		else
186			table.insert( package.libpaths, "$(WXWIN)/lib/vc_dll" )
187		end
188	else
189		if ( target == "cb-gcc" ) then
190			table.insert( package.libpaths, "$(#WX.lib)/gcc_lib" )
191		elseif ( target == "gnu" or target == "cl-gcc" ) then
192			table.insert( package.libpaths, "$(WXWIN)/lib/gcc_lib" )
193		else
194			table.insert( package.libpaths, "$(WXWIN)/lib/vc_lib" )
195		end
196	end
197
198	-- Set wxWidgets libraries to link.
199	if ( options["unicode"] ) then
200		table.insert( package.config["Release"].links, "wxmsw"..wx_ver.."u" )
201		table.insert( package.config["Debug"].links, "wxmsw"..wx_ver.."ud" )
202	else
203		table.insert( package.config["Release"].links, "wxmsw"..wx_ver )
204		table.insert( package.config["Debug"].links, "wxmsw"..wx_ver.."d" )
205	end
206
207	-- Set the Windows defines.
208	table.insert( package.defines, { "__WXMSW__", "WIN32", "_WINDOWS" } )
209else
210--******* LINUX SETUP *************
211--*	Settings that are Linux specific.
212--*********************************
213	-- Ignore resource files in Linux.
214	table.insert( package.excludes, matchrecursive( "*.rc" ) )
215
216	table.insert( package.buildoptions, "-fPIC" )
217
218	-- Set wxWidgets build options.
219	table.insert( package.config["Debug"].buildoptions, "`/usr/local/bin/wxgtk3u-3.0-config "..debug_option.." --cflags`" )
220	table.insert( package.config["Release"].buildoptions, "`/usr/local/bin/wxgtk3u-3.0-config --debug=no --cflags`" )
221
222	-- Set the wxWidgets link options.
223	table.insert( package.config["Debug"].linkoptions, "`/usr/local/bin/wxgtk3u-3.0-config "..debug_option.." --libs`" )
224	table.insert( package.config["Release"].linkoptions, "`/usr/local/bin/wxgtk3u-3.0-config --libs`" )
225end
226