CI: fix windows build

This commit is contained in:
Markus F.X.J. Oberhumer 2023-01-05 02:29:12 +01:00
parent 72f31787f6
commit 9f00515da4
3 changed files with 60 additions and 38 deletions

View File

@ -286,7 +286,7 @@ jobs:
set s=%H%\src
cat .GITREV.txt
set /p GITREV=<.GITREV.txt
cl -std:c++17 -Zc:__cplusplus -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -I%H%\vendor -Feupx.exe %s%\*.cpp %s%\util\*.cpp %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
cl -std:c++17 -Zc:__cplusplus -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -I%H%\vendor -I%H%\vendor\boost-pfr\include -Feupx.exe %s%\*.cpp %s%\util\*.cpp %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
- name: 'Make artifact'
shell: bash
run: |

View File

@ -743,8 +743,6 @@ struct upx_compress_result_t
// globals
**************************************************************************/
#include "util/snprintf.h" // must get included first!
#include <exception>
#include <new>
#include <type_traits>
@ -757,7 +755,11 @@ struct upx_compress_result_t
#include <atomic>
#define upx_std_atomic(Type) std::atomic<Type>
#endif
#if WITH_BOOST_PFR
#include <sstream>
#endif
#include "util/snprintf.h" // must get included first!
#include "options.h"
#include "except.h"
#include "bele.h"
@ -775,37 +777,6 @@ unsigned membuffer_get_size(MemBuffer &mb);
#include "util/xspan.h"
//#define DOCTEST_CONFIG_DISABLE 1
#include <doctest/doctest/parts/doctest_fwd.h>
#if WITH_BOOST_PFR
#include <boost/pfr/io.hpp>
template <class A>
__acc_noinline std::string pfr_str(const A &a) {
std::ostringstream ss;
ss << boost::pfr::io(a);
return ss.str();
}
template <class A, class B>
__acc_noinline std::string pfr_str(const A &a, const B &b) {
std::ostringstream ss;
ss << boost::pfr::io(a);
ss << ' ';
ss << boost::pfr::io(b);
return ss.str();
}
template <class A, class B, class C>
__acc_noinline std::string pfr_str(const A &a, const B &b, const C &c) {
std::ostringstream ss;
ss << boost::pfr::io(a);
ss << ' ';
ss << boost::pfr::io(b);
ss << ' ';
ss << boost::pfr::io(c);
return ss.str();
}
#endif // WITH_BOOST_PFR
// util/dt_check.cpp
void upx_compiler_sanity_check();
int upx_doctest_check();
@ -865,6 +836,57 @@ int upx_test_overlap ( const upx_bytep buf,
int method,
const upx_compress_result_t *cresult );
/*************************************************************************
//
**************************************************************************/
//#define DOCTEST_CONFIG_DISABLE 1
#include <doctest/doctest/parts/doctest_fwd.h>
#if WITH_BOOST_PFR
#include <boost/pfr/io.hpp>
template <class A>
__acc_noinline std::string pfr_string(const A &a) {
std::ostringstream ss;
ss << boost::pfr::io(a);
return ss.str();
}
template <class A, class B>
__acc_noinline std::string pfr_string(const A &a, const B &b) {
std::ostringstream ss;
ss << boost::pfr::io(a);
ss << ' ';
ss << boost::pfr::io(b);
return ss.str();
}
template <class A, class B, class C>
__acc_noinline std::string pfr_string(const A &a, const B &b, const C &c) {
std::ostringstream ss;
ss << boost::pfr::io(a);
ss << ' ';
ss << boost::pfr::io(b);
ss << ' ';
ss << boost::pfr::io(c);
return ss.str();
}
template <class A, class B, class C, class D>
__acc_noinline std::string pfr_string(const A &a, const B &b, const C &c, const D &d) {
std::ostringstream ss;
ss << boost::pfr::io(a);
ss << ' ';
ss << boost::pfr::io(b);
ss << ' ';
ss << boost::pfr::io(c);
ss << ' ';
ss << boost::pfr::io(d);
return ss.str();
}
// note: this MUST be a macro and not a function because of implicit temporary variable
#define pfr_str(a,...) (pfr_string(a, ##__VA_ARGS__).c_str())
#endif // WITH_BOOST_PFR
/*************************************************************************
// raw_bytes() - get underlying memory from checked buffers/pointers.
// This is overloaded by various utility classes like BoundedPtr,

View File

@ -456,13 +456,13 @@ TEST_CASE("libc snprintf") {
#if WITH_BOOST_PFR
TEST_CASE("Boost.PFR") {
int i = -1;
CHECK_EQ(strcmp(pfr_str(i).c_str(), "-1"), 0);
CHECK_EQ(strcmp(pfr_str(i), "-1"), 0);
BE32 b32;
b32 = 1;
LE32 l32;
l32 = 2;
CHECK_EQ(strcmp(pfr_str(b32).c_str(), "1"), 0);
CHECK_EQ(strcmp(pfr_str(l32).c_str(), "2"), 0);
CHECK_EQ(strcmp(pfr_str(b32), "1"), 0);
CHECK_EQ(strcmp(pfr_str(l32), "2"), 0);
struct Foo {
BE16 b16;
BE32 b32;
@ -478,7 +478,7 @@ TEST_CASE("Boost.PFR") {
foo.l16 = 4;
foo.l32 = 5;
foo.l64 = 6;
CHECK_EQ(strcmp(pfr_str("foo", "=", foo).c_str(), "foo = {1, 2, 3, 4, 5, 6}"), 0);
CHECK_EQ(strcmp(pfr_str("foo", "=", foo), "foo = {1, 2, 3, 4, 5, 6}"), 0);
}
#endif // WITH_BOOST_PFR