add the .pkg files so we do not need to build them. sometimes tolua is not installed.

This commit is contained in:
Enno Rehling 2014-03-08 10:28:15 +01:00
parent e9b9c9783a
commit e9bc92608c
4 changed files with 1326 additions and 3 deletions

View File

@ -10,7 +10,7 @@ ELSE(CMAKE_COMPILER_IS_GNUCC)
ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(CMAKE_COMPILER_IS_GNUCC)
find_package (Lua 5 REQUIRED) find_package (Lua 5 REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua)
find_package (SQLite3 REQUIRED) find_package (SQLite3 REQUIRED)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${CMAKE_CURRENT_SOURCE_DIR})
@ -43,12 +43,13 @@ MACRO(ADD_LUA_MODULE MODULE_NAME FILES)
) )
ENDMACRO(ADD_LUA_MODULE) ENDMACRO(ADD_LUA_MODULE)
IF(TOLUA_FOUND)
MACRO(TOLUA_BINDING PKGFILE FILES) MACRO(TOLUA_BINDING PKGFILE FILES)
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${PKGFILE}.c OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c
DEPENDS ${FILES} ${PKGFILE} DEPENDS ${FILES} ${PKGFILE}
COMMAND ${TOLUA_EXECUTABLE} COMMAND ${TOLUA_EXECUTABLE}
ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/${PKGFILE}.c ${PKGFILE} ARGS -o ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c ${PKGFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
ENDMACRO(TOLUA_BINDING) ENDMACRO(TOLUA_BINDING)
@ -56,6 +57,7 @@ ENDMACRO(TOLUA_BINDING)
TOLUA_BINDING(process.pkg bind_process.h) TOLUA_BINDING(process.pkg bind_process.h)
TOLUA_BINDING(eressea.pkg bind_eressea.h) TOLUA_BINDING(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg bind_settings.h) TOLUA_BINDING(settings.pkg bind_settings.h)
ENDIF(TOLUA_FOUND)
set(TESTS set(TESTS
laws_test.c laws_test.c

158
src/eressea.pkg.c Normal file
View File

@ -0,0 +1,158 @@
/*
** Lua binding: eressea
** Generated automatically by tolua 5.1.3 on Sat Mar 8 10:21:00 2014.
*/
#include "tolua.h"
#ifndef __cplusplus
#include <stdlib.h>
#endif
#ifdef __cplusplus
extern "C" int tolua_bnd_takeownership (lua_State* L); // from tolua_map.c
#else
int tolua_bnd_takeownership (lua_State* L); /* from tolua_map.c */
#endif
#include <string.h>
/* Exported function */
TOLUA_API int tolua_eressea_open (lua_State* tolua_S);
LUALIB_API int luaopen_eressea (lua_State* tolua_S);
#include "bind_eressea.h"
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
}
/* function: eressea_free_game */
static int tolua_eressea_eressea_free_game00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isnoobj(tolua_S,1,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
{
eressea_free_game();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'free_game'.",&tolua_err);
return 0;
#endif
}
/* function: eressea_read_game */
static int tolua_eressea_eressea_read_game00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* filename = ((const char*) tolua_tostring(tolua_S,1,0));
{
int tolua_ret = (int) eressea_read_game(filename);
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'read_game'.",&tolua_err);
return 0;
#endif
}
/* function: eressea_write_game */
static int tolua_eressea_eressea_write_game00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* filename = ((const char*) tolua_tostring(tolua_S,1,0));
{
int tolua_ret = (int) eressea_write_game(filename);
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'write_game'.",&tolua_err);
return 0;
#endif
}
/* function: eressea_read_orders */
static int tolua_eressea_eressea_read_orders00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* filename = ((const char*) tolua_tostring(tolua_S,1,0));
{
int tolua_ret = (int) eressea_read_orders(filename);
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'read_orders'.",&tolua_err);
return 0;
#endif
}
/* Open lib function */
LUALIB_API int luaopen_eressea (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,NULL,0);
tolua_beginmodule(tolua_S,NULL);
tolua_module(tolua_S,"eressea",0);
tolua_beginmodule(tolua_S,"eressea");
tolua_function(tolua_S,"free_game",tolua_eressea_eressea_free_game00);
tolua_function(tolua_S,"read_game",tolua_eressea_eressea_read_game00);
tolua_function(tolua_S,"write_game",tolua_eressea_eressea_write_game00);
tolua_function(tolua_S,"read_orders",tolua_eressea_eressea_read_orders00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_eressea_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_eressea);
lua_pushstring(tolua_S, "eressea");
lua_call(tolua_S, 1, 0);
return 1;
}

1054
src/process.pkg.c Normal file

File diff suppressed because it is too large Load Diff

109
src/settings.pkg.c Normal file
View File

@ -0,0 +1,109 @@
/*
** Lua binding: settings
** Generated automatically by tolua 5.1.3 on Sat Mar 8 10:21:00 2014.
*/
#include "tolua.h"
#ifndef __cplusplus
#include <stdlib.h>
#endif
#ifdef __cplusplus
extern "C" int tolua_bnd_takeownership (lua_State* L); // from tolua_map.c
#else
int tolua_bnd_takeownership (lua_State* L); /* from tolua_map.c */
#endif
#include <string.h>
/* Exported function */
TOLUA_API int tolua_settings_open (lua_State* tolua_S);
LUALIB_API int luaopen_settings (lua_State* tolua_S);
#include "bind_settings.h"
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
}
/* function: settings_set */
static int tolua_settings_eressea_settings_set00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* key = ((const char*) tolua_tostring(tolua_S,1,0));
const char* value = ((const char*) tolua_tostring(tolua_S,2,0));
{
settings_set(key,value);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'set'.",&tolua_err);
return 0;
#endif
}
/* function: settings_get */
static int tolua_settings_eressea_settings_get00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* key = ((const char*) tolua_tostring(tolua_S,1,0));
{
const char* tolua_ret = (const char*) settings_get(key);
tolua_pushstring(tolua_S,(const char*)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'get'.",&tolua_err);
return 0;
#endif
}
/* Open lib function */
LUALIB_API int luaopen_settings (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,NULL,0);
tolua_beginmodule(tolua_S,NULL);
tolua_module(tolua_S,"eressea",0);
tolua_beginmodule(tolua_S,"eressea");
tolua_module(tolua_S,"settings",0);
tolua_beginmodule(tolua_S,"settings");
tolua_function(tolua_S,"set",tolua_settings_eressea_settings_set00);
tolua_function(tolua_S,"get",tolua_settings_eressea_settings_get00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_settings_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_settings);
lua_pushstring(tolua_S, "settings");
lua_call(tolua_S, 1, 0);
return 1;
}