chore(cpn): build for Windows with Visual Studio (#6476)
This commit is contained in:
@@ -21,8 +21,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "popups.h"
|
||||
|
||||
|
||||
enum BluetoothStates {
|
||||
#if defined(PCBX9E)
|
||||
BLUETOOTH_INIT,
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <keys.h>
|
||||
|
||||
#define MESSAGEBOX_X 8
|
||||
#define MESSAGEBOX_Y 8
|
||||
#define MESSAGEBOX_W (LCD_W - 15)
|
||||
@@ -44,4 +42,4 @@ enum {
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
|
||||
#include "../common/stdlcd/popups.h"
|
||||
#include "common/stdlcd/popups_common.h"
|
||||
|
||||
@@ -42,4 +42,4 @@ enum {
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
|
||||
#include "../common/stdlcd/popups.h"
|
||||
#include "common/stdlcd/popups_common.h"
|
||||
|
||||
@@ -27,8 +27,11 @@
|
||||
#include "libopenui_defines.h"
|
||||
#include "lz4_fonts.h"
|
||||
|
||||
|
||||
#if !defined(BOOT)
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern const etxLz4Font lv_font_en_bold_XXL;
|
||||
|
||||
#define FONT_TABLE(name) \
|
||||
@@ -74,6 +77,8 @@ FONT_TABLE(ua);
|
||||
FONT_TABLE(en);
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
/*
|
||||
Decompress an LZ4 font and build LVGL font structures.
|
||||
*/
|
||||
|
||||
@@ -185,6 +185,5 @@ void LayoutFactory::disposeCustomScreen(unsigned idx)
|
||||
LayoutFactory::LayoutFactory(const char* id, const char* name) :
|
||||
id(id), name(name)
|
||||
{
|
||||
TRACE("register layout %s", getId());
|
||||
getRegisteredLayouts().push_back(this);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,6 @@ std::list<const WidgetFactory*>& WidgetFactory::getRegisteredWidgets()
|
||||
|
||||
void WidgetFactory::unregisterWidget(const WidgetFactory* factory)
|
||||
{
|
||||
TRACE("unregister widget %s", factory->getName());
|
||||
getRegisteredWidgets().remove(factory);
|
||||
}
|
||||
|
||||
@@ -226,7 +225,6 @@ void WidgetFactory::registerWidget(const WidgetFactory* factory)
|
||||
if (oldWidget) {
|
||||
unregisterWidget(oldWidget);
|
||||
}
|
||||
TRACE("register widget %s %s", name, factory->getDisplayName());
|
||||
for (auto it = getRegisteredWidgets().cbegin();
|
||||
it != getRegisteredWidgets().cend(); ++it) {
|
||||
if (strcasecmp((*it)->getDisplayName(), factory->getDisplayName()) > 0) {
|
||||
|
||||
@@ -27,17 +27,10 @@
|
||||
|
||||
#define LEN_ZONE_OPTION_STRING 12
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define OPTION_VALUE_UNSIGNED(x) { uint32_t(x) }
|
||||
#define OPTION_VALUE_SIGNED(x) { int32_t(x) }
|
||||
#define OPTION_VALUE_BOOL(x) { bool(x) }
|
||||
#define OPTION_VALUE_STRING(...) { *(ZoneOptionValue *)(const char *) #__VA_ARGS__ }
|
||||
#else
|
||||
#define OPTION_VALUE_UNSIGNED(x) ZoneOptionValue{ .unsignedValue = (x) }
|
||||
#define OPTION_VALUE_SIGNED(x) ZoneOptionValue{ .signedValue = (x) }
|
||||
#define OPTION_VALUE_BOOL(x) ZoneOptionValue{ .boolValue = (x) }
|
||||
#define OPTION_VALUE_STRING(...) ZoneOptionValue{ .stringValue = { __VA_ARGS__ } }
|
||||
#endif
|
||||
#define OPTION_VALUE_UNSIGNED(x) ZoneOptionValue{ .unsignedValue = (x) }
|
||||
#define OPTION_VALUE_SIGNED(x) ZoneOptionValue{ .signedValue = (x) }
|
||||
#define OPTION_VALUE_BOOL(x) ZoneOptionValue{ .boolValue = (x) }
|
||||
#define OPTION_VALUE_STRING(...) ZoneOptionValue{ .stringValue = { __VA_ARGS__ } }
|
||||
|
||||
union ZoneOptionValue
|
||||
{
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
#include "dma2d.h"
|
||||
#include "lua/lua_event.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
lua_State *lsStandalone = nullptr;
|
||||
|
||||
#if defined(LUA_ALLOCATOR_TRACER)
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
#include <cinttypes>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
const char * getFileExtension(const char * filename, uint8_t size, uint8_t extMaxLen, uint8_t * fnlen, uint8_t * extlen)
|
||||
{
|
||||
int len = size;
|
||||
|
||||
@@ -29,7 +29,12 @@ bool isExtensionMatching(const char * extension, const char * pattern, char * ma
|
||||
FRESULT sdReadDir(DIR * dir, FILINFO * fno, bool & firstTime);
|
||||
|
||||
// comparison, not case sensitive.
|
||||
inline bool compare_nocase(const std::string & first, const std::string & second)
|
||||
{
|
||||
return strcasecmp(first.c_str(), second.c_str()) < 0;
|
||||
static inline bool compare_nocase(const std::string& first, const std::string& second) {
|
||||
return std::lexicographical_compare(
|
||||
first.begin(), first.end(),
|
||||
second.begin(), second.end(),
|
||||
[](unsigned char a, unsigned char b) {
|
||||
return std::tolower(a) < std::tolower(b);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LABELS
|
||||
#define TRACE_LABELS_YAML(...) TRACE(__VA_ARGS__)
|
||||
#else
|
||||
|
||||
@@ -21,37 +21,35 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "yaml_parser.h"
|
||||
|
||||
#define NODE_STACK_DEPTH 12
|
||||
|
||||
enum YamlDataType {
|
||||
YDT_NONE=0,
|
||||
YDT_IDX,
|
||||
YDT_SIGNED,
|
||||
YDT_UNSIGNED,
|
||||
YDT_STRING,
|
||||
YDT_ARRAY,
|
||||
YDT_ENUM,
|
||||
YDT_UNION,
|
||||
YDT_PADDING,
|
||||
YDT_CUSTOM
|
||||
YDT_NONE = 0,
|
||||
YDT_IDX,
|
||||
YDT_SIGNED,
|
||||
YDT_UNSIGNED,
|
||||
YDT_STRING,
|
||||
YDT_ARRAY,
|
||||
YDT_ENUM,
|
||||
YDT_UNION,
|
||||
YDT_PADDING,
|
||||
YDT_CUSTOM
|
||||
};
|
||||
|
||||
PACK_NOT_SIMU(struct YamlIdStr
|
||||
{
|
||||
int16_t id;
|
||||
const char* str;
|
||||
PACK_NOT_SIMU(struct YamlIdStr {
|
||||
int16_t id;
|
||||
const char* str;
|
||||
});
|
||||
|
||||
// return false if error
|
||||
typedef bool (*yaml_writer_func)(void* opaque, const char* str, size_t len);
|
||||
|
||||
struct YamlNode
|
||||
{
|
||||
struct YamlNode {
|
||||
typedef bool (*is_active_func)(void* user, uint8_t* data, uint32_t bitoffs);
|
||||
|
||||
typedef uint32_t (*cust_to_uint_func)(const YamlNode* node, const char* val,
|
||||
@@ -74,8 +72,8 @@ struct YamlNode
|
||||
yaml_writer_func wf, void* opaque);
|
||||
|
||||
uint16_t size; // bits
|
||||
uint8_t type:4;
|
||||
uint16_t elmts:12; // maximum number of array elements
|
||||
uint8_t type : 4;
|
||||
uint16_t elmts : 12; // maximum number of array elements
|
||||
const char* tag;
|
||||
union {
|
||||
struct {
|
||||
@@ -110,103 +108,85 @@ struct YamlNode
|
||||
uint8_t tag_len() const { return tag ? strlen(tag) : 0; }
|
||||
};
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#define YAML_TAG(str) .tag = (str)
|
||||
|
||||
#define YAML_TAG(str) \
|
||||
.tag=(str)
|
||||
#define YAML_IDX {.size = 0, .type = YDT_IDX, .elmts = 0, YAML_TAG("idx")}
|
||||
|
||||
#define YAML_IDX \
|
||||
{ .size=0, .type=YDT_IDX, .elmts=0, YAML_TAG("idx") }
|
||||
#define YAML_IDX_CUST(tag, f_read, f_write) \
|
||||
{ \
|
||||
.size = 0, .type = YDT_IDX, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._cust_idx = {.read = (f_read), .write = (f_write)} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_IDX_CUST(tag, f_read, f_write) \
|
||||
{ .size=0, .type=YDT_IDX, .elmts=0, YAML_TAG(tag), .u={._cust_idx={.read=(f_read), .write=(f_write) }} }
|
||||
#define YAML_SIGNED(tag, bits) \
|
||||
{.size = (bits), .type = YDT_SIGNED, .elmts = 0, YAML_TAG(tag)}
|
||||
|
||||
#define YAML_SIGNED(tag, bits) \
|
||||
{ .size=(bits), .type=YDT_SIGNED, .elmts=0, YAML_TAG(tag) }
|
||||
#define YAML_UNSIGNED(tag, bits) \
|
||||
{.size = (bits), .type = YDT_UNSIGNED, .elmts = 0, YAML_TAG(tag)}
|
||||
|
||||
#define YAML_UNSIGNED(tag, bits) \
|
||||
{ .size=(bits), .type=YDT_UNSIGNED, .elmts=0, YAML_TAG(tag) }
|
||||
#define YAML_SIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_SIGNED, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._cust = {.cust_to_uint = f_cust_to_uint, \
|
||||
.uint_to_cust = f_uint_to_cust} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_SIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ .size=(bits), .type=YDT_SIGNED, .elmts=0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} }
|
||||
#define YAML_UNSIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_UNSIGNED, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._cust = {.cust_to_uint = f_cust_to_uint, \
|
||||
.uint_to_cust = f_uint_to_cust} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_UNSIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ .size=(bits), .type=YDT_UNSIGNED, .elmts=0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} }
|
||||
#define YAML_STRING(tag, max_len) \
|
||||
{.size = ((max_len) << 3), .type = YDT_STRING, .elmts = 0, YAML_TAG(tag)}
|
||||
|
||||
#define YAML_STRING(tag, max_len) \
|
||||
{ .size=((max_len)<<3), .type=YDT_STRING, .elmts=0, YAML_TAG(tag) }
|
||||
#define YAML_STRUCT(tag, bits, nodes, f_is_active) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_ARRAY, .elmts = 1, YAML_TAG(tag), .u = { \
|
||||
._array = {.child = (nodes), .u = {.is_active = (f_is_active)}} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_STRUCT(tag, bits, nodes, f_is_active) \
|
||||
{ .size=(bits), .type=YDT_ARRAY, .elmts=1, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} }
|
||||
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_ARRAY, .elmts = (max_elmts), YAML_TAG(tag), \
|
||||
.u = { \
|
||||
._array = {.child = (nodes), .u = {.is_active = (f_is_active)}} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
||||
{ .size=(bits), .type=YDT_ARRAY, .elmts=(max_elmts), YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} }
|
||||
#define YAML_ENUM(tag, bits, id_strs, f_is_active) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_ENUM, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._enum = {.choices = (id_strs), .is_active = (f_is_active)} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_ENUM(tag, bits, id_strs, f_is_active) \
|
||||
{ .size=(bits), .type=YDT_ENUM, .elmts=0, YAML_TAG(tag), .u={._enum={ .choices=(id_strs), .is_active=(f_is_active) }} }
|
||||
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
||||
{ \
|
||||
.size = (bits), .type = YDT_UNION, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._array = {.child = (nodes), .u = {.select_member = (f_sel_m)}} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
||||
{ .size=(bits), .type=YDT_UNION, .elmts=0, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.select_member=(f_sel_m) }}} }
|
||||
#define YAML_PADDING(bits) {.size = (bits), .type = YDT_PADDING}
|
||||
|
||||
#define YAML_PADDING(bits) \
|
||||
{ .size=(bits), .type=YDT_PADDING }
|
||||
#define YAML_CUSTOM(tag, f_read, f_write) \
|
||||
{ \
|
||||
.size = 0, .type = YDT_CUSTOM, .elmts = 0, YAML_TAG(tag), .u = { \
|
||||
._cust_attr = {.read = (f_read), .write = (f_write)} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define YAML_CUSTOM(tag, f_read, f_write) \
|
||||
{ .size=0, .type=YDT_CUSTOM, .elmts=0, YAML_TAG(tag), .u={._cust_attr={.read=(f_read), .write=(f_write) }} }
|
||||
#define YAML_END {.size = 0, .type = YDT_NONE}
|
||||
|
||||
#define YAML_END \
|
||||
{ .size=0, .type=YDT_NONE }
|
||||
|
||||
#define YAML_ROOT(nodes) \
|
||||
{ .size=0, .type=YDT_ARRAY, .elmts=1, .tag=NULL, \
|
||||
.u={ \
|
||||
._array={ .child=(nodes), \
|
||||
.u={.is_active=NULL} \
|
||||
}} \
|
||||
}
|
||||
|
||||
#else // MSVC++ compat
|
||||
|
||||
#define YAML_TAG(str) \
|
||||
(str)
|
||||
|
||||
#define YAML_IDX \
|
||||
{ 0, YDT_IDX, .elmts=0, YAML_TAG("idx") }
|
||||
|
||||
#define YAML_SIGNED(tag, bits) \
|
||||
{ (bits), YDT_SIGNED, .elmts=0, YAML_TAG(tag) }
|
||||
|
||||
#define YAML_UNSIGNED(tag, bits) \
|
||||
{ (bits), YDT_UNSIGNED, .elmts=0, YAML_TAG(tag) }
|
||||
|
||||
#define YAML_SIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ (bits), YDT_SIGNED, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0 }}}} }
|
||||
|
||||
#define YAML_UNSIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \
|
||||
{ (bits), YDT_UNSIGNED, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0}}}} }
|
||||
|
||||
#define YAML_STRING(tag, max_len) \
|
||||
{ ((max_len)<<3), YDT_STRING, .elmts=0, YAML_TAG(tag) }
|
||||
|
||||
#define YAML_STRUCT(tag, bits, nodes, f_is_active) \
|
||||
{ (bits), YDT_ARRAY, 1, YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} }
|
||||
|
||||
#define YAML_ARRAY(tag, bits, max_elmts, nodes, f_is_active) \
|
||||
{ (bits), YDT_ARRAY, (max_elmts), YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} }
|
||||
|
||||
#define YAML_ENUM(tag, bits, id_strs, f_is_active) \
|
||||
{ (bits), YDT_ENUM, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)(id_strs, {{ (f_is_active) }}) }} }
|
||||
|
||||
#define YAML_UNION(tag, bits, nodes, f_sel_m) \
|
||||
{ (bits), YDT_UNION, .elmts=0, YAML_TAG(tag), {{ (nodes), {{ (YamlNode::is_active_func)(f_sel_m) }}}} }
|
||||
|
||||
#define YAML_PADDING(bits) \
|
||||
{ (bits), YDT_PADDING }
|
||||
|
||||
#define YAML_END \
|
||||
{ 0, YDT_NONE }
|
||||
|
||||
#define YAML_ROOT(nodes) \
|
||||
{ 0, YDT_ARRAY, 1, NULL, {{ (nodes), {{ NULL }}}} }
|
||||
|
||||
#endif
|
||||
#define YAML_ROOT(nodes) \
|
||||
{ \
|
||||
.size = 0, .type = YDT_ARRAY, .elmts = 1, .tag = NULL, .u = { \
|
||||
._array = {.child = (nodes), .u = {.is_active = NULL}} \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -174,6 +174,11 @@ void clearStruct(S &s)
|
||||
memset((void *)&s, 0, sizeof(S));
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#endif
|
||||
|
||||
template <size_t N>
|
||||
using offset_t = std::integral_constant<size_t, N>;
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ if(Qt6Widgets_FOUND)
|
||||
list(APPEND SIMULATOR_SRC ${SIMU_SRC} opentxsimulator.cpp)
|
||||
|
||||
add_library(${SIMULATOR_TARGET} SHARED ${SIMULATOR_SRC})
|
||||
set_target_properties(${SIMULATOR_TARGET} PROPERTIES PREFIX "lib")
|
||||
|
||||
if(TARGET SDL2::SDL2)
|
||||
set(SDL2_LIBRARIES SDL2::SDL2)
|
||||
|
||||
Reference in New Issue
Block a user