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:
authorJason Perkins <starkos@industriousone.com>2014-09-21 02:12:29 +0400
committerJason Perkins <starkos@industriousone.com>2014-09-21 02:12:29 +0400
commit6b362413fd87db11e42e02a4e70c209376d28b25 (patch)
tree6300de5181d4f3d63dc35b36c1fb1b6c981a96ad
parentbecff0191038324799009f8e38a32f711df87b1d (diff)
parent18fa8db5da599a4a9f8f3bd331ffa5ad02aa6cd7 (diff)
Merged in rglarix/premake-stable-wrk/scripts-option-rel (pull request #46)
reissue #45 - 1 - 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 f529c41..9e30d50 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);
@@ -104,8 +105,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;
}
@@ -205,7 +220,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;
@@ -252,7 +267,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;
@@ -281,6 +296,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;
@@ -288,13 +304,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;
@@ -340,16 +355,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)
@@ -373,4 +386,4 @@ int load_builtin_scripts(lua_State* L)
return (int)lua_tonumber(L, -1);
}
}
-#endif
+