Changeset 2236
- Timestamp:
- Nov 20, 2008, 8:51:44 PM (16 years ago)
- Location:
- code/branches/buildsystem
- Files:
-
- 3 deleted
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem/cmake/UseTolua.cmake
r2233 r2236 16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 17 17 18 SET(_tolua_executable_name tolua _orxonox)18 SET(_tolua_executable_name toluaexe_orxonox) 19 19 GET_TARGET_PROPERTY(TOLUA_EXECUTABLE "${_tolua_executable_name}" LOCATION) 20 20 … … 33 33 SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg") 34 34 SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/tolua_bind.cc") 35 SET(_tolua_hfile "${CMAKE_CURRENT_BINARY_DIR}/tolua_bind.h")35 SET(_tolua_hfile "${CMAKE_CURRENT_BINARY_DIR}/tolua_bind.h") 36 36 SET(${_tolua_srcfiles_varname} ${${_tolua_srcfiles_varname}} "${_tolua_cxxfile}") 37 37 … … 44 44 ADD_CUSTOM_COMMAND( 45 45 OUTPUT "${_tolua_cxxfile}" "${_tolua_hfile}" 46 COMMAND "${TOLUA_EXECUTABLE}" -n "${_tolua_package}" -w ${CMAKE_CURRENT_SOURCE_DIR} -o "${_tolua_cxxfile}" -H "${_tolua_hfile}" "${_tolua_pkgfile}" 47 DEPENDS "${_tolua_executable_name}" ${_tolua_inputfiles} 48 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" 46 COMMAND "${TOLUA_EXECUTABLE}" -n "${_tolua_package}" 47 -w "${CMAKE_CURRENT_SOURCE_DIR}" 48 -o "${_tolua_cxxfile}" 49 -H "${_tolua_hfile}" 50 -s "${TOLUA_PARSER_SOURCE}" 51 "${_tolua_pkgfile}" 52 DEPENDS "${_tolua_executable_name}" ${_tolua_inputfiles} ${TOLUA_PARSER_DEPENDENCIES} 53 WORKING_DIRECTORY "${LIBRARY_OUTPUT_PATH}" 49 54 ) 50 55 ENDMACRO(TOLUA) -
code/branches/buildsystem/src/tolua/CMakeLists.txt
r2233 r2236 1 # TODO: only build the object files once 2 3 SET (TOLUALIB_SRC_FILES 1 SET(TOLUALIB_SRC_FILES 4 2 tolua_event.c 5 3 tolua_is.c … … 9 7 ) 10 8 11 ADD_LIBRARY (tolualib_orxonox SHARED ${TOLUALIB_SRC_FILES})12 TARGET_LINK_LIBRARIES 9 ADD_LIBRARY (tolualib_orxonox SHARED ${TOLUALIB_SRC_FILES}) 10 TARGET_LINK_LIBRARIES(tolualib_orxonox ${LUA_LIBRARIES}) 13 11 14 SET (TOLUAGEN_SRC_FILES 12 13 SET(TOLUAGEN_SRC_FILES 15 14 tolua.c 16 toluabind.c17 15 ) 18 16 19 ADD_EXECUTABLE (toluagen_orxonox ${TOLUAGEN_SRC_FILES} ${TOLUALIB_SRC_FILES})20 TARGET_LINK_LIBRARIES (toluagen_orxonox ${LUA_LIBRARIES})17 ADD_EXECUTABLE (toluaexe_orxonox ${TOLUAGEN_SRC_FILES}) 18 TARGET_LINK_LIBRARIES(toluaexe_orxonox tolualib_orxonox ${LUA_LIBRARIES}) 21 19 22 SET (TOLUA_PACKAGE "${CMAKE_CURRENT_SOURCE_DIR}/tolua-5.1.pkg") 23 GET_TARGET_PROPERTY(TOLUAGEN_EXE toluagen_orxonox LOCATION) 24 ADD_CUSTOM_COMMAND( 25 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/toluabind_orxonox.c 26 COMMAND ${TOLUAGEN_EXE} -n tolua -w ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/toluabind_orxonox.c -H ${CMAKE_CURRENT_BINARY_DIR}/toluabind_orxonox.h ${TOLUA_PACKAGE} 27 DEPENDS 28 toluagen_orxonox 29 tolua-5.1.pkg 30 lua/compat-5.1.lua 31 lua/compat.lua 32 lua/basic.lua 33 lua/feature.lua 34 lua/verbatim.lua 35 lua/code.lua 36 lua/typedef.lua 37 lua/container.lua 38 lua/package.lua 39 lua/module.lua 40 lua/namespace.lua 41 lua/define.lua 42 lua/enumerate.lua 43 lua/declaration.lua 44 lua/variable.lua 45 lua/array.lua 46 lua/function.lua 47 lua/operator.lua 48 lua/class.lua 49 lua/clean.lua 50 lua/doit.lua 51 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 20 SET(TOLUA_PARSER_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/all.lua" PARENT_SCOPE) 21 SET(TOLUA_PARSER_DEPENDENCIES 22 ${CMAKE_CURRENT_SOURCE_DIR}/all.lua 23 ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat-5.1.lua 24 ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat.lua 25 ${CMAKE_CURRENT_SOURCE_DIR}/lua/basic.lua 26 ${CMAKE_CURRENT_SOURCE_DIR}/lua/feature.lua 27 ${CMAKE_CURRENT_SOURCE_DIR}/lua/verbatim.lua 28 ${CMAKE_CURRENT_SOURCE_DIR}/lua/code.lua 29 ${CMAKE_CURRENT_SOURCE_DIR}/lua/typedef.lua 30 ${CMAKE_CURRENT_SOURCE_DIR}/lua/container.lua 31 ${CMAKE_CURRENT_SOURCE_DIR}/lua/package.lua 32 ${CMAKE_CURRENT_SOURCE_DIR}/lua/module.lua 33 ${CMAKE_CURRENT_SOURCE_DIR}/lua/namespace.lua 34 ${CMAKE_CURRENT_SOURCE_DIR}/lua/define.lua 35 ${CMAKE_CURRENT_SOURCE_DIR}/lua/enumerate.lua 36 ${CMAKE_CURRENT_SOURCE_DIR}/lua/declaration.lua 37 ${CMAKE_CURRENT_SOURCE_DIR}/lua/variable.lua 38 ${CMAKE_CURRENT_SOURCE_DIR}/lua/array.lua 39 ${CMAKE_CURRENT_SOURCE_DIR}/lua/function.lua 40 ${CMAKE_CURRENT_SOURCE_DIR}/lua/operator.lua 41 ${CMAKE_CURRENT_SOURCE_DIR}/lua/class.lua 42 ${CMAKE_CURRENT_SOURCE_DIR}/lua/clean.lua 43 ${CMAKE_CURRENT_SOURCE_DIR}/lua/doit.lua 44 45 PARENT_SCOPE 52 46 ) 53 54 SET (TOLUAEXE_SRC_FILES55 tolua.c56 toluabind_orxonox.c57 )58 59 ADD_EXECUTABLE (tolua_orxonox ${TOLUAEXE_SRC_FILES} ${TOLUALIB_SRC_FILES})60 TARGET_LINK_LIBRARIES (tolua_orxonox ${LUA_LIBRARIES}) -
code/branches/buildsystem/src/tolua/all.lua
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/code/branches/ceguilua/src/tolua/lua/all.lua 1802-1808 /code/branches/core3/src/tolua/lua/all.lua 1572-1739 /code/branches/gcc43/src/tolua/lua/all.lua 1580 /code/branches/gui/src/tolua/lua/all.lua 1635-1723 /code/branches/input/src/tolua/lua/all.lua 1629-1636
r2235 r2236 1 dofile(path.." compat-5.1.lua")2 dofile(path.." compat.lua")3 dofile(path.." basic.lua")4 dofile(path.." feature.lua")5 dofile(path.." verbatim.lua")6 dofile(path.." code.lua")7 dofile(path.." typedef.lua")8 dofile(path.." container.lua")9 dofile(path.." package.lua")10 dofile(path.." module.lua")11 dofile(path.." namespace.lua")12 dofile(path.." define.lua")13 dofile(path.." enumerate.lua")14 dofile(path.." declaration.lua")15 dofile(path.." variable.lua")16 dofile(path.." array.lua")17 dofile(path.." function.lua")18 dofile(path.." operator.lua")19 dofile(path.." class.lua")20 dofile(path.." clean.lua")21 --dofile(path.." custom.lua")22 dofile(path.." doit.lua")1 dofile(path.."lua/compat-5.1.lua") 2 dofile(path.."lua/compat.lua") 3 dofile(path.."lua/basic.lua") 4 dofile(path.."lua/feature.lua") 5 dofile(path.."lua/verbatim.lua") 6 dofile(path.."lua/code.lua") 7 dofile(path.."lua/typedef.lua") 8 dofile(path.."lua/container.lua") 9 dofile(path.."lua/package.lua") 10 dofile(path.."lua/module.lua") 11 dofile(path.."lua/namespace.lua") 12 dofile(path.."lua/define.lua") 13 dofile(path.."lua/enumerate.lua") 14 dofile(path.."lua/declaration.lua") 15 dofile(path.."lua/variable.lua") 16 dofile(path.."lua/array.lua") 17 dofile(path.."lua/function.lua") 18 dofile(path.."lua/operator.lua") 19 dofile(path.."lua/class.lua") 20 dofile(path.."lua/clean.lua") 21 --dofile(path.."lua/custom.lua") 22 dofile(path.."lua/doit.lua") 23 23 24 24 local err,msg = xpcall(doit, debug.traceback) -
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
code/branches/buildsystem/src/tolua/lua/doit.lua
r2229 r2236 39 39 parse_extra() 40 40 41 -- get potential working directory 42 if not flags.w then 43 flags.w = '' 44 end 45 41 46 -- do this after setting the package name 42 if flags['L'] then 43 dofile(flags['L']) 47 if flags.L then 48 if string.sub(flags.L, 1, 1) == '/' or string.sub(flags.L, 1, 1) == '\\' then 49 dofile(flags.L) 50 else 51 dofile(flags.w..'/'..flags.L) 52 end 44 53 end 45 54 46 55 -- add cppstring 47 if not flags ['S']then56 if not flags.S then 48 57 _basic['string'] = 'cppstring' 49 58 _basic['std::string'] = 'cppstring' … … 52 61 53 62 -- proccess package 54 local p = Package(flags.n,flags.f) 63 local file 64 if flags.f then 65 if string.sub(flags.f, 1, 1) == '/' or string.sub(flags.f, 1, 1) == '\\' then 66 file = flags.f 67 else 68 file = flags.w..'/'..flags.f 69 end 70 else 71 file = flags.f 72 end 73 local p = Package(flags.n, file) 55 74 56 75 if flags.p then … … 59 78 60 79 if flags.o then 61 local st,msg = writeto(flags.o) 80 local file 81 if string.sub(flags.o, 1, 1) == '/' or string.sub(flags.o, 1, 1) == '\\' then 82 file = flags.o 83 else 84 file = flags.w..'/'..flags.o 85 end 86 local st,msg = writeto(file) 62 87 if not st then 63 88 error('#'..msg) … … 84 109 if not flags.P then 85 110 if flags.H then 86 local st,msg = writeto(flags.H) 111 local file 112 if string.sub(flags.H, 1, 1) == '/' or string.sub(flags.H, 1, 1) == '\\' then 113 file = flags.H 114 else 115 file = flags.w..'/'..flags.H 116 end 117 local st,msg = writeto(file) 87 118 if not st then 88 119 error('#'..msg) -
code/branches/buildsystem/src/tolua/lua/package.lua
r2234 r2236 124 124 output('#endif\n') 125 125 output('#include "string.h"\n\n') 126 output('#include "tolua/tolua++.h"\n\n') 127 128 if not flags.h then 129 -- local temp = string.reverse(flags.H) 130 -- local start1, end1 = string.find(temp, '/') 131 -- local start2, end2 = string.find(temp, '\\') 132 -- local res 133 -- if not start1 == nil then 134 -- if not start2 == nil then 135 -- if start1 > start2 then 136 -- res = string.sub(temp, 1, start2) 137 -- else 138 -- res = string.sub(temp, 1, start1) 139 -- end 140 -- else 141 -- res = string.sub(temp, 1, start1) 142 -- end 143 -- elseif not start2 == nil then 144 -- res = string.sub(temp, 1, start2) 145 -- end 146 -- res = string.reverse(res) 147 output('#include "tolua_bind.h"') 148 output('\n') 126 output('#include "tolua++.h"\n\n') 127 128 if flags.H then 129 local header = gsub(flags.H, '^.-([%w_]*%.[%w_]*)$', '%1') 130 output('#include "'..header..'"\n') 149 131 end 150 132 … … 220 202 output('*/\n\n') 221 203 222 if not flags.hthen204 if flags.H then 223 205 output('#include "'..self.name..'Prereqs.h"\n') 224 206 output('/* Exported function */') 225 output('_'..self.name..'Export int tolua_'..self.name..'_open (lua_State* tolua_S);') 207 output('_'..self.name..'Export') 208 output('int tolua_'..self.name..'_open (lua_State* tolua_S);') 226 209 output('\n') 227 210 end -
code/branches/buildsystem/src/tolua/tolua.c
r2233 r2236 5 5 ** Aug 2003 6 6 ** $Id:$ 7 ** Extension by Orxonox (Reto Grieder) to support working directory 8 ** and direct usage of lua files. (2008) 7 9 */ 8 10 … … 34 36 " -H file : create include file.\n" 35 37 " -n name : set package name; default is input file root name.\n" 36 " -w folder : set working directory; efault is location of package file.\n" 38 " -w directory : set working directory; default is location of package file.\n" 39 " -s file : specify source lua code for the parser; all.lua is default.\n" 37 40 " -p : parse only.\n" 38 41 " -P : parse and print structure information (for debug).\n" … … 99 102 lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION"); 100 103 104 char* working_directory = ""; 105 char* lua_source = ""; 106 101 107 if (argc==1) 102 108 { … … 126 132 case 'n': setfield(L,t,"n",argv[++i]); break; 127 133 case 'H': setfield(L,t,"H",argv[++i]); break; 128 case 'w': setfield(L,t,"w",argv[++i]); break; 134 case 'w': 135 working_directory = argv[++i]; 136 setfield(L,t,"w",argv[i]); 137 break; 138 case 's': 139 lua_source = argv[++i]; 140 setfield(L,t,"s",argv[i]); 141 break; 129 142 case 'S': setfield(L,t,"S",""); break; 130 143 case '1': setfield(L,t,"1",""); break; … … 146 159 lua_pop(L,1); 147 160 } 148 /* #define TOLUA_SCRIPT_RUN */ 149 #ifndef TOLUA_SCRIPT_RUN 161 150 162 { 151 int tolua_tolua_open (lua_State* L); 152 tolua_tolua_open(L); 163 char path[BUFSIZ]; 164 char file[BUFSIZ]; 165 166 if (lua_source[0] == '/' || lua_source[0] == '\\') 167 { 168 strcpy(path, lua_source); 169 char* p = strrchr(path, '/'); 170 if (p == NULL) 171 p = strrchr(path, '\\'); 172 p = (p == NULL) ? path : p + 1; 173 strcpy(file, p); 174 *p = '\0'; 175 } 176 else 177 { 178 strcpy(path, working_directory); 179 strcpy(file, "all.lua"); 180 181 if (strlen(path) > 0) 182 { 183 char last = path[strlen(path) - 1]; 184 if (last != '\\' && last != '/') 185 strcat(path, "/"); 186 } 187 } 188 189 lua_pushstring(L, path); 190 lua_setglobal(L, "path"); 191 strcat(path, file); 192 lua_dofile(L, path); 153 193 } 154 #else155 {156 char* p;157 char path[BUFSIZ];158 strcpy(path,argv[0]);159 p = strrchr(path,'/');160 if (p==NULL) p = strrchr(path,'\\');161 p = (p==NULL) ? path : p+1;162 sprintf(p,"%s","../src/bin/lua/");163 lua_pushstring(L,path); lua_setglobal(L,"path");164 strcat(path,"all.lua");165 lua_dofile(L,path);166 }167 #endif168 194 return 0; 169 195 }
Note: See TracChangeset
for help on using the changeset viewer.