From 4687b4691701e4037f49d1677c2becf2f4807883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 28 Feb 2024 20:27:11 -0300 Subject: [PATCH] Added an option to disable static build from build scripts --- .ecode/project_build.json | 2 +- premake4.lua | 3 +++ premake5.lua | 4 +++- projects/macos/make_no_fw.sh | 2 +- src/examples/7guis/crud/crud.cpp | 5 ++--- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.ecode/project_build.json b/.ecode/project_build.json index 4e956475c..72d33740c 100644 --- a/.ecode/project_build.json +++ b/.ecode/project_build.json @@ -77,7 +77,7 @@ "eepp-linux": { "build": [ { - "args": "--with-debug-symbols gmake", + "args": "--with-debug-symbols gmake --disable-static-build", "command": "premake4", "working_dir": "${project_root}" }, diff --git a/premake4.lua b/premake4.lua index 8a720e4d3..494d98674 100644 --- a/premake4.lua +++ b/premake4.lua @@ -166,6 +166,7 @@ newoption { trigger = "with-debug-symbols", description = "Release builds are bu newoption { trigger = "thread-sanitizer", description ="Compile with ThreadSanitizer." } newoption { trigger = "address-sanitizer", description = "Compile with AddressSanitizer." } newoption { trigger = "time-trace", description = "Compile with time trace." } +newoption { trigger = "disable-static-build", description = "Disables eepp static build project, this is just a helper to avoid rebuilding twice eepp while developing the library." } newoption { trigger = "with-backend", description = "Select the backend to use for window and input handling.\n\t\t\tIf no backend is selected or if the selected is not installed the script will search for a backend present in the system, and will use it.", @@ -1279,11 +1280,13 @@ solution "eepp" build_base_cpp_configuration( "eterm" ) -- Library + if not _OPTIONS["disable-static-build"] then project "eepp-static" kind "StaticLib" language "C++" set_targetdir("libs/" .. os.get_real() .. "/") build_eepp( "eepp-static" ) + end project "eepp-shared" kind "SharedLib" diff --git a/premake5.lua b/premake5.lua index 451e00a88..0f6345ef7 100644 --- a/premake5.lua +++ b/premake5.lua @@ -14,6 +14,7 @@ newoption { trigger = "with-debug-symbols", description = "Release builds are bu newoption { trigger = "thread-sanitizer", description = "Compile with ThreadSanitizer." } newoption { trigger = "address-sanitizer", description = "Compile with AddressSanitizer." } newoption { trigger = "time-trace", description = "Compile with time tracing." } +newoption { trigger = "disable-static-build", description = "Disables eepp static build project, this is just a helper to avoid rebuilding twice eepp while developing the library." } newoption { trigger = "with-backend", description = "Select the backend to use for window and input handling.\n\t\t\tIf no backend is selected or if the selected is not installed the script will search for a backend present in the system, and will use it.", @@ -1044,12 +1045,13 @@ workspace "eepp" buildoptions { "-std=c++17" } -- Library + if not _OPTIONS["disable-static-build"] then project "eepp-static" kind "StaticLib" language "C++" build_eepp( "eepp-static" ) target_dir_lib("") - + end project "eepp-shared" kind "SharedLib" language "C++" diff --git a/projects/macos/make_no_fw.sh b/projects/macos/make_no_fw.sh index 9239525ea..35ae0a927 100755 --- a/projects/macos/make_no_fw.sh +++ b/projects/macos/make_no_fw.sh @@ -1,6 +1,6 @@ #!/bin/sh cd $(dirname "$0") -premake4 --file=../../premake4.lua gmake +premake4 --file=../../premake4.lua --disable-static-build gmake cd ../../make/macosx/ sed -e "s/-Wl,-x//g" -i .make diff --git a/src/examples/7guis/crud/crud.cpp b/src/examples/7guis/crud/crud.cpp index 949fb5e32..0ace0a191 100644 --- a/src/examples/7guis/crud/crud.cpp +++ b/src/examples/7guis/crud/crud.cpp @@ -145,9 +145,8 @@ EE_MAIN_FUNC int main( int, char** ) { const auto getSelectedPersonIt = [&]() -> std::vector::iterator { auto p = static_cast( listView->getModel() ) ->getPerson( listView->getSelection().first() ); - auto found = std::find_if( people.begin(), people.end(), - [&p]( const Person& person ) { return p.id == person.id; } ); - return found; + return std::find_if( people.begin(), people.end(), + [&p]( const Person& person ) { return p.id == person.id; } ); }; updateBut->onClick( [&]( auto ) { auto found = getSelectedPersonIt();