Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknown <rglarix@bitbucket.org>2011-03-26 15:01:18 +0300
committerUnknown <rglarix@bitbucket.org>2011-03-26 15:01:18 +0300
commit18fa8db5da599a4a9f8f3bd331ffa5ad02aa6cd7 (patch)
tree09e0ab45011585abc4876742d4e8a43cb647a462
parentfec95a8ace000b2d805bd20c24d28f24b705256b (diff)
enable optional scripts option even for release builds
-rwxr-xr-xsrc/host/premake.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/host/premake.c b/src/host/premake.c
index ac27566..9498bb2 100755
--- a/src/host/premake.c
+++ b/src/host/premake.c
@@ -20,6 +20,7 @@
static int process_arguments(lua_State* L, int argc, const char** argv);
static int process_option(lua_State* L, const char* arg);
+static int load_file_scripts(lua_State* L);
static int load_builtin_scripts(lua_State* L);
int premake_locate(lua_State* L, const char* argv0);
@@ -99,8 +100,22 @@ int premake_execute(lua_State* L, int argc, const char** argv)
int z = process_arguments(L, argc, argv);
/* Run the built-in Premake scripts */
- if (z == OKAY) z = load_builtin_scripts(L);
-
+ if (z == OKAY)
+ {
+#if !defined(NDEBUG)
+ z = load_file_scripts(L);
+#else
+ if (scripts_path)
+ {
+ z = load_file_scripts(L);
+ }
+ else
+ {
+ z = load_builtin_scripts(L);
+ }
+#endif
+ }
+
return z;
}
@@ -200,7 +215,7 @@ int premake_locate(lua_State* L, const char* argv0)
* but I need the value of the /scripts option to find them.
* \returns OKAY if successful.
*/
-int process_arguments(lua_State* L, int argc, const char** argv)
+static int process_arguments(lua_State* L, int argc, const char** argv)
{
int i;
@@ -247,7 +262,7 @@ int process_arguments(lua_State* L, int argc, const char** argv)
* Parse an individual command-line option.
* \returns OKAY if successful.
*/
-int process_option(lua_State* L, const char* arg)
+static int process_option(lua_State* L, const char* arg)
{
char key[512];
const char* value;
@@ -276,6 +291,7 @@ int process_option(lua_State* L, const char* arg)
if (strcmp(key, "scripts") == 0 && strlen(value) > 0)
{
scripts_path = value;
+ printf("Scripts path: %s\n", value);
}
return OKAY;
@@ -283,13 +299,12 @@ int process_option(lua_State* L, const char* arg)
-#if !defined(NDEBUG)
/**
* When running in debug mode, the scripts are loaded from the disk. The path to
* the scripts must be provided via either the /scripts command line option or
* the PREMAKE_PATH environment variable.
*/
-int load_builtin_scripts(lua_State* L)
+static int load_file_scripts(lua_State* L)
{
const char* filename;
@@ -335,16 +350,14 @@ int load_builtin_scripts(lua_State* L)
return (int)lua_tonumber(L, -1);
}
}
-#endif
-#if defined(NDEBUG)
/**
* When running in release mode, the scripts are loaded from a static data
* buffer, where they were stored by a preprocess. To update these embedded
* scripts, run `premake4 embed` then rebuild.
*/
-int load_builtin_scripts(lua_State* L)
+static int load_builtin_scripts(lua_State* L)
{
int i;
for (i = 0; builtin_scripts[i]; ++i)
@@ -368,4 +381,4 @@ int load_builtin_scripts(lua_State* L)
return (int)lua_tonumber(L, -1);
}
}
-#endif
+