|
| 1 | +if (_ACTION == nil) then |
| 2 | + return |
| 3 | +end |
| 4 | + |
| 5 | +local LocationDir = "solution/%{_ACTION}" |
| 6 | + |
| 7 | +workspace "Project" |
| 8 | + location(LocationDir) |
| 9 | + configurations {"Debug", "Release"} |
| 10 | + |
| 11 | + objdir(path.join(LocationDir, "obj")) -- premake adds $(configName)/$(AppName) |
| 12 | + targetdir(path.join(LocationDir, "bin/%{cfg.buildcfg}")) |
| 13 | + |
| 14 | + startproject "app" |
| 15 | + |
| 16 | +project "app" |
| 17 | + kind "ConsoleApp" |
| 18 | + targetname "app" |
| 19 | + |
| 20 | + files { "src/main.cpp" } |
| 21 | + |
| 22 | + defines { 'USING_DLL', 'USING_DLL_LIB' } |
| 23 | + links 'dll' |
| 24 | + |
| 25 | +project "dll" |
| 26 | + kind "SharedLib" |
| 27 | + targetname "dll" |
| 28 | + |
| 29 | + files { "src/dll.cpp", 'src/dll.h' } |
| 30 | + |
| 31 | + defines { 'MAKING_DLL', 'MAKING_DLL_LIB' } |
| 32 | + filter { 'toolset:msc*' } |
| 33 | + dependson 'lib' |
| 34 | + linkoptions { '/WHOLEARCHIVE:bin/%{cfg.buildcfg}/lib.lib' } |
| 35 | + filter { 'toolset:gcc', 'system:windows' } |
| 36 | + dependson 'lib' |
| 37 | + linkoptions { '-Wl,--whole-archive bin/%{cfg.buildcfg}/lib.lib -Wl,--no-whole-archive' } |
| 38 | + filter { 'toolset:gcc', 'system:not windows' } |
| 39 | + dependson 'lib' |
| 40 | + linkoptions { '-Wl,--whole-archive bin/%{cfg.buildcfg}/liblib.a -Wl,--no-whole-archive' } |
| 41 | + filter { 'toolset:clang', 'system:windows' } |
| 42 | + dependson 'lib' |
| 43 | + linkoptions { '-force_load bin/%{cfg.buildcfg}/lib.lib' } |
| 44 | + filter { 'toolset:clang', 'system:not windows' } |
| 45 | + dependson 'lib' |
| 46 | + linkoptions { '-force_load bin/%{cfg.buildcfg}/liblib.a' } |
| 47 | + filter {} |
| 48 | + --links 'lib' |
| 49 | + |
| 50 | +project "lib" |
| 51 | + kind "StaticLib" |
| 52 | + targetname "lib" |
| 53 | + |
| 54 | + defines { 'MAKING_DLL_LIB' } |
| 55 | + files { "src/lib.cpp", 'src/lib.h' } |
| 56 | + |
| 57 | +project "test" |
| 58 | + kind "ConsoleApp" |
| 59 | + targetname "test" |
| 60 | + |
| 61 | + files { "src/test.cpp" } |
| 62 | + links 'lib' |
0 commit comments