New SConscript (hopefully better)

Fixes a lot of bugs, also almost all options are no longer needed and are just auto-detected
This commit is contained in:
jacob1 2014-06-08 19:33:58 -04:00
parent 44405827b0
commit 6749c2547f
60 changed files with 604 additions and 867 deletions

1073
SConscript Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,16 @@
#run generator.py
if not GetOption('clean'):
execfile("generator.py")
AddOption('--builddir',dest="builddir",default="build",help="Directory to build to.")
SConscript('SConscript', variant_dir=GetOption('builddir'), duplicate=0)
if GetOption('clean'):
import os, shutil
try:
shutil.rmtree(".sconf_temp/")
except:
print "couldn't remove .sconf_temp"
try:
os.remove(".sconsign.dblite")
except:
print "couldn't remove .sconsign.dblite"

View File

@ -223,11 +223,5 @@ std::vector<SimTool*> GetTools()
f.write(toolContent)
f.close()
if(len(sys.argv) > 3):
if(sys.argv[1] == "elements"):
generateElements(sys.argv[4:], sys.argv[2], sys.argv[3])
elif(sys.argv[1] == "tools"):
generateTools(sys.argv[4:], sys.argv[2], sys.argv[3])
else:
generateElements(os.listdir("src/simulation/elements"), "generated/ElementClasses.cpp", "generated/ElementClasses.h")
generateTools(os.listdir("src/simulation/simtools"), "generated/ToolClasses.cpp", "generated/ToolClasses.h")
generateElements(os.listdir("src/simulation/elements"), "generated/ElementClasses.cpp", "generated/ElementClasses.h")
generateTools(os.listdir("src/simulation/simtools"), "generated/ToolClasses.cpp", "generated/ToolClasses.h")

View File

@ -26,20 +26,11 @@
#ifndef SNAPSHOT_ID
#define SNAPSHOT_ID 0
#endif
#ifndef STABLE
#ifndef BETA
#define BETA
#define SNAPSHOT
#endif
#endif
//VersionInfoEnd
//#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications
#if defined(DEBUG) || defined(RENDERER) || defined(X86_SSE2)
#define HIGH_QUALITY_RESAMPLE //High quality image resampling, slower but much higher quality than my terribad linear interpolation
#endif
#if defined(SNAPSHOT)
#define IDENT_RELTYPE "S"
@ -52,14 +43,18 @@
#if defined(WIN)
#if defined(_64BIT)
#define IDENT_PLATFORM "WIN64"
#else
#elif defined(_32BIT)
#define IDENT_PLATFORM "WIN32"
#else
#define IDENT_PLATFORM "WIN"
#endif
#elif defined(LIN)
#if defined(_64BIT)
#define IDENT_PLATFORM "LIN64"
#else
#elif defined(_32BIT)
#define IDENT_PLATFORM "LIN32"
#else
#define IDENT_PLATFORM "LIN"
#endif
#elif defined(MACOSX)
#define IDENT_PLATFORM "MACOSX"

View File

@ -3,10 +3,13 @@
#include <map>
#include <string>
#include <time.h>
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#ifdef WIN
#define _WIN32_WINNT 0x0501 //Necessary for some macros and functions, tells windows.h to include functions only available in Windows XP or later
#include "SDL_syswm.h"
#include <direct.h>
#endif
#include <iostream>
@ -49,9 +52,13 @@ extern "C" {
using namespace std;
#if defined(USE_SDL) && defined(LIN)
#if defined(WIN) || defined(LIN)
#ifdef SDL_INC
#include <SDL/SDL_syswm.h>
#else
#include <SDL_syswm.h>
#endif
#endif
#if defined(USE_SDL) && defined(LIN) && defined(SDL_VIDEO_DRIVER_X11)
SDL_SysWMinfo sdl_wminfo;
Atom XA_CLIPBOARD, XA_TARGETS, XA_UTF8_STRING;

View File

@ -5,7 +5,11 @@
Feel free to customize this file to suit your needs
*/
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>

View File

@ -1,6 +1,10 @@
#if defined(USE_SDL)
#ifdef SDL_INC
#include "SDL/SDL.h"
#else
#include "SDL.h"
#endif
#define KEY_UNKNOWN SDLK_UNKNOWN
#define KEY_UP SDLK_UP
#define KEY_NUM_UP SDLK_KP8

View File

@ -29,12 +29,7 @@
#define LUA_BITOP_VERSION "1.0.2"
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "luainc.h"
#ifdef _MSC_VER
/* MSVC is stuck in the last century and doesn't have C99's stdint.h. */

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaButton.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaCheckbox.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaComponent.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
namespace ui

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaScriptInterface.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,10 +1,7 @@
#pragma once
//http://lua-users.org/wiki/SimplerCppBinding
extern "C" {
#include "lua.h"
#include "lauxlib.h"
}
#include "luainc.h"
template <typename T> class Luna
{

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaProgressBar.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,12 +1,7 @@
#ifndef LUASCRIPTINTERFACE_H_
#define LUASCRIPTINTERFACE_H_
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "luainc.h"
#include "CommandInterface.h"
#include "simulation/Simulation.h"

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaSlider.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaScriptInterface.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "LuaComponent.h"

View File

@ -1,10 +1,4 @@
#ifdef LUACONSOLE
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include <iostream>
#include "LuaScriptInterface.h"

View File

@ -1,11 +1,5 @@
#pragma once
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "LuaLuna.h"
#include "gui/interface/Platform.h"

23
src/lua/luainc.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef LUAINC_H
#define LUAINC_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef LUA_INC
#include "lua5.1/lua.h"
#include "lua5.1/lauxlib.h"
#include "lua5.1/lualib.h"
#else
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -31,8 +31,7 @@
* RCS ID: $Id: auxiliar.h,v 1.9 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "lauxlib.h"
#include "../luainc.h"
int auxiliar_open(lua_State *L);
void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func);

View File

@ -4,9 +4,6 @@
*
* RCS ID: $Id: buffer.c,v 1.28 2007/06/11 23:44:54 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "lauxlib.h"
#include "buffer.h"
/*=========================================================================*\

View File

@ -17,7 +17,7 @@
*
* RCS ID: $Id: buffer.h,v 1.12 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "io.h"
#include "timeout.h"

View File

@ -6,9 +6,6 @@
\*=========================================================================*/
#include <stdio.h>
#include "lua.h"
#include "lauxlib.h"
#include "except.h"
/*=========================================================================*\

View File

@ -28,7 +28,7 @@
* RCS ID: $Id: except.h,v 1.2 2005/09/29 06:11:41 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
int except_open(lua_State *L);

View File

@ -7,9 +7,6 @@
#include <stdio.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "inet.h"
/*=========================================================================*\

View File

@ -16,7 +16,7 @@
*
* RCS ID: $Id: inet.h,v 1.16 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "socket.h"
#include "timeout.h"

View File

@ -15,7 +15,7 @@
* RCS ID: $Id: io.h,v 1.11 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include <stdio.h>
#include "lua.h"
#include "../luainc.h"
#include "timeout.h"

View File

@ -14,16 +14,6 @@
* RCS ID: $Id: luasocket.c,v 1.53 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
/*=========================================================================*\
* Standard include files
\*=========================================================================*/
#include "lua.h"
#include "lauxlib.h"
#if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM < 501)
#include "compat-5.1.h"
#endif
/*=========================================================================*\
* LuaSocket includes
\*=========================================================================*/

View File

@ -8,7 +8,7 @@
*
* RCS ID: $Id: luasocket.h,v 1.25 2007/06/11 23:44:54 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
/*-------------------------------------------------------------------------*\
* Current socket library version

View File

@ -6,8 +6,6 @@
\*=========================================================================*/
#include <string.h>
#include "lauxlib.h"
#include "auxiliar.h"
#include "options.h"
#include "inet.h"

View File

@ -10,7 +10,7 @@
* RCS ID: $Id: options.h,v 1.4 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "socket.h"
/* option registry */

View File

@ -6,9 +6,6 @@
\*=========================================================================*/
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "socket.h"
#include "timeout.h"
#include "select.h"

View File

@ -1,10 +1,6 @@
#ifdef LUACONSOLE
// socket.lua from luasocket compiled into a cpp file
extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
#include "../luainc.h"
void luaopen_socket(lua_State *l){
int socket_luac_sz=4061;
const char* socket_luac="-----------------------------------------------------------------------------\012-- LuaSocket helper module\012-- Author: Diego Nehab\012-- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $\012-----------------------------------------------------------------------------\012\012-----------------------------------------------------------------------------\012-- Declare module and import dependencies\012-----------------------------------------------------------------------------\012local base = _G\012local string = require(\042string\042)\012local math = require(\042math\042)\012local socket = require(\042socket.core\042)\012module(\042socket\042)\012\012-----------------------------------------------------------------------------\012-- Exported auxiliar functions\012-----------------------------------------------------------------------------\012function connect(address, port, laddress, lport)\012 local sock, err = socket.tcp()\012 if not sock then return nil, err end\012 if laddress then\012 local res, err = sock:bind(laddress, lport, -1)\012 if not res then return nil, err end\012 end\012 local res, err = sock:connect(address, port)\012 if not res then return nil, err end\012 return sock\012end\012\012function bind(host, port, backlog)\012 local sock, err = socket.tcp()\012 if not sock then return nil, err end\012 sock:setoption(\042reuseaddr\042, true)\012 local res, err = sock:bind(host, port)\012 if not res then return nil, err end\012 res, err = sock:listen(backlog)\012 if not res then return nil, err end\012 return sock\012end\012\012try = newtry()\012\012function choose(table)\012 return function(name, opt1, opt2)\012 if base.type(name) ~= \042string\042 then\012 name, opt1, opt2 = \042default\042, name, opt1\012 end\012 local f = table[name or \042nil\042]\012 if not f then base.error(\042unknown key (\042.. base.tostring(name) ..\042)\042, 3)\012 else return f(opt1, opt2) end\012 end\012end\012\012-----------------------------------------------------------------------------\012-- Socket sources and sinks, conforming to LTN12\012-----------------------------------------------------------------------------\012-- create namespaces inside LuaSocket namespace\012sourcet = {}\012sinkt = {}\012\012BLOCKSIZE = 2048\012\012sinkt[\042close-when-done\042] = function(sock)\012 return base.setmetatable({\012 getfd = function() return sock:getfd() end,\012 dirty = function() return sock:dirty() end\012 }, {\012 __call = function(self, chunk, err)\012 if not chunk then\012 sock:close()\012 return 1\012 else return sock:send(chunk) end\012 end\012 })\012end\012\012sinkt[\042keep-open\042] = function(sock)\012 return base.setmetatable({\012 getfd = function() return sock:getfd() end,\012 dirty = function() return sock:dirty() end\012 }, {\012 __call = function(self, chunk, err)\012 if chunk then return sock:send(chunk)\012 else return 1 end\012 end\012 })\012end\012\012sinkt[\042default\042] = sinkt[\042keep-open\042]\012\012sink = choose(sinkt)\012\012sourcet[\042by-length\042] = function(sock, length)\012 return base.setmetatable({\012 getfd = function() return sock:getfd() end,\012 dirty = function() return sock:dirty() end\012 }, {\012 __call = function()\012 if length <= 0 then return nil end\012 local size = math.min(socket.BLOCKSIZE, length)\012 local chunk, err = sock:receive(size)\012 if err then return nil, err end\012 length = length - string.len(chunk)\012 return chunk\012 end\012 })\012end\012\012sourcet[\042until-closed\042] = function(sock)\012 local done\012 return base.setmetatable({\012 getfd = function() return sock:getfd() end,\012 dirty = function() return sock:dirty() end\012 }, {\012 __call = function()\012 if done then return nil end\012 local chunk, err, partial = sock:receive(socket.BLOCKSIZE)\012 if not err then return chunk\012 elseif err == \042closed\042 then\012 sock:close()\012 done = 1\012 return partial\012 else return nil, err end\012 end\012 })\012end\012\012\012sourcet[\042default\042] = sourcet[\042until-closed\042]\012\012source = choose(sourcet)\012\012";

View File

@ -1,2 +1,2 @@
#include "lua.h"
#include "../luainc.h"
void luaopen_socket(lua_State *l);

View File

@ -6,9 +6,6 @@
\*=========================================================================*/
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "auxiliar.h"
#include "socket.h"
#include "inet.h"

View File

@ -16,7 +16,7 @@
*
* RCS ID: $Id: tcp.h,v 1.7 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "buffer.h"
#include "timeout.h"

View File

@ -6,9 +6,6 @@
\*=========================================================================*/
#include <stdio.h>
#include "lua.h"
#include "lauxlib.h"
#include "auxiliar.h"
#include "timeout.h"

View File

@ -6,7 +6,7 @@
*
* RCS ID: $Id: timeout.h,v 1.14 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
/* timeout control structure */
typedef struct t_timeout_ {

View File

@ -6,9 +6,6 @@
\*=========================================================================*/
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "auxiliar.h"
#include "socket.h"
#include "inet.h"

View File

@ -14,7 +14,7 @@
*
* RCS ID: $Id: udp.h,v 1.10 2005/10/07 04:40:59 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "timeout.h"
#include "socket.h"

View File

@ -7,9 +7,6 @@
\*=========================================================================*/
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "auxiliar.h"
#include "socket.h"
#include "options.h"

View File

@ -10,7 +10,7 @@
*
* RCS ID: $Id: unix.h,v 1.9 2006/03/13 07:16:39 diego Exp $
\*=========================================================================*/
#include "lua.h"
#include "../luainc.h"
#include "buffer.h"
#include "timeout.h"

View File

@ -1,133 +0,0 @@
-----------------------------------------------------------------------------
-- LuaSocket helper module
-- Author: Diego Nehab
-- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
local base = _G
local string = require("string")
local math = require("math")
local socket = require("socket.core")
module("socket")
-----------------------------------------------------------------------------
-- Exported auxiliar functions
-----------------------------------------------------------------------------
function connect(address, port, laddress, lport)
local sock, err = socket.tcp()
if not sock then return nil, err end
if laddress then
local res, err = sock:bind(laddress, lport, -1)
if not res then return nil, err end
end
local res, err = sock:connect(address, port)
if not res then return nil, err end
return sock
end
function bind(host, port, backlog)
local sock, err = socket.tcp()
if not sock then return nil, err end
sock:setoption("reuseaddr", true)
local res, err = sock:bind(host, port)
if not res then return nil, err end
res, err = sock:listen(backlog)
if not res then return nil, err end
return sock
end
try = newtry()
function choose(table)
return function(name, opt1, opt2)
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
end
local f = table[name or "nil"]
if not f then base.error("unknown key (".. base.tostring(name) ..")", 3)
else return f(opt1, opt2) end
end
end
-----------------------------------------------------------------------------
-- Socket sources and sinks, conforming to LTN12
-----------------------------------------------------------------------------
-- create namespaces inside LuaSocket namespace
sourcet = {}
sinkt = {}
BLOCKSIZE = 2048
sinkt["close-when-done"] = function(sock)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function(self, chunk, err)
if not chunk then
sock:close()
return 1
else return sock:send(chunk) end
end
})
end
sinkt["keep-open"] = function(sock)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function(self, chunk, err)
if chunk then return sock:send(chunk)
else return 1 end
end
})
end
sinkt["default"] = sinkt["keep-open"]
sink = choose(sinkt)
sourcet["by-length"] = function(sock, length)
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function()
if length <= 0 then return nil end
local size = math.min(socket.BLOCKSIZE, length)
local chunk, err = sock:receive(size)
if err then return nil, err end
length = length - string.len(chunk)
return chunk
end
})
end
sourcet["until-closed"] = function(sock)
local done
return base.setmetatable({
getfd = function() return sock:getfd() end,
dirty = function() return sock:dirty() end
}, {
__call = function()
if done then return nil end
local chunk, err, partial = sock:receive(socket.BLOCKSIZE)
if not err then return chunk
elseif err == "closed" then
sock:close()
done = 1
return partial
else return nil, err end
end
})
end
sourcet["default"] = sourcet["until-closed"]
source = choose(sourcet)