Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2008, 8:51:44 PM (16 years ago)
Author:
rgrieder
Message:
  • Changed working directory for tolua generator to library_output_path. That resolves windows issues with dlls.
  • Removed the need to create a second tolua application. There is only one now called toluaexe_orxonox.
  • 'w' (working directory) option of tolua extends to -L, pkg-file, -o and -H if of course -w is present
  • 's' option added to tolua: Tells which file contains the bindfile generator. In our case this is src/tolua/all.lua all.lua replaces tolua-5.1.pkg. We can still choose that file from CMake (TOLUA_PARSER_SOURCE)
  • Generator dependencies are declared in src/tolua/CMakeLists.txt and used in UseTolua.cmake (PARENT_SCOPE)
  • Fixed a bug when writing the header file inclusion in package.lua
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem/src/tolua/tolua.c

    r2233 r2236  
    55** Aug 2003
    66** $Id:$
     7** Extension by Orxonox (Reto Grieder) to support working directory
     8** and direct usage of lua files. (2008)
    79*/
    810
     
    3436         "  -H  file : create include file.\n"
    3537         "  -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"
    3740         "  -p       : parse only.\n"
    3841         "  -P       : parse and print structure information (for debug).\n"
     
    99102 lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
    100103
     104 char* working_directory = "";
     105 char* lua_source = "";
     106
    101107 if (argc==1)
    102108 {
     
    126132     case 'n': setfield(L,t,"n",argv[++i]); break;
    127133     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;
    129142     case 'S': setfield(L,t,"S",""); break;
    130143     case '1': setfield(L,t,"1",""); break;
     
    146159  lua_pop(L,1);
    147160 }
    148 /* #define TOLUA_SCRIPT_RUN */
    149 #ifndef TOLUA_SCRIPT_RUN
     161
    150162 {
    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);
    153193 }
    154 #else
    155  {
    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 #endif
    168194 return 0;
    169195}
Note: See TracChangeset for help on using the changeset viewer.