diff options
author | Oliver Schneider <oliver@assarbad.net> | 2016-05-20 01:30:41 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2016-05-20 01:30:41 +0300 |
commit | e6b972d4069fe63d66e59a94a789df1924e9215f (patch) | |
tree | 7bc25267746761bab08af8920431cb7c559f2d48 | |
parent | a7fb3668eb4c96e322f573f12699d7e2e37cd0a1 (diff) |
Adjustments to premake.c to allow the debug version to run by default without --script, if the scripts are inside the src/ subfolder
Adjustments to both premake.c and premake4.rc in order to allow overriding the version number
Fix to path_translate which could end up modifying the keys of the table it iterated
--HG--
branch : WDS-build
-rw-r--r-- | Premake4.vs8.vcproj | 477 | ||||
-rw-r--r-- | premake4.lua | 15 | ||||
-rw-r--r-- | src/host/path_translate.c | 10 | ||||
-rwxr-xr-x | src/host/premake.c | 40 | ||||
-rw-r--r-- | src/host/premake4.rc | 20 |
5 files changed, 64 insertions, 498 deletions
diff --git a/Premake4.vs8.vcproj b/Premake4.vs8.vcproj index 4e13f0a..5c048fa 100644 --- a/Premake4.vs8.vcproj +++ b/Premake4.vs8.vcproj @@ -213,7 +213,7 @@ Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
@@ -229,7 +229,7 @@ />
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP"
+ PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
/>
<Tool
@@ -299,74 +299,6 @@ >
</File>
<Filter
- Name="samples"
- Filter=""
- >
- <Filter
- Name="project"
- Filter=""
- >
- <Filter
- Name="CppConsoleApp"
- Filter=""
- >
- <File
- RelativePath="samples\project\CppConsoleApp\premake4.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="CppSharedLib"
- Filter=""
- >
- <File
- RelativePath="samples\project\CppSharedLib\premake4.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="CppStaticLib"
- Filter=""
- >
- <File
- RelativePath="samples\project\CppStaticLib\premake4.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="CppWindowedApp"
- Filter=""
- >
- <File
- RelativePath="samples\project\CppWindowedApp\premake4.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="CsConsoleApp"
- Filter=""
- >
- <File
- RelativePath="samples\project\CsConsoleApp\premake4.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="CsSharedLib"
- Filter=""
- >
- <File
- RelativePath="samples\project\CsSharedLib\premake4.lua"
- >
- </File>
- </Filter>
- <File
- RelativePath="samples\project\premake4.lua"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
Name="scripts"
Filter=""
>
@@ -998,411 +930,6 @@ </File>
</Filter>
</Filter>
- <Filter
- Name="tests"
- Filter=""
- >
- <Filter
- Name="actions"
- Filter=""
- >
- <Filter
- Name="codeblocks"
- Filter=""
- >
- <File
- RelativePath="tests\actions\codeblocks\codeblocks_files.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\codeblocks\environment_variables.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\codeblocks\test_filters.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="codelite"
- Filter=""
- >
- <File
- RelativePath="tests\actions\codelite\codelite_files.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="make"
- Filter=""
- >
- <File
- RelativePath="tests\actions\make\test_make_escaping.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\make\test_make_linking.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\make\test_make_pch.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\make\test_makesettings.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\make\test_wiidev.lua"
- >
- </File>
- </Filter>
- <File
- RelativePath="tests\actions\test_clean.lua"
- >
- </File>
- <Filter
- Name="vstudio"
- Filter=""
- >
- <Filter
- Name="cs2002"
- Filter=""
- >
- <File
- RelativePath="tests\actions\vstudio\cs2002\test_files.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="cs2005"
- Filter=""
- >
- <File
- RelativePath="tests\actions\vstudio\cs2005\buildevents.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\cs2005\projectelement.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\cs2005\projectsettings.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\cs2005\propertygroup.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\cs2005\test_files.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="sln2005"
- Filter=""
- >
- <File
- RelativePath="tests\actions\vstudio\sln2005\dependencies.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\sln2005\header.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\sln2005\layout.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\sln2005\platforms.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\sln2005\projectplatforms.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\sln2005\projects.lua"
- >
- </File>
- </Filter>
- <File
- RelativePath="tests\actions\vstudio\test_vs200x_vcproj.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\test_vs200x_vcproj_linker.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\test_vs2010_flags.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\test_vs2010_project_kinds.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\test_vs2010_vcxproj.lua"
- >
- </File>
- <Filter
- Name="vc200x"
- Filter=""
- >
- <File
- RelativePath="tests\actions\vstudio\vc200x\debugdir.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc200x\header.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc200x\test_files.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc200x\test_filters.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc200x\test_mfc.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="vc2010"
- Filter=""
- >
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_config_props.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_debugdir.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_files.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_filters.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_header.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_link_settings.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_links.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_mfc.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_output_props.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_pch.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\vstudio\vc2010\test_project_refs.lua"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="xcode"
- Filter=""
- >
- <File
- RelativePath="tests\actions\xcode\test_file_references.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\xcode\test_xcode4_project.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\xcode\test_xcode4_workspace.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\xcode\test_xcode_common.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\xcode\test_xcode_dependencies.lua"
- >
- </File>
- <File
- RelativePath="tests\actions\xcode\test_xcode_project.lua"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="baking"
- Filter=""
- >
- <File
- RelativePath="tests\baking\test_merging.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="base"
- Filter=""
- >
- <File
- RelativePath="tests\base\test_action.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_api.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_baking.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_config.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_config_bug.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_location.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_os.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_path.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_premake_command.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_table.lua"
- >
- </File>
- <File
- RelativePath="tests\base\test_tree.lua"
- >
- </File>
- </Filter>
- <Filter
- Name="folder"
- Filter=""
- >
- <File
- RelativePath="tests\folder\ok.lua"
- >
- </File>
- </Filter>
- <File
- RelativePath="tests\pepperfish_profiler.lua"
- >
- </File>
- <File
- RelativePath="tests\premake4.lua"
- >
- </File>
- <Filter
- Name="project"
- Filter=""
- >
- <File
- RelativePath="tests\project\test_eachfile.lua"
- >
- </File>
- <File
- RelativePath="tests\project\test_vpaths.lua"
- >
- </File>
- </Filter>
- <File
- RelativePath="tests\test_dofile.lua"
- >
- </File>
- <File
- RelativePath="tests\test_gmake_cpp.lua"
- >
- </File>
- <File
- RelativePath="tests\test_gmake_cs.lua"
- >
- </File>
- <File
- RelativePath="tests\test_keywords.lua"
- >
- </File>
- <File
- RelativePath="tests\test_platforms.lua"
- >
- </File>
- <File
- RelativePath="tests\test_premake.lua"
- >
- </File>
- <File
- RelativePath="tests\test_project.lua"
- >
- </File>
- <File
- RelativePath="tests\test_stress.lua"
- >
- </File>
- <File
- RelativePath="tests\test_string.lua"
- >
- </File>
- <File
- RelativePath="tests\test_targets.lua"
- >
- </File>
- <File
- RelativePath="tests\test_vs2002_sln.lua"
- >
- </File>
- <File
- RelativePath="tests\test_vs2003_sln.lua"
- >
- </File>
- <File
- RelativePath="tests\testfx.lua"
- >
- </File>
- <Filter
- Name="tools"
- Filter=""
- >
- <File
- RelativePath="tests\tools\test_gcc.lua"
- >
- </File>
- </Filter>
- </Filter>
</Files>
<Globals>
</Globals>
diff --git a/premake4.lua b/premake4.lua index f4887e7..1beadd0 100644 --- a/premake4.lua +++ b/premake4.lua @@ -41,7 +41,7 @@ do -- Name the project files after their VS version local orig_getbasename = premake.project.getbasename premake.project.getbasename = function(prjname, pattern) - -- The below is used to insert the .vs(8|9|10|11|12|14) into the file names for projects and solutions + -- The below is used to insert the .vs(8|9|10|11|12|14) into the file names for projects and solutions if _ACTION then name_map = {vs2005 = "vs8", vs2008 = "vs9", vs2010 = "vs10", vs2012 = "vs11", vs2013 = "vs12", vs2015 = "vs14"} if name_map[_ACTION] then @@ -88,9 +88,9 @@ end -- worry about the /scripts argument and all that. -- - solution "Premake4" - configurations { "Release", "Debug", "Publish" } - location ( _OPTIONS["to"] ) +solution "Premake4" + configurations { "Release", "Debug", "Publish" } + location ( _OPTIONS["to"] ) project "Premake4" local int_dir = "intermediate/" .. action .. "_$(" .. transformMN("Platform") .. ")_$(" .. transformMN("Configuration") .. ")" @@ -117,7 +117,10 @@ end "src/host/lua-5.1.4/src/print.c", "src/host/lua-5.1.4/**.lua", "src/host/lua-5.1.4/etc/*.c", - "src/host/hgtip.h" + "src/host/hgtip.h", + "packages/**", + "samples/**", + "tests/**", } configuration "Debug" @@ -142,7 +145,7 @@ end configuration {"windows", "Publish"} postbuildcommands { 'ollisign.cmd -a "$(TargetPath)" "https://bitbucket.org/windirstat/premake-stable" "premake4"' } - defines "HAVE_HGTIP" + defines { "HAVE_HGTIP", "PREMAKE_VERSION=4.4-wds"} configuration "linux or bsd" defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } diff --git a/src/host/path_translate.c b/src/host/path_translate.c index 8996b37..bd0c2f1 100644 --- a/src/host/path_translate.c +++ b/src/host/path_translate.c @@ -43,12 +43,14 @@ int path_translate(lua_State* L) lua_newtable(L); lua_pushnil(L); while (lua_next(L, 1)) { - const char* value = luaL_checkstring(L, 4); - translate(buffer, value, sep[0]); - lua_pop(L, 1); + const char* key; + lua_pushvalue(L, 4); // copy the key + key = luaL_checkstring(L, 5); + translate(buffer, key, sep[0]); + lua_pop(L, 2); lua_pushstring(L, buffer); - lua_rawseti(L, -3, ++i); + lua_rawseti(L, -3, ++i); } return 1; } diff --git a/src/host/premake.c b/src/host/premake.c index e096bbc..6f9cc6d 100755 --- a/src/host/premake.c +++ b/src/host/premake.c @@ -12,11 +12,25 @@ #include <CoreFoundation/CFBundle.h> #endif -#ifdef HAVE_HGTIP +#ifndef PPSX +# define PPSX(s) #s +#endif +#ifndef PPS +# define PPS(s) PPSX(s) +#endif +#ifndef PREMAKE_VERSION +# define PREMAKE_VERSION 4.4-wds +#endif + +#if defined(HAVE_HGTIP) # include "hgtip.h" -# define VERSION HG_TIP_ID ":" HG_TIP_REVNO +# define HG_VERSION HG_TIP_ID ":" HG_TIP_REVNO +#endif + +#if defined(HG_VERSION) +# define VERSION PPS(PREMAKE_VERSION) " " HG_VERSION #else -#define VERSION "HEAD" +# define VERSION PPS(PREMAKE_VERSION) #endif #define COPYRIGHT "Copyright (C) 2002-2013 Jason Perkins and the Premake Project" #define ERROR_MESSAGE "%s\n" @@ -326,11 +340,21 @@ static int load_file_scripts(lua_State* L) if (lua_isnil(L, -1)) { - printf(ERROR_MESSAGE, - "Unable to find _premake_main.lua; use /scripts option when in debug mode!\n" - "Please refer to the documentation (or build in release mode instead)." - ); - return !OKAY; + /* call os.pathsearch() to locate _premake_main.lua */ + lua_pushcfunction(L, os_pathsearch); + lua_pushstring(L, "_premake_main.lua"); + lua_pushstring(L, "src"); + lua_pushstring(L, getenv("PREMAKE_PATH")); + lua_call(L, 3, 1); + + if (lua_isnil(L, -1)) + { + printf(ERROR_MESSAGE, + "Unable to find _premake_main.lua; use --scripts option when in debug mode!\n" + "Please refer to the documentation (or build in release mode instead)." + ); + return !OKAY; + } } /* run the bootstrapping script */ diff --git a/src/host/premake4.rc b/src/host/premake4.rc index 147f80f..deb8a51 100644 --- a/src/host/premake4.rc +++ b/src/host/premake4.rc @@ -17,6 +17,16 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252)
#endif //_WIN32
+#ifndef PPSX
+# define PPSX(s) #s
+#endif
+#ifndef PPS
+# define PPS(s) PPSX(s)
+#endif
+#ifndef PREMAKE_VERSION
+# define PREMAKE_VERSION 4.4-wds
+#endif
+
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,4,0,0xFFFF
PRODUCTVERSION 4,4,0,0
@@ -32,14 +42,14 @@ BEGIN BEGIN
VALUE "CompanyName", "WDS Team"
VALUE "FileDescription", "A build configuration tool"
- VALUE "InternalName", "premake4-windirstat"
+ VALUE "InternalName", PPS(PREMAKE_VERSION)
#ifdef HAVE_HGTIP
- VALUE "FileVersion", "4.4-wds-" HG_TIP_REVNO
- VALUE "ProductVersion", "4.4-wds-" HG_TIP_REVNO
+ VALUE "FileVersion", PPS(PREMAKE_VERSION) "-" HG_TIP_REVNO
+ VALUE "ProductVersion", PPS(PREMAKE_VERSION) "-" HG_TIP_REVNO
VALUE "OriginalFilename", "premake4.rev-" HG_TIP_REVNO "-" HG_TIP_ID ".exe"
#else
- VALUE "FileVersion", "4.4-wds"
- VALUE "ProductVersion", "4.4-wds"
+ VALUE "FileVersion", PPS(PREMAKE_VERSION)
+ VALUE "ProductVersion", PPS(PREMAKE_VERSION)
VALUE "OriginalFilename", "premake4.exe"
#endif
VALUE "LegalCopyright", "Copyright (C) 2002-2013 by Jason Perkins, with minor customizations by WDS team"
|