diff --git a/.gitignore b/.gitignore index fb368465..329e4813 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,7 @@ ipch/* .vs/ bin/ -lib/ +obj/ local/ gen/ -obj/ -packages/ -TestResults/ \ No newline at end of file +build/ \ No newline at end of file diff --git a/generate.bat b/generate.bat new file mode 100644 index 00000000..f87f5c38 --- /dev/null +++ b/generate.bat @@ -0,0 +1 @@ +tools\premake5 vs2019 \ No newline at end of file diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 00000000..14f2bdf7 --- /dev/null +++ b/premake5.lua @@ -0,0 +1,86 @@ +-- Functions for locating commonly used folders +local _ThirdPartyFolder = path.getabsolute("thirdparty") +function ThirdPartyFolder() + return path.getrelative(os.getcwd(), _ThirdPartyFolder) +end + +local _ProjectFolder = path.getabsolute("src") +function ProjectFolder() + return path.getrelative(os.getcwd(), _ProjectFolder) +end + +local _TestFolder = path.getabsolute("test") +function TestFolder() + return path.getrelative(os.getcwd(), _TestFolder) +end + +-- Target Directories +TargetDirectoryBin = "%{wks.location}/bin/%{cfg.buildcfg}_%{cfg.platform}" +TargetDirectoryLib = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}" +TargetDirectoryTest = "%{wks.location}/lib/%{cfg.buildcfg}_%{cfg.platform}/tests" + +-- ================== +-- Workspace +-- ================== +workspace "OpenAssetTools" + location "build" + objdir "%{wks.location}/obj" + symbols "On" + systemversion "latest" + + flags { + "MultiProcessorCompile" + } + + configurations { + "Debug", + "Release" + } + + platforms { + "x86", + "x64" + } + + filter "platforms:x86" + architecture "x86" + defines "ARCH_x86" + filter {} + + filter "platforms:x64" + architecture "x86_64" + defines "ARCH_x64" + filter {} + + filter "configurations:Debug" + defines "_DEBUG" + optimize "Debug" + filter {} + + filter "configurations:Release" + defines "NDEBUG" + optimize "Full" + flags { + "FatalWarnings" + } + filter {} + +-- ======================== +-- ThirdParty +-- ======================== + +include "thirdparty/libtomcrypt.lua" +include "thirdparty/libtommath.lua" +include "thirdparty/salsa20.lua" +include "thirdparty/zlib.lua" + +-- All projects here should be in the thirdparty folder +group "thirdparty" + +libtommath:project() +libtomcrypt:project() +salsa20:project() +zlib:project() + +-- Reset group +group "" \ No newline at end of file diff --git a/thirdparty/libtomcrypt.lua b/thirdparty/libtomcrypt.lua new file mode 100644 index 00000000..ea414513 --- /dev/null +++ b/thirdparty/libtomcrypt.lua @@ -0,0 +1,43 @@ +libtomcrypt = {} + +function libtomcrypt:include() + includedirs { + path.join(ThirdPartyFolder(), "libtomcrypt/src/headers") + } +end + +function libtomcrypt:link() + self:include() + links { + "libtomcrypt" + } +end + +function libtomcrypt:project() + local folder = ThirdPartyFolder(); + + project "libtomcrypt" + targetdir(TargetDirectoryLib) + location "%{wks.location}/thirdparty" + kind "StaticLib" + language "C" + + files { + path.join(folder, "libtomcrypt/src/**.h"), + path.join(folder, "libtomcrypt/src/**.c") + } + + defines { + "_CRT_SECURE_NO_WARNINGS", + "_CRT_NONSTDC_NO_DEPRECATE", + "LTC_SOURCE", + "LTC_NO_TEST", + "LTC_NO_PROTOTYPES" + } + + self:include() + libtommath:include() + + -- Disable warnings. They do not have any value to us since it is not our code. + warnings "off" +end diff --git a/thirdparty/libtommath.lua b/thirdparty/libtommath.lua new file mode 100644 index 00000000..e7d67f75 --- /dev/null +++ b/thirdparty/libtommath.lua @@ -0,0 +1,34 @@ +libtommath = {} + +function libtommath:include() + includedirs { + path.join(ThirdPartyFolder(), "libtommath") + } +end + +function libtommath:link() + self:include() + links { + "libtommath" + } +end + +function libtommath:project() + local folder = ThirdPartyFolder(); + + project "libtommath" + targetdir(TargetDirectoryLib) + location "%{wks.location}/thirdparty" + kind "StaticLib" + language "C" + + files { + path.join(folder, "libtommath/*.h"), + path.join(folder, "libtommath/*.c") + } + + self:include() + + -- Disable warnings. They do not have any value to us since it is not our code. + warnings "off" +end diff --git a/thirdparty/salsa20.lua b/thirdparty/salsa20.lua new file mode 100644 index 00000000..19d758bd --- /dev/null +++ b/thirdparty/salsa20.lua @@ -0,0 +1,34 @@ +salsa20 = {} + +function salsa20:include() + includedirs { + path.join(ThirdPartyFolder(), "salsa20") + } +end + +function salsa20:link() + self:include() + links { + "salsa20" + } +end + +function salsa20:project() + local folder = ThirdPartyFolder(); + + project "salsa20" + targetdir(TargetDirectoryLib) + location "%{wks.location}/thirdparty" + kind "StaticLib" + language "C" + + files { + path.join(folder, "salsa20/*.h"), + path.join(folder, "salsa20/*.c") + } + + self:include() + + -- Disable warnings. They do not have any value to us since it is not our code. + warnings "off" +end diff --git a/thirdparty/zlib.lua b/thirdparty/zlib.lua new file mode 100644 index 00000000..2547d5cb --- /dev/null +++ b/thirdparty/zlib.lua @@ -0,0 +1,39 @@ +zlib = {} + +function zlib:include() + includedirs { + path.join(ThirdPartyFolder(), "zlib") + } +end + +function zlib:link() + self:include() + links { + "zlib" + } +end + +function zlib:project() + local folder = ThirdPartyFolder(); + + project "zlib" + targetdir(TargetDirectoryLib) + location "%{wks.location}/thirdparty" + kind "StaticLib" + language "C" + + files { + path.join(folder, "zlib/*.h"), + path.join(folder, "zlib/*.c") + } + + defines { + "_CRT_SECURE_NO_WARNINGS", + "_CRT_NONSTDC_NO_DEPRECATE" + } + + self:include() + + -- Disable warnings. They do not have any value to us since it is not our code. + warnings "off" +end diff --git a/tools/premake5.exe b/tools/premake5.exe new file mode 100644 index 00000000..9048d51e Binary files /dev/null and b/tools/premake5.exe differ