chore(cpn): build for Windows with Visual Studio (#6476)
This commit is contained in:
@@ -23,11 +23,13 @@ on:
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
CMAKE_GENERATOR: "MSYS Makefiles"
|
||||
CMAKE_BUILD_TYPE: "Release"
|
||||
CMAKE_GENERATOR: "Ninja"
|
||||
QT_VERSION: "6.9.0"
|
||||
MINGW_VERSION: "win64_mingw"
|
||||
MINGW_PATH: "mingw_64"
|
||||
QT_ARCH: "win64_msvc2022_64"
|
||||
SDL_VERSION: "2.32.8"
|
||||
CXX: "clang++"
|
||||
CC: "clang"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -38,26 +40,9 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: git make mingw-w64-x86_64-toolchain
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
pacman -S --noconfirm mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-ninja \
|
||||
mingw-w64-x86_64-zlib \
|
||||
mingw-w64-x86_64-SDL2 \
|
||||
mingw-w64-x86_64-clang \
|
||||
mingw-w64-x86_64-nsis \
|
||||
mingw-w64-x86_64-dfu-util \
|
||||
mingw-w64-x86_64-openssl
|
||||
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -69,23 +54,30 @@ jobs:
|
||||
AQT_CONFIG: ${{ github.workspace }}/tools/aqt-settings.ini
|
||||
with:
|
||||
cache: true
|
||||
cache-key-prefix: 'install-qt-action-win64'
|
||||
cache-key-prefix: 'install-qt-action-${{ env.QT_ARCH }}'
|
||||
version: ${{ env.QT_VERSION }}
|
||||
arch: ${{ env.MINGW_VERSION }}
|
||||
arch: ${{ env.QT_ARCH }}
|
||||
modules: 'qtmultimedia qtserialport'
|
||||
|
||||
- name: Setup SDL2
|
||||
id: setup-sdl2
|
||||
uses: libsdl-org/setup-sdl@v1
|
||||
with:
|
||||
version: ${{ env.SDL_VERSION }}
|
||||
build-type: "Release"
|
||||
|
||||
- name: Install Python Dependencies
|
||||
run: |
|
||||
echo $PATH
|
||||
$Python3_ROOT_DIR/python3.exe -m pip install clang jinja2 lz4 pillow
|
||||
|
||||
- name: Setup MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}
|
||||
env:
|
||||
CMAKE_GENERATOR: Ninja
|
||||
run: |
|
||||
mkdir output && \
|
||||
CMAKE_PREFIX_PATH=$RUNNER_WORKSPACE/Qt/$QT_VERSION/$MINGW_PATH \
|
||||
CMAKE_PREFIX_PATH="$QT_ROOT_DIR;$SDL2_ROOT" \
|
||||
tools/build-companion.sh "$(pwd)" "$(pwd)/output/"
|
||||
|
||||
- name: Compose release filename
|
||||
|
||||
@@ -96,8 +96,6 @@ function(AddHardwareDefTarget output)
|
||||
endforeach()
|
||||
|
||||
set(GEN_HW_DEFS ${CMAKE_CXX_COMPILER} ${HW_DEF_ARGS} -x c++-header -E -dM ${HW_DEF_SRC})
|
||||
set(GEN_HW_DEFS ${GEN_HW_DEFS} | grep -v "^#define _" | sort)
|
||||
|
||||
set(GEN_JSON ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/hw_defs/generate_hw_def.py)
|
||||
set(GEN_JSON ${GEN_JSON} -i defines -T ${FLAVOUR} -)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wno-deprecated-declarations")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member -Wno-deprecated-declarations")
|
||||
|
||||
if(MINGW OR WIN32)
|
||||
set(CMAKE_OBJECT_PATH_MAX 200)
|
||||
|
||||
@@ -136,16 +136,6 @@ set(HWDEFS_PHDR "HWDEF_JSON_LIST")
|
||||
set(HWDEFS_QRC "${CMAKE_CURRENT_BINARY_DIR}/hwdefs.qrc")
|
||||
set(HWDEFS_CMD "${COMPANION_SRC_DIRECTORY}/../util/generate_hwdefs_qrc.py")
|
||||
|
||||
# qrc used by Companion and Simulator
|
||||
add_custom_command(OUTPUT ${HWDEFS_QRC}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${HWDEFS_CMD}
|
||||
-d ${HWDEFS_DIR}
|
||||
-t ${HWDEFS_TMPL}
|
||||
-p ${HWDEFS_PHDR}
|
||||
-o ${HWDEFS_QRC}
|
||||
DEPENDS ${HWDEFS_TMPL}
|
||||
)
|
||||
|
||||
############# Common lib ###############
|
||||
|
||||
set(common_SRCS
|
||||
@@ -161,13 +151,23 @@ set(common_MOC_HDRS
|
||||
modeledit/node.h
|
||||
)
|
||||
|
||||
qt_wrap_cpp(common_SRCS ${common_MOC_HDRS})
|
||||
|
||||
# qrc used by Companion and Simulator
|
||||
add_custom_command(OUTPUT ${HWDEFS_QRC}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${HWDEFS_CMD}
|
||||
-d ${HWDEFS_DIR}
|
||||
-t ${HWDEFS_TMPL}
|
||||
-p ${HWDEFS_PHDR}
|
||||
-o ${HWDEFS_QRC}
|
||||
DEPENDS ${HWDEFS_TMPL}
|
||||
)
|
||||
|
||||
set(common_RESOURCES
|
||||
companion.qrc
|
||||
${TRANSLATIONS_QRC}
|
||||
${HWDEFS_QRC}
|
||||
)
|
||||
|
||||
qt_wrap_cpp(common_SRCS ${common_MOC_HDRS})
|
||||
)
|
||||
qt_add_resources(common_RCC ${common_RESOURCES})
|
||||
|
||||
add_library(common ${common_SRCS} ${common_RCC})
|
||||
@@ -410,8 +410,7 @@ elseif(WIN32)
|
||||
|
||||
# install libsim dlls into same directory as apps
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/plugins/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime)
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
install(FILES ${LICENSE_FILE}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||
@@ -431,14 +430,12 @@ elseif(WIN32)
|
||||
|
||||
if(EXISTS "${LIBUSB1_LIBRARY_FILE}")
|
||||
install(FILES "${LIBUSB1_LIBRARY_FILE}"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime)
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
if(DFU_UTIL_FOUND)
|
||||
install(FILES "${DFU_UTIL_PATH}"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime)
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
endif(LIBUSB1_FOUND)
|
||||
|
||||
@@ -455,7 +452,6 @@ elseif(WIN32)
|
||||
if(EXISTS "${OPENSSL_SSL_LIBRARY_DIR}")
|
||||
install(DIRECTORY ${OPENSSL_SSL_LIBRARY_DIR}/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT Runtime
|
||||
FILES_MATCHING
|
||||
PATTERN "libcrypto-*.dll"
|
||||
PATTERN "libssl-*.dll")
|
||||
@@ -560,6 +556,7 @@ if(WIN32)
|
||||
EXECUTABLE ${companion_executable_path}
|
||||
ADDITIONAL_EXECUTABLES ${simulator_executable_path}
|
||||
NO_TRANSLATIONS
|
||||
NO_COMPILER_RUNTIME
|
||||
GENERATE_QT_CONF
|
||||
VERBOSE
|
||||
)
|
||||
@@ -587,12 +584,9 @@ if(WIN32)
|
||||
|
||||
# The 'install' target prepares all the distro files, make sure it has been executed first.
|
||||
add_custom_target(installer
|
||||
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target install --config Release
|
||||
COMMAND "${CMAKE_COMMAND}" -P "${qt_deploy_script}"
|
||||
# Hack to overwrite the pthread lib shipped with Qt
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${MINGW_BIN_DIR}/libwinpthread-1.dll" "${CMAKE_BINARY_DIR}/_install/bin/libwinpthread-1.dll"
|
||||
COMMAND "${NSIS_EXE}" "${NSI_FILE}"
|
||||
DEPENDS "${NSI_FILE}" "${qt_deploy_script}"
|
||||
DEPENDS install "${NSI_FILE}" "${qt_deploy_script}"
|
||||
COMMENT "Building Windows NSIS installer..."
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -97,6 +97,7 @@ void FlashProcess::onStarted()
|
||||
#if !__GNUC__
|
||||
bool killProcessByName(const char *szProcessToKill)
|
||||
{
|
||||
QString processToKill{szProcessToKill};
|
||||
HANDLE hProcessSnap;
|
||||
HANDLE hProcess;
|
||||
PROCESSENTRY32 pe32;
|
||||
@@ -115,7 +116,9 @@ bool killProcessByName(const char *szProcessToKill)
|
||||
}
|
||||
|
||||
do {
|
||||
if (!strcmp(pe32.szExeFile,szProcessToKill)) { // checks if process at current position has the name of to be killed app
|
||||
QString exeFile{pe32.szExeFile};
|
||||
|
||||
if (exeFile == processToKill) { // checks if process at current position has the name of to be killed app
|
||||
hProcess = OpenProcess(PROCESS_TERMINATE,0, pe32.th32ProcessID); // gets handle to process
|
||||
TerminateProcess(hProcess, 0); // Terminate process by handle
|
||||
CloseHandle(hProcess); // close the handle
|
||||
|
||||
@@ -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