From 80957f895b67e5fe155bae1aa5e7d3178714a5c8 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Sun, 25 Jun 2023 13:14:39 +0200 Subject: [PATCH] updated nmake2, premake config improvements --- nmake2 | 2 +- premake5.lua | 228 ++++++++++++++++++++++++++------------------------- 2 files changed, 116 insertions(+), 114 deletions(-) diff --git a/nmake2 b/nmake2 index 56f6cfcb..3d04ffed 160000 --- a/nmake2 +++ b/nmake2 @@ -1 +1 @@ -Subproject commit 56f6cfcbc622c6cfeed2e4a8abb66f28d3f0d303 +Subproject commit 3d04ffed77947de5c16c044f4c1e47c812ba3ec6 diff --git a/premake5.lua b/premake5.lua index d92d58e6..f1999bca 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,145 +1,147 @@ - ---require("nmake") +--import .mak file generation module require("nmake2") -newoption { - trigger = "with-lto", - description = "Build with link time optimization" -} - workspace "isle" - language "C++" - configurations { "Debug", "Release" } - startproject "isle" - location "build" - symbols "Full" - warnings "Extra" - symbols "on" + language "C++" + configurations { "Debug", "Release" } + startproject "isle" + location "build" + symbols "Full" + warnings "Extra" --flag /W3 or /W4 + symbols "on" - filter { "system:windows" } - configurations { "Vanilla" } - defines { "WIN32", "_WINDOWS" } - platforms { - "win-x86", - "win-amd64", - "win-arm", - "win-arm64" - } + filter { "system:windows" } + configurations { "Vanilla" } + defines { "WIN32", "_WINDOWS" } + platforms { + "win-x86", + "win-amd64", + "win-arm", + "win-arm64" + } - filter { "system:linux" } - platforms { - "linux-x86", - "linux-amd64", - "linux-arm", - "linux-arm64", - } + filter { "system:linux" } + platforms { + "linux-x86", + "linux-amd64", + "linux-arm", + "linux-arm64", + } - filter { "system:bsd" } - platforms { - "bsd-x86", - "bsd-amd64", - "bsd-arm", - "bsd-arm64" - } + filter { "system:bsd" } + platforms { + "bsd-x86", + "bsd-amd64", + "bsd-arm", + "bsd-arm64" + } - filter { "system:macosx" } - platforms { - "macosx-arm64", - "macosx-amd64", - } + filter { "system:macosx" } + platforms { + "macosx-arm64", + "macosx-amd64", + } - filter "configurations:Debug" - defines { "DEBUG" } + filter { "configurations:Vanilla" } + defines { "VANILLA_DEFINES" } - filter "configurations:not Debug" - defines { "NDEBUG" } - optimize "Speed" - if(_OPTIONS["with-lto"]) then - flags { "LinkTimeOptimization" } - end + filter { "configurations:Debug" } + --TODO: check if "DEBUG" define is also needed + defines { "_DEBUG" } + optimize "debug" - filter { "platforms:win*" } - system "windows" + filter { "configurations:not Debug" } + defines { "NDEBUG" } + optimize "Speed" - filter { "platforms:linux*" } - system "linux" + filter { "platforms:win*" } + system "windows" - filter { "platforms:bsd*" } - system "bsd" + filter { "platforms:linux*" } + system "linux" - filter { "platforms:macosx*" } - system "macosx" + filter { "platforms:bsd*" } + system "bsd" - filter { "platforms:*x86*" } - architecture "x86" + filter { "platforms:macosx*" } + system "macosx" - filter { "platforms:*amd64*" } - architecture "amd64" + filter { "platforms:*x86*" } + architecture "x86" - filter { "platforms:*arm*" } - architecture "ARM" - - filter { "platforms:*arm64*" } - architecture "ARM64" + filter { "platforms:*amd64*" } + architecture "amd64" - filter { "platforms:macosx-arm64*", "files:**.cpp"} - buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" } + filter { "platforms:*arm*" } + architecture "ARM" + + filter { "platforms:*arm64*" } + architecture "ARM64" - filter { "platforms:macosx-arm64*", "files:**.c"} - buildoptions { "-target", "arm64-apple-macos11" } + filter { "platforms:macosx-arm64*", "files:**.cpp"} + buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" } - filter { "platforms:macosx-amd64*", "files:**.cpp"} - buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" } + filter { "platforms:macosx-arm64*", "files:**.c"} + buildoptions { "-target", "arm64-apple-macos11" } - filter { "platforms:macosx-amd64*", "files:**.c"} - buildoptions { "-target", "x86_64-apple-macos10.12" } + filter { "platforms:macosx-amd64*", "files:**.cpp"} + buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" } - filter {} + filter { "platforms:macosx-amd64*", "files:**.c"} + buildoptions { "-target", "x86_64-apple-macos10.12" } + + filter {} local function addSrcFiles( prefix ) - return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" + return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" end project "isle" - kind "WindowedApp" - targetname "isle" - targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" - links { "lego1" } - resincludedirs { "." } - dependson { "lego1" } - staticruntime "libc" + kind "WindowedApp" + targetname "ISLE" + targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" + links { "lego1" } + resincludedirs { "." } + dependson { "lego1" } - --libdirs { "bin/%{cfg.platform}/%{cfg.buildcfg}" } - - files { addSrcFiles("ISLE") } - files { addSrcFiles("ISLE/res") } + files { addSrcFiles("ISLE") } + files { addSrcFiles("ISLE/res") } - includedirs { "LEGO1" } + includedirs { "LEGO1" } - filter { "platforms:win*" } - links { "dsound", "advapi32", "user32", "Gdi32", "Winmm" } - resoptions { "/l 0x409" } - - filter "configurations:Vanilla" - defines { "VANILLA_DEFINES" } - - filter {} - - + filter { "action:nmake2" } + --flag /ML or /MLd + staticruntime "libc" + + filter { "action:not nmake2" } + --flag /MT or /MTd + staticruntime "on" + + filter { "platforms:win*" } + links { "dsound", "advapi32", "user32", "gdi32", "winmm" } + --flag language for rc.exe + resoptions { "/l 0x409" } + + --this flags looks like default on, + --but still need some tweaks to nmake2 module to make sure it active + --filter { "configurations:Debug" } + -- buildoptions { "/Gm" } + -- linkoptions { "/incremental:yes" } + + --reset all filters + filter {} project "lego1" - --kind "StaticLib" - kind "SharedLib" - targetname "lego1" - targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" - staticruntime "on" + --TODO: create mxomni project and make static linking configuration + --kind "StaticLib" + kind "SharedLib" + targetname "LEGO1" + targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" + --flag /MT or /MTd + staticruntime "on" - files { addSrcFiles("LEGO1") } + files { addSrcFiles("LEGO1") } - filter { "platforms:win*" } - links { "dsound", "advapi32", "user32", "Gdi32", "Winmm" } - - filter "configurations:Vanilla" - defines { "VANILLA_DEFINES" } - - filter {} - + filter { "platforms:win*" } + links { "dsound", "advapi32", "user32", "Gdi32", "Winmm" } + + filter {}