aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-01-01 19:05:48 +0100
committerdec05eba <dec05eba@protonmail.com>2022-01-01 19:05:48 +0100
commitfbfd7c227a080537f498b51ec3de22053a32c599 (patch)
tree720282b1a63018dc19be8500e34d0665fbf14549
parent37b23908f195d54844486552cc4359bf6f4a949c (diff)
Move -ldl and -lm to end
-rw-r--r--TODO3
-rw-r--r--backend/ninja/Ninja.cpp10
2 files changed, 10 insertions, 3 deletions
diff --git a/TODO b/TODO
index 0414e95..b34786d 100644
--- a/TODO
+++ b/TODO
@@ -1 +1,2 @@
-[dependencies] should automatically download dependency from vcpkg if available. This is useful for windows
+[dependencies] should automatically download dependency from vcpkg if available. This is useful for windows.
+Static libraries with dependencies should propagate their dependencies upwards to the first non-static library.
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 456eb27..be8e303 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -1311,6 +1311,7 @@ namespace backend
case LibraryType::EXECUTABLE:
{
vector<ninja::NinjaArg> buildExeArgs;
+ vector<ninja::NinjaArg> lastBuildExeArgs;
string executableName = config.getPackageName();
if(isSamePlatformFamily(config.platform, PLATFORM_WIN))
executableName += ".exe";
@@ -1381,7 +1382,7 @@ namespace backend
#else
if(!isSamePlatformFamily(config.platform, PLATFORM_WIN))
{
- buildExeArgs.insert(buildExeArgs.end(), {
+ lastBuildExeArgs.insert(lastBuildExeArgs.end(), {
ninja::NinjaArg::createRaw("-ldl"),
ninja::NinjaArg::createRaw("-lm")
});
@@ -1424,6 +1425,8 @@ namespace backend
if (!allLinkerFlags.empty())
buildExeArgs.push_back(ninja::NinjaArg::createRaw(allLinkerFlags));
+ buildExeArgs.insert(buildExeArgs.end(), lastBuildExeArgs.begin(), lastBuildExeArgs.end());
+
buildExeArgs.push_back(ninja::NinjaArg::createRaw(packagingFlags));
if(config.getCompiler() == Compiler::MINGW_W64)
{
@@ -1533,6 +1536,7 @@ namespace backend
case LibraryType::DYNAMIC:
{
vector<ninja::NinjaArg> buildDynamicArgs;
+ vector<ninja::NinjaArg> lastBuildDynamicArgs;
string generatedFile;
switch (config.getCompiler())
{
@@ -1613,7 +1617,7 @@ namespace backend
#else
if(!isSamePlatformFamily(config.platform, PLATFORM_WIN))
{
- buildDynamicArgs.insert(buildDynamicArgs.end(), {
+ lastBuildDynamicArgs.insert(lastBuildDynamicArgs.end(), {
ninja::NinjaArg::createRaw("-ldl"),
ninja::NinjaArg::createRaw("-lm")
});
@@ -1655,6 +1659,8 @@ namespace backend
if (!allLinkerFlags.empty())
buildDynamicArgs.push_back(ninja::NinjaArg::createRaw(allLinkerFlags));
+ buildDynamicArgs.insert(buildDynamicArgs.end(), lastBuildDynamicArgs.begin(), lastBuildDynamicArgs.end());
+
buildDynamicArgs.push_back(ninja::NinjaArg::createRaw(packagingFlags));
if(config.getCompiler() == Compiler::MINGW_W64)
{