Skip to content

Commit

Permalink
Improve handling when cross-compiling DLL
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed May 24, 2024
1 parent a4449d6 commit 68dbeca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
15 changes: 7 additions & 8 deletions Sun/sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ struct Project
if (!opt_static)
{
// Tell linker to include the static library
compiler.extra_linker_args.emplace_back(soup::string::fixType(dep_proj.getOutFile(dep_name).u8string()));
compiler.extra_linker_args.emplace_back(soup::string::fixType(dep_proj.getOutFile().u8string()));
}
}
else //if (dep_proj.opt_dynamic)
Expand Down Expand Up @@ -505,19 +505,18 @@ struct Project

[[nodiscard]] std::filesystem::path getOutFile() const
{
return getOutFile(getName());
}

[[nodiscard]] std::filesystem::path getOutFile(std::string name) const
{
std::string name = getName();
if (opt_static)
{
name.append(soup::Compiler::getStaticLibraryExtension());
}
else if (opt_dynamic)
{
#if SOUP_LINUX
name.insert(0, "lib");
if (!getCompiler().isCrossCompiler())
{
name.insert(0, "lib");
}
#endif
name.append(getCompiler().getDynamicLibraryExtension());
}
Expand Down Expand Up @@ -713,7 +712,7 @@ int entry(std::vector<std::string>&& args, bool console)
{
std::cout << ">>> Running...\n";
args.erase(args.cbegin(), args.cbegin() + 2);
std::cout << soup::os::execute(soup::string::fixType(proj.getOutFile(outname).u8string()), std::move(args));
std::cout << soup::os::execute(soup::string::fixType(proj.getOutFile().u8string()), std::move(args));
}

return E_OK;
Expand Down
10 changes: 6 additions & 4 deletions Sun/vendor/Soup/soup/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ NAMESPACE_SOUP
{
return ".js";
}
#if SOUP_WINDOWS
return ".dll";
#else
return ".so";
#if SOUP_LINUX
if (!isCrossCompiler())
{
return ".so";
}
#endif
return ".dll";
}

std::string Compiler::makeDynamicLibrary(const std::string& in, const std::string& out) const
Expand Down

0 comments on commit 68dbeca

Please sign in to comment.