Skip to content

Commit 29f62ba

Browse files
committed
version bump to 0.89.1-beta
* Fixes copying of shared libraries while bundling on MacOS which was resulting in an assertion violation from Poco. * Fixes MacOS not changing to the directory of a script launched from finder. * Fixes the enter key not pressing the default button in audio form lists. * Linux cross compilation should work again, the Linux build script was pulling down the wrong version of Angelscript. * `#pragma platform` has been deprecated, you should use the command line to specify platforms instead. * Adds preprocessor macros to check platform! You can surround code in `#if android ... #endif` for example, or `#if_not windows ... #endif` as well.
1 parent c29a6f6 commit 29f62ba

File tree

10 files changed

+34
-23
lines changed

10 files changed

+34
-23
lines changed

ASAddon/src/scriptbuilder.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ int CScriptBuilder::ProcessScriptSection(const char *script, unsigned int length
270270

271271
pos += len;
272272

273-
if( token == "if" )
273+
if( token == "if" || token == "if_not")
274274
{
275+
bool if_not = token == "if_not";
275276
t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len);
276277
if( t == asTC_WHITESPACE )
277278
{
@@ -289,7 +290,8 @@ int CScriptBuilder::ProcessScriptSection(const char *script, unsigned int length
289290
OverwriteCode(start, pos-start);
290291

291292
// Has this identifier been defined by the application or not?
292-
if( definedWords.find(word) == definedWords.end() )
293+
bool word_exists = definedWords.find(word) != definedWords.end();
294+
if( if_not && word_exists || !if_not && !word_exists )
293295
{
294296
// Exclude all the code until and including the #endif
295297
pos = ExcludeCode(pos);
@@ -848,7 +850,7 @@ int CScriptBuilder::ExcludeCode(int pos)
848850
token.assign(&modifiedScript[pos], len);
849851
OverwriteCode(pos, len);
850852

851-
if( token == "if" )
853+
if( token == "if" || token == "if_not" )
852854
{
853855
nested++;
854856
}

build/build_linux.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#!/bin/bash
1+
F#!/bin/bash
22

33
function setup_angelscript {
44
echo Installing Angelscript...
5-
git clone --depth 1 https://github.com/codecat/angelscript-mirror||true
5+
git clone https://github.com/codecat/angelscript-mirror||true
66
cd "angelscript-mirror/sdk/angelscript/projects/gnuc"
7+
git checkout 270b98a332faa57a747c9265086c7bce49c041d9
78
make -j$(nproc)
89
sudo make install
910
cd ../../../../..

doc/src/appendix/Changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
This document lists all major changes that have taken place in NVGT since we started keeping track.
33

4+
## New in 0.89.1-beta (10/09/2024):
5+
* Fixes copying of shared libraries while bundling on MacOS which was resulting in an assertion violation from Poco.
6+
* Fixes MacOS not changing to the directory of scripts launched from finder.
7+
* Fixes the enter key not pressing the default button in audio form lists.
8+
* Linux cross compilation should work again, the Linux build script was pulling down the wrong version of Angelscript.
9+
* `#pragma platform` has been deprecated, you should use the command line / menu options / UI to specify platforms instead.
10+
* Adds preprocessor macros to check platform! You can surround code in `#if android ... #endif` for example, or `#if_not windows ... #endif` as well. You can even use this to specify custom includes or pragmas just on certain platforms.
11+
412
## New in 0.89.0-alpha (10/09/2024):
513
* NVGT has now switched to using InnoSetup for it's installer, adding several new options such as adding to path, start menu icons etc.
614
* Added the script_function::get_namespace() method as well as script_function::retrieve() which takes a native function handle derived from a funcdef.

doc/src/manual/-Toolkit Configuration.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,16 @@ For more information on these properties, the [Angelscript custom options docume
170170
## `#pragma` directives
171171
In a few cases, it is also possible to configure some aspects of NVGT's behavior directly from within nvgt scripts themselves using the `#pragma` preprocessor directive.
172172

173-
This directive is used to safely tell the engine about anything that doesn't directly have to do with your script code but also without causing some sort of compilation error due to bad syntax. A pragma directive could do anything, from embedding a file to choosing a target platform to adding include directories and more.
173+
This directive is used to safely tell the engine about anything that doesn't directly have to do with your script code but also without causing some sort of compilation error due to bad syntax. A pragma directive could do anything, from embedding a file to selecting assets to choosing to adding include directories and more.
174174

175175
The syntax for a pragma directive looks like `#pragma name value` or sometimes just `#pragma name` if the option does not require a value. In some cases when a value is to contain a long or complex enough string such as a path, you may need to surround the value in quotes such as `#pragma name "value."`
176176

177177
### Available directives
178178
* `#pragma include <directory>`: search for includes in the given directory (directive can be repeated)
179-
* `#pragma platform <platform>`: select what platform to compile for same as -p argument (auto, android, linux, mac, windows)
180179
* `#pragma stub <stubname>`: select what stub to compile using (see remarks at the bottom of this article)
181180
* `#pragma embed <packname>`: embed the given pack into the compiled executable file itself
182-
* `#pragma asset pathname`: copy the given asset/assets into the bundled product as resources
183-
* `#pragma document pathname`: copy the given asset/assets into the bundled product as documents intended for the user to access rather than the programmer
181+
* `#pragma asset <pathname>`: copy the given asset/assets into the bundled product as resources
182+
* `#pragma document <pathname>`: copy the given asset/assets into the bundled product as documents intended for the user to access rather than the programmer
184183
* `#pragma plugin <plugname>`: load and activate a plugin given it's dll basename
185184
* `#pragma compiled_basename <basename>`: the output filename of the compiled executable without the extension
186185
* `#pragma bytecode_compression <level from 0 to 9>`: controls the compression level for bytecode saved in the compiled executable (0 disabled 9 maximum)

release/include/form.nvgt

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ class audio_form {
669669
if (subform)
670670
return 2;
671671
}
672-
if ((focused < 0 || c_form[focused].type != ct_keyboard_area) && (focused < 0 || ((!c_form[focused].multiline_enter || !c_form[focused].multiline) && c_form[focused].type == ct_input || c_form[focused].type == ct_button) && key_up(KEY_LCTRL) && key_up(KEY_RCTRL) && key_up(KEY_LSHIFT) && key_up(KEY_RSHIFT)) && (key_pressed(KEY_RETURN) || key_pressed(KEY_NUMPAD_ENTER) || (autotab == 3))) {
672+
if ((focused < 0 || c_form[focused].type != ct_keyboard_area) && (focused < 0 || ((!c_form[focused].multiline_enter || !c_form[focused].multiline) && c_form[focused].type == ct_input || c_form[focused].type == ct_button || c_form[focused].type == ct_list) && key_up(KEY_LCTRL) && key_up(KEY_RCTRL) && key_up(KEY_LSHIFT) && key_up(KEY_RSHIFT)) && (key_pressed(KEY_RETURN) || key_pressed(KEY_NUMPAD_ENTER) || (autotab == 3))) {
673673
stop_speech();
674674
if ((defaults == -1) && (focused > -1)) {
675675
if (c_form[focused].type == ct_button || c_form[focused].type == ct_link)

src/angelscript.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,13 @@ int CompileScript(asIScriptEngine* engine, const string& scriptFile) {
518518
Path global_include(Path(android_get_main_shared_object()).parent().parent().parent().append("assets"));
519519
#endif
520520
g_IncludeDirs.push_back(global_include.toString());
521-
if (!g_debug)
522-
engine->SetEngineProperty(asEP_BUILD_WITHOUT_LINE_CUES, true);
521+
if (!g_debug) engine->SetEngineProperty(asEP_BUILD_WITHOUT_LINE_CUES, true);
522+
if (g_platform == "auto") determine_compile_platform(); // Insure that platform defines work whether compiling or executing a script.
523523
CScriptBuilder builder;
524524
builder.SetIncludeCallback(IncludeCallback, 0);
525525
builder.SetPragmaCallback(PragmaCallback, 0);
526-
if (builder.StartNewModule(engine, "nvgt_game") < 0)
527-
return -1;
526+
if (builder.StartNewModule(engine, "nvgt_game") < 0) return -1;
527+
if (g_platform != "auto") builder.DefineWord(g_platform.c_str());
528528
asIScriptModule* mod = builder.GetModule();
529529
if (mod) mod->SetAccessMask(NVGT_SUBSYSTEM_EVERYTHING);
530530
try {
@@ -834,9 +834,7 @@ int PragmaCallback(const string& pragmaText, CScriptBuilder& builder, void* /*us
834834
string bn = cleanText.substr(18);
835835
if (bn == "*") bn.clear();
836836
config.setString("build.output_basename", bn);
837-
} else if (cleanText.starts_with("platform "))
838-
g_platform = cleanText.substr(9);
839-
else if (cleanText.starts_with("bytecode_compression ")) {
837+
} else if (cleanText.starts_with("bytecode_compression ")) {
840838
g_bcCompressionLevel = strtol(cleanText.substr(21).c_str(), NULL, 10);
841839
if (g_bcCompressionLevel < 0 || g_bcCompressionLevel > 9) return -1;
842840
} else if (cleanText == "console") config.setString("build.windowsConsole", "");

src/bundling.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class nvgt_compilation_output_impl : public virtual nvgt_compilation_output {
219219
for (const game_asset& g : g_game_assets) {
220220
Path p = Path(g.bundled_path).makeAbsolute(g.flags & GAME_ASSET_DOCUMENT? document_path : resource_path);
221221
if (!File(p.parent()).exists()) File(p.parent()).createDirectories();
222-
File(g.filesystem_path).copyTo(p.toString());
222+
File(Path(g.filesystem_path).makeAbsolute(Path(get_input_file()).makeParent()).toString()).copyTo(p.toString());
223223
}
224224
}
225225
void copy_shared_libraries(const Path& libpath) {
@@ -232,7 +232,7 @@ class nvgt_compilation_output_impl : public virtual nvgt_compilation_output {
232232
StringTokenizer excludes(config.getString("build.shared_library_excludes", "plist TrueAudioNext GPUUtilities systemd_notify sqlite git2 curl"), " "); // Todo: Make this a whitelist once plugins have a way to communicate about extra libraries they load.
233233
string source = get_nvgt_lib_directory(g_platform);
234234
set<string> libs;
235-
Glob::glob("*", source, libs, Glob::GLOB_DOT_SPECIAL | Glob::GLOB_FOLLOW_SYMLINKS | Glob::GLOB_CASELESS);
235+
Glob::glob(Path(source).append("*").toString(), libs, Glob::GLOB_DOT_SPECIAL | Glob::GLOB_FOLLOW_SYMLINKS | Glob::GLOB_CASELESS);
236236
for (const string& library : libs) {
237237
// First check if we wish to exclude this library.
238238
bool excluded = false;
@@ -377,7 +377,7 @@ class nvgt_compilation_output_mac : public nvgt_compilation_output_impl {
377377
plist_mem_free(plist_xml);
378378
plist_free(plist);
379379
// Bundle assets and copy shared libraries.
380-
bundle_assets(Path(workplace.path()).append("Contents/Resources"), bundle_mode == 3? Path(workplace.path()).makeParent() : Path(workplace.path()).append("Contents/Resources"));
380+
bundle_assets(Path(workplace.path()).append("Contents/Resources"), bundle_mode == 2? Path(workplace.path()).makeParent() : Path(workplace.path()).append("Contents/Resources"));
381381
copy_shared_libraries(Path(workplace.path()).append("Contents/Frameworks"));
382382
if (bundle_mode > 1) {
383383
// On the mac, we can execute the hdiutil command to create a .dmg file. Otherwise, we must create a .zip instead, as it can portably store unix file attributes.
@@ -386,7 +386,7 @@ class nvgt_compilation_output_mac : public nvgt_compilation_output_impl {
386386
string sout, serr;
387387
File dmg_out = Path(final_output_path).makeFile().setExtension("dmg").toString();
388388
if (dmg_out.exists()) dmg_out.remove(true);
389-
if (!system_command("hdiutil", {"create", "-srcfolder", bundle_mode < 3? workplace.path() : Path(workplace.path()).makeParent().toString(), "-volname", Path(workplace.path()).makeFile().getBaseName(), dmg_out.path()}, sout, serr)) throw Exception(format("Unable to execute hdiutil for .dmg generation: %s", serr));
389+
if (!system_command("hdiutil", {"create", "-srcfolder", bundle_mode != 2? workplace.path() : Path(workplace.path()).makeParent().toString(), "-volname", Path(workplace.path()).makeFile().getBaseName(), dmg_out.path()}, sout, serr)) throw Exception(format("Unable to execute hdiutil for .dmg generation: %s", serr));
390390
output_path = dmg_out.path();
391391
#else
392392
File zip_out = Path(final_output_path).makeFile().setExtension("app.zip").toString();

src/nvgt.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class nvgt_application : public Poco::Util::Application {
192192
mode = option == 1? NVGT_RUN : NVGT_COMPILE;
193193
try {
194194
// Try to change to the directory containing the selected script.
195-
ChDir(Poco::Path(script).parent().toString().c_str());
195+
ChDir(Poco::Path(script).parent().toString());
196196
} catch(...) {} // If it fails, so be it.
197197
return script;
198198
} else if (option == 4 || option == 5) {
@@ -210,6 +210,7 @@ class nvgt_application : public Poco::Util::Application {
210210
string scriptfile = "";
211211
#if defined(__APPLE__) || defined(__ANDROID__)
212212
scriptfile = event_requested_file(); // Files opened from external apps on MacOS, IOS, and Android do not use command line arguments.
213+
if (!scriptfile.empty()) ChDir(Path(scriptfile).makeParent().toString());
213214
#endif
214215
if (scriptfile.empty() && args.size() > 0) scriptfile = args[0];
215216
if (scriptfile.empty() && config().hasOption("application.gui")) scriptfile = UILauncher();

src/xplatform.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ void determine_compile_platform() {
4141
g_platform = "linux";
4242
#elif defined(__APPLE__)
4343
g_platform = "mac"; // Todo: detect difference between IOS and macos (need to look up the correct macros).
44+
#elif defined(__ANDROID__)
45+
g_platform = "android";
4446
#endif
4547
// else compilation is not supported on this platform.
4648
}

version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.89.0-alpha
1+
0.89.1-beta

0 commit comments

Comments
 (0)