Update catch2 version

This commit is contained in:
Jan
2023-06-18 13:39:40 +02:00
parent 34cdd46b42
commit 6c164eee61
31 changed files with 128 additions and 46 deletions

65
thirdparty/catch2.lua vendored
View File

@ -3,12 +3,14 @@ catch2 = {}
function catch2:include(includes)
if includes:handle(self:name()) then
includedirs {
path.join(ThirdPartyFolder(), "catch2", "single_include")
path.join(ThirdPartyFolder(), "catch2", "src"),
"%{wks.location}/thirdparty/catch2"
}
end
end
function catch2:link()
function catch2:link(links)
links:add(self:name())
end
function catch2:use()
@ -20,4 +22,63 @@ function catch2:name()
end
function catch2:project()
local folder = ThirdPartyFolder()
local includes = Includes:create()
self:writeUserConfig()
project(self:name())
targetdir(TargetDirectoryLib)
location "%{wks.location}/thirdparty/%{prj.name}"
kind "StaticLib"
language "C++"
files {
path.join(folder, "catch2/src/**.cpp"),
path.join(folder, "catch2/src/**.hpp"),
"%{wks.location}/thirdparty/%{prj.name}/**.cpp",
"%{wks.location}/thirdparty/%{prj.name}/**.hpp"
}
vpaths {
["*"] = {
path.join(folder, "catch2/src"),
"%{wks.location}/thirdparty/%{prj.name}"
}
}
defines {
"DO_NOT_USE_WMAIN",
"_CRT_SECURE_NO_WARNINGS"
}
self:include(includes)
-- Disable warnings. They do not have any value to us since it is not our code.
warnings "off"
end
function catch2:writeUserConfig()
local folder = ThirdPartyFolder()
local inputFileName = path.join(folder, "catch2/src/catch2/catch_user_config.hpp.in")
local outputFileName = path.getabsolute("build/thirdparty/catch2/catch2/catch_user_config.hpp")
local inputInfo = os.stat(inputFileName)
local outputInfo = os.stat(outputFileName)
if inputInfo == nil then
return
end
if outputInfo ~= nil and inputInfo.mtime <= outputInfo.mtime then
return
end
local fileData = io.readfile(inputFileName)
fileData = string.gsub(fileData, '#cmakedefine[^\n]*', '')
fileData = string.gsub(fileData, '@CATCH_CONFIG_CONSOLE_WIDTH@', '80')
fileData = string.gsub(fileData, '@CATCH_CONFIG_DEFAULT_REPORTER@', 'console')
os.mkdir(path.getdirectory(outputFileName))
os.writefile_ifnotequal(fileData, outputFileName)
end