premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

Shared lib in seperate target folder.

Open RicoP opened this issue 3 years ago • 7 comments

This might be related to #361?

What are you trying to do? I have different configurations (debug, debugfast, release) for my workspace, but I have one project that i always want as a dll with optimizations on high.

my config looks like that

project "lib.raylib"
  kind "SharedLib"  
  optimize "Size"
  targetname "raylib"
  targetsuffix ""

it would also be nice to build the project into a different folder like that targetdir ".build/libs"

Problem is, when I do so both .lib and .dll will end up in the libs folder, what is what I want, but then my application isn't starting anymore because it can't find "raylib.dll". Is there a way in premake to add the .build/libs folder as a searching folder for dlls?

RicoP avatar Jun 29 '21 12:06 RicoP

Does this do what you need?

https://premake.github.io/docs/libdirs

nickclark2016 avatar Jun 29 '21 13:06 nickclark2016

The problem is that libdirs won't help with my exe not finding the dll, which isn't in the same folder

RicoP avatar Jun 29 '21 13:06 RicoP

Can you use a post build command to copy the DLL to the same directory as the executable?

nickclark2016 avatar Jun 29 '21 16:06 nickclark2016

Guess that's what I am going to do. I was hoping there is a way to tell VS directly to load dll's from a different location.

RicoP avatar Jun 29 '21 16:06 RicoP

If you can find a way to tell VS explicitly (outside of premake), let me know and I'll see what can be done to add it to premake.

nickclark2016 avatar Jun 29 '21 16:06 nickclark2016

dll are looked in PATH (and local directory) on windows, (*nix uses LD_LIBRARY_PATH). On *nix, you might prepend variable setting before launching application as PATH=$PATH:some_path my_app. Don't know if Windows have similar way.

Jarod42 avatar Jul 06 '21 07:07 Jarod42

Late to follow up, but here's a reference to the load order: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

nickclark2016 avatar Jul 28 '21 17:07 nickclark2016

I think at this point this is something that's closeable. I don't know of a way to do it without copying the files to a location on the DLL search path hierarchy, which can be done with post build commands.

nickclark2016 avatar Aug 22 '22 00:08 nickclark2016