From 13ff485de322285f0c95183663a95d018c7d4183 Mon Sep 17 00:00:00 2001 From: M_maker Date: Mon, 28 Oct 2024 21:11:28 +0300 Subject: [PATCH] Use RPATH on Linux to avoid relative path to libraries. --- CMakeLists.txt | 6 ++++++ Release/Include/menu.as | 2 +- Release/Tests/menu_test.ngt | 19 +++++++++++++++---- Release/Tests/println.ngt | 4 ++++ Release/Tests/runtime_error.ngt | 7 +++---- Release/Tests/sound_pool_test.ngt | 2 +- 6 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 Release/Tests/println.ngt diff --git a/CMakeLists.txt b/CMakeLists.txt index f84fd1e..8163ce5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,6 +315,12 @@ else() target_link_libraries(${PROJECT_NAME} ${SpeechD_LIBRARIES}) +set_target_properties(${PROJECT_NAME} PROPERTIES + INSTALL_RPATH "$ORIGIN" + BUILD_WITH_INSTALL_RPATH TRUE +) + + endif() target_link_libraries(${PROJECT_NAME} Poco::Foundation) diff --git a/Release/Include/menu.as b/Release/Include/menu.as index 171baa9..6734fab 100644 --- a/Release/Include/menu.as +++ b/Release/Include/menu.as @@ -38,7 +38,7 @@ class menu bool in_submenu = false; bool speak_index = false; bool enable_tab_order = true; - sound_pool sp; + sound_pool sp(6); string open_sound, close_sound, move_sound, click_sound, border_sound, wrapp_sound; menu(const string&in title, bool is_submenu = false) diff --git a/Release/Tests/menu_test.ngt b/Release/Tests/menu_test.ngt index 4787b49..004eebd 100644 --- a/Release/Tests/menu_test.ngt +++ b/Release/Tests/menu_test.ngt @@ -5,18 +5,29 @@ screen_reader::speak("Hello", true); void last_option(){ screen_reader::speak("Test"); } +void create_nested_menus(menu@ parent_menu) { +menu@ current_menu = parent_menu; + +for (int i = 1; i <= 10000; ++i) { +menu sub("&Submenu " + i); +sub.add_item("Item " + i, null); +current_menu.add_submenu("&Submenu " + i, sub); +@current_menu = sub; +} +} + + void main(){ show_window("Menu Test"); wait(500); +screen_reader::speak("Loading..."); menu m("Hello"); m.speak_index = true; -menu sub("Test"); -sub.add_item("Submenu item", null); -sub.add_item("Test", null); m.add_item("Fi&rst", first_option); m.add_item("&Last", last_option); -m.add_submenu("&Additional", sub); +create_nested_menus(m); + while(!quit_requested){ wait(5); m.monitor(); diff --git a/Release/Tests/println.ngt b/Release/Tests/println.ngt new file mode 100644 index 0000000..72d6ba6 --- /dev/null +++ b/Release/Tests/println.ngt @@ -0,0 +1,4 @@ +int main() { + println("Hello, World!"); + return 0; +} diff --git a/Release/Tests/runtime_error.ngt b/Release/Tests/runtime_error.ngt index 00ef568..b45e540 100644 --- a/Release/Tests/runtime_error.ngt +++ b/Release/Tests/runtime_error.ngt @@ -1,5 +1,4 @@ -array a; -int main(){ -a[5000]; -return 0; +void main(){ +char[] c; +c[0]; } \ No newline at end of file diff --git a/Release/Tests/sound_pool_test.ngt b/Release/Tests/sound_pool_test.ngt index d44362a..cc2d72a 100644 --- a/Release/Tests/sound_pool_test.ngt +++ b/Release/Tests/sound_pool_test.ngt @@ -13,7 +13,7 @@ update_window_freq=0; while(!quit_requested){ wait_event(); if(key_repeat(KEY_SPACE)){ -sp.play_1d("c:/windows/media/Windows Default.wav", 0, 20, false); +sp.play_1d("/mnt/c/windows/media/Windows Default.wav", 0, 20, false); sp.update_listener_position(20, 0, 0); } }