diff --git a/.gitmodules b/.gitmodules index 2af34286..9955a042 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,15 +23,12 @@ path = deps/mongoose url = https://github.com/cesanta/mongoose.git ignore = dirty -[submodule "deps/fmt"] - path = deps/fmt - url = https://github.com/fmtlib/fmt.git -[submodule "deps/Wink-Signals"] - path = deps/Wink-Signals - url = https://github.com/miguelmartin75/Wink-Signals.git +[submodule "deps/fmt"] + path = deps/fmt + url = https://github.com/fmtlib/fmt.git +[submodule "deps/Wink-Signals"] + path = deps/Wink-Signals + url = https://github.com/miguelmartin75/Wink-Signals.git [submodule "deps/bitmrc"] - path = deps/bitmrc - url = https://github.com/mrc-g/BitMRC.git -[submodule "deps/libcryptopp"] - path = deps/libcryptopp - url = https://github.com/weidai11/cryptopp.git + path = deps/bitmrc + url = https://github.com/mrc-g/BitMRC.git diff --git a/deps/libcryptopp b/deps/libcryptopp deleted file mode 160000 index 65e91a8c..00000000 --- a/deps/libcryptopp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 65e91a8caa8c1846cb311bc83d8507e12699d6d3 diff --git a/premake/libcryptopp.lua b/premake/libcryptopp.lua index fea7ec83..9d7fff45 100644 --- a/premake/libcryptopp.lua +++ b/premake/libcryptopp.lua @@ -17,33 +17,121 @@ end function libcryptopp.includes() if not libcryptopp.settings then error("Run libcryptopp.setup first") end - includedirs { libcryptopp.settings.source } + filter "Debug*" + defines { "_DEBUG" } + + filter "Release*" + defines { "NDEBUG" } + + filter "system:windows" + defines { "_WINDOWS", "WIN32" } + filter {} + + includedirs { libcryptopp.settings.source } end function libcryptopp.project() if not libcryptopp.settings then error("Run libcryptopp.setup first") end + externalrule "MASM" + buildmessage "Building and assembling %(Identity)..." + propertydefinition { + name = "PreprocessorDefinitions", + kind = "string", + value = "", + switch = "/D", + } + propertydefinition { + name = "UseSafeExceptionHandlers", + kind = "boolean", + value = false, + switch = "/safeseh", + } + + --[[ + rule "CustomProtoBuildTool" + display "C++ prototype copy" + location "./build" + fileExtension ".proto" + buildmessage "Preparing %(Identity)..." + buildcommands { + 'if not exist "$(ProjectDir)\\src\\%(Filename)" copy "%(Identity)" "$(ProjectDir)\\src\\%(Filename)"', + 'echo: >> "src\\%(Filename).copied"', + } + buildoutputs { + '$(ProjectDir)\\src\\%(Filename)', + } + ]] + project "libcryptopp" language "C++" + characterset "MBCS" + defines { + "USE_PRECOMPILED_HEADERS" + } includedirs { - libcryptopp.settings.source + libcryptopp.settings.source, } files { - path.join(libcryptopp.settings.source, "src/**.cpp"), - } - removefiles - { - path.join(libcryptopp.settings.source, "TestData/**"), - path.join(libcryptopp.settings.source, "TestVectors/**"), + path.join(libcryptopp.settings.source, "*.cpp"), + --path.join(libcryptopp.settings.source, "*.cpp.proto"), + path.join(libcryptopp.settings.source, "*.h"), + path.join(libcryptopp.settings.source, "*.txt"), } - -- not our code, ignore POSIX usage warnings for now + removefiles { + path.join(libcryptopp.settings.source, "eccrypto.cpp"), + path.join(libcryptopp.settings.source, "eprecomp.cpp"), + path.join(libcryptopp.settings.source, "bench*"), + path.join(libcryptopp.settings.source, "*test.*"), + path.join(libcryptopp.settings.source, "fipsalgt.*"), + path.join(libcryptopp.settings.source, "cryptlib_bds.*"), + path.join(libcryptopp.settings.source, "validat*.*"), + } + + -- Pre-compiled header + pchheader "pch.h" -- must be exactly same as used in #include directives + pchsource(path.join(libcryptopp.settings.source, "pch.cpp")) -- real path + defines { "_SCL_SECURE_NO_WARNINGS" } warnings "Off" - -- always build as static lib, as we include our custom classes and therefore can't perform shared linking - kind "StaticLib" + vectorextensions "SSE" + + rules { + "MASM", + --"CustomProtoBuildTool", + } + + kind "SharedLib" + filter "*Static" + kind "StaticLib" + + filter "kind:SharedLib" + defines { "CRYPTOPP_IMPORTS" } + + filter "architecture:x86" + exceptionhandling "SEH" + masmVars { + UseSafeExceptionHandlers = true, + PreprocessorDefinitions = "_M_X86", + } + filter "architecture:x64" + files { + path.join(libcryptopp.settings.source, "x64masm.asm"), + } + masmVars { + PreprocessorDefinitions = "_M_X64", + } + filter { "architecture:x64", "kind:SharedLib" } + files { + path.join(libcryptopp.settings.source, "x64dll.asm"), + } + + filter("files:" .. path.join(libcryptopp.settings.source, "dll.cpp") + .. " or files:" .. path.join(libcryptopp.settings.source, "iterhash.cpp")) + flags { "NoPCH" } end diff --git a/premake5.lua b/premake5.lua index c1dc70a3..f582e8ba 100644 --- a/premake5.lua +++ b/premake5.lua @@ -137,6 +137,10 @@ require "premake/zlib" require "premake/libcryptopp" require "premake/bitmrc" +bitmrc.setup +{ + source = path.join(depsBasePath, "bitmrc"), +} fmt.setup { source = path.join(depsBasePath, "fmt"), @@ -145,6 +149,10 @@ json11.setup { source = path.join(depsBasePath, "json11"), } +libcryptopp.setup +{ + source = path.join(depsBasePath, "bitmrc/libcryptopp"), +} libtomcrypt.setup { defines = { @@ -184,14 +192,6 @@ zlib.setup }, source = path.join(depsBasePath, "zlib"), } -libcryptopp.setup -{ - source = path.join(depsBasePath, "libcryptopp"), -} -bitmrc.setup -{ - source = path.join(depsBasePath, "bitmrc"), -} workspace "iw4x" location "./build"