diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e16bfe9..19cd75f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,22 +39,21 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: Generate project files - #run: tools/premake5 vs2022 --ci-build --ac-disable run: tools/premake5 vs2022 --ac-disable - name: Set up problem matching uses: ammaraskar/msvc-problem-matcher@master - name: Build ${{matrix.configuration}} binaries - run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} build/iw4x.sln + run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=Win32 build/iw4x.sln - name: Upload ${{matrix.configuration}} binaries uses: actions/upload-artifact@v2 with: name: ${{matrix.configuration}} binaries path: | - build/bin/${{matrix.configuration}}/iw4x.dll - build/bin/${{matrix.configuration}}/iw4x.pdb + build/bin/Win32/${{matrix.configuration}}/iw4x.dll + build/bin/Win32/${{matrix.configuration}}/iw4x.pdb # - name: Upload ${{matrix.configuration}} data artifacts # uses: actions/upload-artifact@v2 @@ -63,7 +62,6 @@ jobs: # path: | # data/* - deploy: name: Deploy artifacts needs: build @@ -116,4 +114,4 @@ jobs: # run: rsync -avz ./data/ ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw4x/data/ - name: Publish changes - run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }} + run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }} diff --git a/deps/premake/dxsdk.lua b/deps/premake/dxsdk.lua new file mode 100644 index 00000000..2d7be9c9 --- /dev/null +++ b/deps/premake/dxsdk.lua @@ -0,0 +1,19 @@ +dxsdk = { + source = path.join(dependencies.basePath, "dxsdk"), +} + +function dxsdk.import() + libdirs {path.join(dxsdk.source, "Lib/x86")} + dxsdk.includes() +end + +function dxsdk.includes() + includedirs { + path.join(dxsdk.source, "Include"), + } +end + +function dxsdk.project() +end + +table.insert(dependencies, dxsdk) diff --git a/deps/premake/json11.lua b/deps/premake/json11.lua new file mode 100644 index 00000000..3437ba57 --- /dev/null +++ b/deps/premake/json11.lua @@ -0,0 +1,32 @@ +json11 = { + source = path.join(dependencies.basePath, "json11"), +} + +function json11.import() + links {"json11"} + + json11.includes() +end + +function json11.includes() + includedirs {json11.source} +end + +function json11.project() + project "json11" + language "C++" + + files + { + path.join(json11.source, "*.cpp"), + path.join(json11.source, "*.hpp"), + } + + warnings "Off" + + defines {"_LIB"} + removedefines {"_USRDLL", "_DLL"} + kind "StaticLib" +end + +table.insert(dependencies, json11) \ No newline at end of file diff --git a/deps/premake/libtomcrypt.lua b/deps/premake/libtomcrypt.lua new file mode 100644 index 00000000..51860cfa --- /dev/null +++ b/deps/premake/libtomcrypt.lua @@ -0,0 +1,59 @@ +libtomcrypt = { + source = path.join(dependencies.basePath, "libtomcrypt"), +} + +function libtomcrypt.import() + links {"libtomcrypt"} + + libtomcrypt.includes() +end + +function libtomcrypt.includes() + includedirs { + path.join(libtomcrypt.source, "src/headers") + } + + defines { + "LTC_NO_FAST", + "LTC_NO_PROTOTYPES", + "LTC_NO_RSA_BLINDING", + } +end + +function libtomcrypt.project() + project "libtomcrypt" + language "C" + + libtomcrypt.includes() + libtommath.import() + + files { + path.join(libtomcrypt.source, "src/**.c"), + } + + removefiles { + path.join(libtomcrypt.source, "src/**/*tab.c"), + path.join(libtomcrypt.source, "src/encauth/ocb3/**.c"), + } + + defines { + "_CRT_SECURE_NO_WARNINGS", + "LTC_SOURCE", + "_LIB", + "USE_LTM" + } + + removedefines { + "_DLL", + "_USRDLL" + } + + linkoptions { + "-IGNORE:4221" + } + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, libtomcrypt) diff --git a/deps/premake/libtommath.lua b/deps/premake/libtommath.lua new file mode 100644 index 00000000..e6cc65e2 --- /dev/null +++ b/deps/premake/libtommath.lua @@ -0,0 +1,50 @@ +libtommath = { + source = path.join(dependencies.basePath, "libtommath"), +} + +function libtommath.import() + links {"libtommath"} + + libtommath.includes() +end + +function libtommath.includes() + includedirs { + libtommath.source + } + + defines { + "LTM_DESC", + "__STDC_IEC_559__", + "MP_NO_DEV_URANDOM", + } +end + +function libtommath.project() + project "libtommath" + language "C" + + libtommath.includes() + + files { + path.join(libtommath.source, "*.c"), + } + + defines { + "_LIB" + } + + removedefines { + "_DLL", + "_USRDLL" + } + + linkoptions { + "-IGNORE:4221" + } + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, libtommath) diff --git a/deps/premake/minizip.lua b/deps/premake/minizip.lua new file mode 100644 index 00000000..755f5dae --- /dev/null +++ b/deps/premake/minizip.lua @@ -0,0 +1,43 @@ +minizip = { + source = path.join(dependencies.basePath, "zlib/contrib/minizip"), +} + +function minizip.import() + links {"minizip"} + zlib.import() + minizip.includes() +end + +function minizip.includes() + includedirs { + minizip.source + } + + zlib.includes() +end + +function minizip.project() + project "minizip" + language "C" + + minizip.includes() + + files { + path.join(minizip.source, "*.h"), + path.join(minizip.source, "*.c"), + } + + removefiles { + path.join(minizip.source, "miniunz.c"), + path.join(minizip.source, "minizip.c"), + } + + defines { + "_CRT_SECURE_NO_DEPRECATE", + } + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, minizip) diff --git a/deps/premake/mongoose.lua b/deps/premake/mongoose.lua new file mode 100644 index 00000000..01935e94 --- /dev/null +++ b/deps/premake/mongoose.lua @@ -0,0 +1,32 @@ +mongoose = { + source = path.join(dependencies.basePath, "mongoose"), +} + +function mongoose.import() + links {"mongoose"} + + mongoose.includes() +end + +function mongoose.includes() + includedirs {mongoose.source} +end + +function mongoose.project() + project "mongoose" + language "C" + + mongoose.includes() + + files + { + path.join(mongoose.source, "*.c"), + path.join(mongoose.source, "*.h"), + } + + warnings "Off" + + kind "StaticLib" +end + +table.insert(dependencies, mongoose) diff --git a/deps/premake/pdcurses.lua b/deps/premake/pdcurses.lua new file mode 100644 index 00000000..7e427b6e --- /dev/null +++ b/deps/premake/pdcurses.lua @@ -0,0 +1,34 @@ +pdcurses = { + source = path.join(dependencies.basePath, "pdcurses"), +} + +function pdcurses.import() + links {"pdcurses"} + + pdcurses.includes() +end + +function pdcurses.includes() + includedirs {pdcurses.source} +end + +function pdcurses.project() + project "pdcurses" + language "C" + + pdcurses.includes() + + files + { + path.join(pdcurses.source, "pdcurses/*.c"), + path.join(pdcurses.source, "pdcurses/*.h"), + path.join(pdcurses.source, "wincon/*.c"), + path.join(pdcurses.source, "wincon/*.h"), + } + + warnings "Off" + + kind "StaticLib" +end + +table.insert(dependencies, pdcurses) diff --git a/deps/premake/protobuf.lua b/deps/premake/protobuf.lua new file mode 100644 index 00000000..a293576f --- /dev/null +++ b/deps/premake/protobuf.lua @@ -0,0 +1,50 @@ +protobuf = { + source = path.join(dependencies.basePath, "protobuf"), +} + +function protobuf.import() + links {"protobuf"} + + protobuf.includes() +end + +function protobuf.includes() + includedirs { + path.join(protobuf.source, "src"), + } +end + +function protobuf.project() + project "protobuf" + language "C++" + + protobuf.includes() + + files { + path.join(protobuf.source, "src/**.cc"), + "./src/**.proto", + } + + removefiles { + path.join(protobuf.source, "src/**/*test.cc"), + path.join(protobuf.source, "src/google/protobuf/*test*.cc"), + + path.join(protobuf.source, "src/google/protobuf/testing/**.cc"), + path.join(protobuf.source, "src/google/protobuf/compiler/**.cc"), + + path.join(protobuf.source, "src/google/protobuf/arena_nc.cc"), + path.join(protobuf.source, "src/google/protobuf/util/internal/error_listener.cc"), + path.join(protobuf.source, "**/*_gcc.cc"), + } + + rules {"ProtobufCompiler"} + + defines {"_SCL_SECURE_NO_WARNINGS"} + + linkoptions {"-IGNORE:4221"} + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, protobuf) diff --git a/deps/premake/udis86.lua b/deps/premake/udis86.lua new file mode 100644 index 00000000..f4cf46b2 --- /dev/null +++ b/deps/premake/udis86.lua @@ -0,0 +1,35 @@ +udis86 = { + source = path.join(dependencies.basePath, "udis86"), +} + +function udis86.import() + links {"udis86"} + + udis86.includes() +end + +function udis86.includes() + includedirs { + udis86.source, + path.join(udis86.source, "libudis86"), + path.join(dependencies.basePath, "extra/udis86"), + path.join(dependencies.basePath, "extra/udis86/libudis86"), + } +end + +function udis86.project() + project "udis86" + language "C" + + udis86.includes() + + files { + path.join(udis86.source, "libudis86/*.c"), + path.join(dependencies.basePath, "extra/udis86/libudis86/*.c"), + } + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, udis86) diff --git a/deps/premake/zlib.lua b/deps/premake/zlib.lua new file mode 100644 index 00000000..c166a160 --- /dev/null +++ b/deps/premake/zlib.lua @@ -0,0 +1,39 @@ +zlib = { + source = path.join(dependencies.basePath, "zlib"), +} + +function zlib.import() + links {"zlib"} + zlib.includes() +end + +function zlib.includes() + includedirs { + zlib.source + } + + defines { + "ZLIB_CONST", + } +end + +function zlib.project() + project "zlib" + language "C" + + zlib.includes() + + files { + path.join(zlib.source, "*.h"), + path.join(zlib.source, "*.c"), + } + + defines { + "_CRT_SECURE_NO_DEPRECATE", + } + + warnings "Off" + kind "StaticLib" +end + +table.insert(dependencies, zlib) diff --git a/premake/dxsdk.lua b/premake/dxsdk.lua deleted file mode 100644 index 08bcbc1a..00000000 --- a/premake/dxsdk.lua +++ /dev/null @@ -1,35 +0,0 @@ -dxsdk = { - settings = nil -} - -function dxsdk.setup(settings) - if not settings.source then error("Missing source.") end - - dxsdk.settings = settings - - if not dxsdk.settings.defines then dxsdk.settings.defines = {} end -end - -function dxsdk.import() - if not dxsdk.settings then error("You need to call dxsdk.setup first") end - - --filter "platforms:*32" - libdirs { path.join(dxsdk.settings.source, "Lib/x86") } - - --filter "platforms:*64" - -- libdirs { path.join(dxsdk.settings.source, "Lib/x64") } - - --filter {} - - dxsdk.includes() -end - -function dxsdk.includes() - if not dxsdk.settings then error("You need to call dxsdk.setup first") end - - includedirs { path.join(dxsdk.settings.source, "Include") } - defines(dxsdk.settings.defines) -end - -function dxsdk.project() -end \ No newline at end of file diff --git a/premake/json11.lua b/premake/json11.lua deleted file mode 100644 index 325f5240..00000000 --- a/premake/json11.lua +++ /dev/null @@ -1,51 +0,0 @@ -json11 = { - settings = nil, -} - -function json11.setup(settings) - if not settings.source then error("Missing source.") end - - json11.settings = settings -end - -function json11.import() - if not json11.settings then error("Run json11.setup first") end - - links { "json11" } - json11.includes() -end - -function json11.includes() - if not json11.settings then error("Run json11.setup first") end - - includedirs { json11.settings.source } -end - -function json11.project() - if not json11.settings then error("Run json11.setup first") end - - project "json11" - language "C++" - - includedirs - { - json11.settings.source, - } - - files - { - path.join(json11.settings.source, "*.cpp"), - path.join(json11.settings.source, "*.hpp"), - } - removefiles - { - path.join(json11.settings.source, "test*"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - defines { "_LIB" } - removedefines { "_USRDLL", "_DLL" } - kind "StaticLib" -end diff --git a/premake/libtomcrypt.lua b/premake/libtomcrypt.lua deleted file mode 100644 index f955b59a..00000000 --- a/premake/libtomcrypt.lua +++ /dev/null @@ -1,62 +0,0 @@ -libtomcrypt = { - settings = nil -} - -function libtomcrypt.setup(settings) - if not settings.source then error("Missing source") end - - libtomcrypt.settings = settings - - if not libtomcrypt.settings.defines then libtomcrypt.settings.defines = {} end -end - -function libtomcrypt.import() - if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end - - links { "libtomcrypt" } - libtomcrypt.includes() -end - -function libtomcrypt.includes() - if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end - - defines(libtomcrypt.settings.defines) - includedirs { path.join(libtomcrypt.settings.source, "src/headers") } -end - -function libtomcrypt.project() - if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end - - project "libtomcrypt" - language "C" - - libtomcrypt.includes() - files - { - path.join(libtomcrypt.settings.source, "src/**.c"), - } - removefiles - { - path.join(libtomcrypt.settings.source, "src/**/*tab.c"), -- included by files as necessary already afaik - path.join(libtomcrypt.settings.source, "src/encauth/ocb3/**.c"), -- fails in Visual Studio with invalid syntax - } - defines - { - "_CRT_SECURE_NO_WARNINGS", - "LTC_SOURCE", -- we are compiling from source code - } - - -- dependencies - if libtommath and libtommath.settings then - defines { "USE_LTM" } - libtommath.import() - end - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - defines { "_LIB" } - removedefines { "_DLL", "_USRDLL" } - linkoptions { "-IGNORE:4221" } - kind "StaticLib" -end diff --git a/premake/libtommath.lua b/premake/libtommath.lua deleted file mode 100644 index 910c1873..00000000 --- a/premake/libtommath.lua +++ /dev/null @@ -1,46 +0,0 @@ -libtommath = { - settings = nil -} - -function libtommath.setup(settings) - if not settings.source then error("Missing source") end - - libtommath.settings = settings - - if not libtommath.settings.defines then libtommath.settings.defines = {} end -end - -function libtommath.import() - if not libtommath.settings then error("Run libtommath.setup first") end - - links { "libtommath" } - libtommath.includes() -end - -function libtommath.includes() - if not libtommath.settings then error("Run libtommath.setup first") end - - defines(libtommath.settings.defines) - includedirs { libtommath.settings.source } -end - -function libtommath.project() - if not libtommath.settings then error("Run libtommath.setup first") end - - project "libtommath" - language "C" - - libtommath.includes() - files - { - path.join(libtommath.settings.source, "*.c"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - defines { "_LIB" } - removedefines { "_DLL", "_USRDLL" } - linkoptions { "-IGNORE:4221" } - kind "StaticLib" -end diff --git a/premake/mongoose.lua b/premake/mongoose.lua deleted file mode 100644 index 52e39478..00000000 --- a/premake/mongoose.lua +++ /dev/null @@ -1,42 +0,0 @@ -mongoose = { - settings = nil, -} - -function mongoose.setup(settings) - if not settings.source then error("Missing source.") end - - mongoose.settings = settings -end - -function mongoose.import() - if not mongoose.settings then error("Run mongoose.setup first") end - - links { "mongoose" } - mongoose.includes() -end - -function mongoose.includes() - if not mongoose.settings then error("Run mongoose.setup first") end - - includedirs { mongoose.settings.source } -end - -function mongoose.project() - if not mongoose.settings then error("Run mongoose.setup first") end - - project "mongoose" - language "C" - - mongoose.includes() - files - { - path.join(mongoose.settings.source, "*.c"), - path.join(mongoose.settings.source, "*.h"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - -- always build as static lib, as mongoose doesn't export anything - kind "StaticLib" -end diff --git a/premake/pdcurses.lua b/premake/pdcurses.lua deleted file mode 100644 index d8a8cd6d..00000000 --- a/premake/pdcurses.lua +++ /dev/null @@ -1,48 +0,0 @@ -pdcurses = { - settings = nil, -} - -function pdcurses.setup(settings) - if not settings.source then error("Missing source.") end - - pdcurses.settings = settings -end - -function pdcurses.import() - if not pdcurses.settings then error("Run pdcurses.setup first") end - - links { "pdcurses" } - pdcurses.includes() -end - -function pdcurses.includes() - if not pdcurses.settings then error("Run pdcurses.setup first") end - - includedirs { pdcurses.settings.source } -end - -function pdcurses.project() - if not pdcurses.settings then error("Run pdcurses.setup first") end - - project "pdcurses" - language "C" - - includedirs - { - pdcurses.settings.source, - } - - files - { - path.join(pdcurses.settings.source, "pdcurses/*.c"), - path.join(pdcurses.settings.source, "pdcurses/*.h"), - path.join(pdcurses.settings.source, "wincon/*.c"), - path.join(pdcurses.settings.source, "wincon/*.h"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - -- always build as static lib, as pdcurses doesn't export anything - kind "StaticLib" -end diff --git a/premake/protobuf.lua b/premake/protobuf.lua deleted file mode 100644 index 256b1b4f..00000000 --- a/premake/protobuf.lua +++ /dev/null @@ -1,68 +0,0 @@ -protobuf = { - settings = nil, -} - -function protobuf.setup(settings) - if not settings.source then error("Missing source.") end - - protobuf.settings = settings -end - -function protobuf.import() - if not protobuf.settings then error("Run protobuf.setup first") end - - links { "protobuf" } - protobuf.includes() -end - -function protobuf.includes() - if not protobuf.settings then error("Run protobuf.setup first") end - - includedirs - { - path.join(protobuf.settings.source, "src"), - } -end - -function protobuf.project() - if not protobuf.settings then error("Run protobuf.setup first") end - - project "protobuf" - language "C++" - - includedirs - { - path.join(protobuf.settings.source, "src"), - } - files - { - path.join(protobuf.settings.source, "src/**.cc"), - "./src/**.proto", - } - removefiles - { - path.join(protobuf.settings.source, "src/**/*test.cc"), - path.join(protobuf.settings.source, "src/google/protobuf/*test*.cc"), - - path.join(protobuf.settings.source, "src/google/protobuf/testing/**.cc"), - path.join(protobuf.settings.source, "src/google/protobuf/compiler/**.cc"), - - path.join(protobuf.settings.source, "src/google/protobuf/arena_nc.cc"), - path.join(protobuf.settings.source, "src/google/protobuf/util/internal/error_listener.cc"), - path.join(protobuf.settings.source, "**/*_gcc.cc"), - } - - -- Generate source code from protobuf definitions - rules { "ProtobufCompiler" } - - -- dependencies - zlib.import() - - -- not our code, ignore POSIX usage warnings for now - defines { "_SCL_SECURE_NO_WARNINGS" } - warnings "Off" - linkoptions { "-IGNORE:4221" } - - -- always build as static lib, as we include our custom classes and therefore can't perform shared linking - kind "StaticLib" -end diff --git a/premake/udis86.lua b/premake/udis86.lua deleted file mode 100644 index 46049fbd..00000000 --- a/premake/udis86.lua +++ /dev/null @@ -1,51 +0,0 @@ -udis86 = { - settings = nil -} - -function udis86.setup(settings) - if not settings.source then error("Missing source.") end - - udis86.settings = settings - - if not udis86.settings.defines then udis86.settings.defines = {} end -end - -function udis86.import() - if not udis86.settings then error("You need to call udis86.setup first") end - - links { "udis86" } - udis86.includes() -end - -function udis86.includes() - if not udis86.settings then error("You need to call udis86.setup first") end - - includedirs - { - udis86.settings.source, - path.join(udis86.settings.source, "libudis86/"), - path.join(udis86.settings.source, "../extra/udis86/"), - path.join(udis86.settings.source, "../extra/udis86/libudis86/") - } - defines(udis86.settings.defines) -end - -function udis86.project() - if not udis86.settings then error("You need to call udis86.setup first") end - - project "udis86" - language "C" - - udis86.includes() - files - { - path.join(udis86.settings.source, "libudis86/*.h"), - path.join(udis86.settings.source, "libudis86/*.c"), - path.join(udis86.settings.source, "../extra/udis86/libudis86/*.c"), - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - kind "StaticLib" -end \ No newline at end of file diff --git a/premake/zlib.lua b/premake/zlib.lua deleted file mode 100644 index 08b55e7a..00000000 --- a/premake/zlib.lua +++ /dev/null @@ -1,48 +0,0 @@ -zlib = { - settings = nil -} - -function zlib.setup(settings) - if not settings.source then error("Missing source.") end - - zlib.settings = settings - - if not zlib.settings.defines then zlib.settings.defines = {} end -end - -function zlib.import() - if not zlib.settings then error("You need to call zlib.setup first") end - - links { "zlib" } - zlib.includes() -end - -function zlib.includes() - if not zlib.settings then error("You need to call zlib.setup first") end - - includedirs { zlib.settings.source } - defines(zlib.settings.defines) -end - -function zlib.project() - if not zlib.settings then error("You need to call zlib.setup first") end - - project "zlib" - language "C" - - zlib.includes() - files - { - path.join(zlib.settings.source, "*.h"), - path.join(zlib.settings.source, "*.c"), - } - defines - { - "_CRT_SECURE_NO_DEPRECATE", - } - - -- not our code, ignore POSIX usage warnings for now - warnings "Off" - - kind "StaticLib" -end \ No newline at end of file diff --git a/premake5.lua b/premake5.lua index 9076cd87..93fa8ce9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -3,6 +3,9 @@ gitCurrentBranchCommand = "git symbolic-ref -q --short HEAD" -- Quote the given string input as a C string function cstrquote(value) + if value == nil then + return "\"\"" + end result = value:gsub("\\", "\\\\") result = result:gsub("\"", "\\\"") result = result:gsub("\n", "\\n") @@ -27,18 +30,42 @@ function vertonumarr(value, vernumber) return vernum end --- Option to allow copying the DLL file to a custom folder after build +dependencies = { + basePath = "./deps" +} + +function dependencies.load() + dir = path.join(dependencies.basePath, "premake/*.lua") + deps = os.matchfiles(dir) + + for i, dep in pairs(deps) do + dep = dep:gsub(".lua", "") + require(dep) + end +end + +function dependencies.imports() + for i, proj in pairs(dependencies) do + if type(i) == 'number' then + proj.import() + end + end +end + +function dependencies.projects() + for i, proj in pairs(dependencies) do + if type(i) == 'number' then + proj.project() + end + end +end + newoption { trigger = "copy-to", description = "Optional, copy the DLL to a custom folder after build, define the path here if wanted.", value = "PATH" } -newoption { - trigger = "no-new-structure", - description = "Do not use new virtual path structure (separating headers and source files)." -} - newoption { trigger = "copy-pdb", description = "Copy debug information for binaries as well to the path given via --copy-to." @@ -183,81 +210,21 @@ newaction { end } -depsBasePath = "./deps" - -require "premake/json11" -require "premake/libtomcrypt" -require "premake/libtommath" -require "premake/mongoose" -require "premake/pdcurses" -require "premake/protobuf" -require "premake/zlib" -require "premake/udis86" -require "premake/dxsdk" - -json11.setup -{ - source = path.join(depsBasePath, "json11"), -} -libtomcrypt.setup -{ - defines = { - "LTC_NO_FAST", - "LTC_NO_PROTOTYPES", - "LTC_NO_RSA_BLINDING", - }, - source = path.join(depsBasePath, "libtomcrypt"), -} -libtommath.setup -{ - defines = { - "LTM_DESC", - "__STDC_IEC_559__", - }, - source = path.join(depsBasePath, "libtommath"), -} -mongoose.setup -{ - source = path.join(depsBasePath, "mongoose"), -} -pdcurses.setup -{ - source = path.join(depsBasePath, "pdcurses"), -} -protobuf.setup -{ - source = path.join(depsBasePath, "protobuf"), -} -zlib.setup -{ - defines = { - "ZLIB_CONST" - }, - source = path.join(depsBasePath, "zlib"), -} -udis86.setup -{ - source = path.join(depsBasePath, "udis86"), -} -dxsdk.setup -{ - source = path.join(depsBasePath, "dxsdk"), -} +dependencies.load() workspace "iw4x" startproject "iw4x" location "./build" objdir "%{wks.location}/obj" - targetdir "%{wks.location}/bin/%{cfg.buildcfg}" - buildlog "%{wks.location}/obj/%{cfg.architecture}/%{cfg.buildcfg}/%{prj.name}/%{prj.name}.log" + targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}" - configurations { "Debug", "Release" } + configurations {"Debug", "Release"} language "C++" cppdialect "C++17" architecture "x86" - platforms "x86" + platforms "Win32" systemversion "latest" symbols "On" @@ -266,18 +233,18 @@ workspace "iw4x" warnings "Extra" characterset "ASCII" - flags { "NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks" } + flags {"NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks"} - filter "platforms:x86" + filter "platforms:Win*" defines {"_WINDOWS", "WIN32"} filter {} filter "configurations:Release" - optimize "On" - buildoptions { "/GL" } - linkoptions { "/IGNORE:4702", "/LTCG" } - defines { "NDEBUG" } - flags { "FatalCompileWarnings", "FatalLinkWarnings" } + optimize "Size" + buildoptions {"/GL"} + linkoptions {"/IGNORE:4702", "/LTCG"} + defines {"NDEBUG"} + flags {"FatalCompileWarnings", "FatalLinkWarnings"} if not _OPTIONS["force-unit-tests"] then rtti ("Off") @@ -286,7 +253,7 @@ workspace "iw4x" filter "configurations:Debug" optimize "Debug" - defines { "DEBUG", "_DEBUG" } + defines {"DEBUG", "_DEBUG"} filter {} project "iw4x" @@ -296,7 +263,6 @@ workspace "iw4x" "./src/**.rc", "./src/**.hpp", "./src/**.cpp", - --"./src/**.proto", } includedirs { "%{prj.location}/src", @@ -312,66 +278,32 @@ workspace "iw4x" -- Debug flags if _OPTIONS["ac-disable"] then - defines { "DISABLE_ANTICHEAT" } + defines {"DISABLE_ANTICHEAT"} end if _OPTIONS["ac-debug-detections"] then - defines { "DEBUG_DETECTIONS" } + defines {"DEBUG_DETECTIONS"} end if _OPTIONS["ac-debug-load-library"] then - defines { "DEBUG_LOAD_LIBRARY" } + defines {"DEBUG_LOAD_LIBRARY"} end if _OPTIONS["force-unit-tests"] then - defines { "FORCE_UNIT_TESTS" } + defines {"FORCE_UNIT_TESTS"} end if _OPTIONS["force-minidump-upload"] then - defines { "FORCE_MINIDUMP_UPLOAD" } + defines {"FORCE_MINIDUMP_UPLOAD"} end if _OPTIONS["force-exception-handler"] then - defines { "FORCE_EXCEPTION_HANDLER" } + defines {"FORCE_EXCEPTION_HANDLER"} end if _OPTIONS["iw4x-zones"] then - defines { "GENERATE_IW4X_SPECIFIC_ZONES" } + defines {"GENERATE_IW4X_SPECIFIC_ZONES"} end -- Pre-compiled header pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives pchsource "src/STDInclude.cpp" -- real path - buildoptions { "/Zm200" } - -- Dependency libraries - json11.import() - libtomcrypt.import() - libtommath.import() - mongoose.import() - pdcurses.import() - protobuf.import() - zlib.import() - udis86.import() - dxsdk.import() - - -- fix vpaths for protobuf sources - vpaths - { - ["*"] = { "./src/**" }, - --["Proto/Generated"] = { "**.pb.*" }, -- meh. - } - - -- Virtual paths - if not _OPTIONS["no-new-structure"] then - vpaths - { - ["Headers/*"] = { "./src/**.hpp" }, - ["Sources/*"] = { "./src/**.cpp" }, - ["Resource/*"] = { "./src/**.rc" }, - --["Proto/Definitions/*"] = { "./src/Proto/**.proto" }, - --["Proto/Generated/*"] = { "**.pb.*" }, -- meh. - } - end - - vpaths - { - ["Docs/*"] = { "**.txt","**.md" }, - } + dependencies.imports() -- Pre-build prebuildcommands @@ -400,49 +332,9 @@ workspace "iw4x" } end - --[[ - -- Generate source code from protobuf definitions - rules { "ProtobufCompiler" } - -- Workaround: Consume protobuf generated source files - matches = os.matchfiles(path.join("src/Proto/**.proto")) - for i, srcPath in ipairs(matches) do - basename = path.getbasename(srcPath) - files - { - string.format("%%{prj.location}/src/proto/%s.pb.h", basename), - string.format("%%{prj.location}/src/proto/%s.pb.cc", basename), - } - end - includedirs - { - "%{prj.location}/src/proto", - } - filter "files:**.pb.*" - flags { - "NoPCH", - } - buildoptions { - "/wd4100", -- "Unused formal parameter" - "/wd4389", -- "Signed/Unsigned mismatch" - "/wd6011", -- "Dereferencing NULL pointer" - "/wd4125", -- "Decimal digit terminates octal escape sequence" - } - defines { - "_SCL_SECURE_NO_WARNINGS", - } - filter {} - ]] - - group "External dependencies" - json11.project() - libtomcrypt.project() - libtommath.project() - mongoose.project() - pdcurses.project() - protobuf.project() - zlib.project() - udis86.project() +group "External Dependencies" +dependencies.projects() rule "ProtobufCompiler" display "Protobuf compiler"