feat: arm64

This commit is contained in:
Simplxs 2024-05-10 18:19:30 +08:00
parent 58bc6b1f57
commit 1a0d28b514
4 changed files with 25 additions and 61 deletions

View File

@ -57,7 +57,7 @@
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
arch: [x64] arch: [x64, arm64]
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -76,12 +76,12 @@
# This is the name of the CMakePresets.json's configuration to use to generate # This is the name of the CMakePresets.json's configuration to use to generate
# the project files. This configuration leverages the vcpkg.cmake toolchain file to # the project files. This configuration leverages the vcpkg.cmake toolchain file to
# run vcpkg and install all dependencies specified in vcpkg.json. # run vcpkg and install all dependencies specified in vcpkg.json.
configurePreset: 'ninja-${{ matrix.arch }}' configurePreset: 'ninja'
# This is the name of the CMakePresets.json's configuration to build the project. # This is the name of the CMakePresets.json's configuration to build the project.
buildPreset: 'ninja-${{ matrix.arch }}-release' buildPreset: 'ninja-release'
- run: mv build/ninja-${{ matrix.arch }}/libSignerServer.so libSignerServer.so - run: mv build/ninja/libSignerServer.so libSignerServer.so
- name: Upload build - name: Upload build
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -2,29 +2,15 @@
"version": 2, "version": 2,
"configurePresets": [ "configurePresets": [
{ {
"name": "ninja-x64", "name": "ninja",
"displayName": "Configure ninja-x64", "displayName": "Configure ninja",
"description": "Configure ninja-x64", "description": "Configure ninja",
"generator": "Ninja", "generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}", "binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": { "cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}" "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}"
} }
}, },
{
"name": "ninja-arm64",
"displayName": "Configure ninja-arm64",
"description": "Configure ninja-arm64",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}"
},
"architecture": {
"value": "arm64",
"strategy": "set"
}
},
{ {
"name": "msvc-x64", "name": "msvc-x64",
"displayName": "Visual Studio Community 2022 Preview - amd64", "displayName": "Visual Studio Community 2022 Preview - amd64",
@ -42,34 +28,18 @@
], ],
"buildPresets": [ "buildPresets": [
{ {
"name": "ninja-arm64-debug", "name": "ninja-debug",
"description": "Build ninja-arm64 Debug", "description": "Build ninja Debug",
"displayName": "Build ninja-arm64 Debug", "displayName": "Build ninja Debug",
"configurePreset": "ninja-arm64", "configurePreset": "ninja",
"configuration": "Debug", "configuration": "Debug",
"targets": "all" "targets": "all"
}, },
{ {
"name": "ninja-arm64-release", "name": "ninja-release",
"description": "Build ninja-arm64 Release", "description": "Build ninja Release",
"displayName": "Build ninja-arm64 Release", "displayName": "Build ninja Release",
"configurePreset": "ninja-arm64", "configurePreset": "ninja",
"configuration": "Release",
"targets": "all"
},
{
"name": "ninja-x64-debug",
"description": "Build ninja-x64 Debug",
"displayName": "Build ninja-x64 Debug",
"configurePreset": "ninja-x64",
"configuration": "Debug",
"targets": "all"
},
{
"name": "ninja-x64-release",
"description": "Build ninja-x64 Release",
"displayName": "Build ninja-x64 Release",
"configurePreset": "ninja-x64",
"configuration": "Release", "configuration": "Release",
"targets": "all" "targets": "all"
}, },

View File

@ -83,8 +83,16 @@ std::string Bin2Hex(const uint8_t *ptr, size_t length) {
} }
Sign::Sign() { Sign::Sign() {
std::thread t(&Sign::InitEx, this); std::thread([this]{ while (false) {
t.detach(); try {
Init();
}
catch (const std::exception &e) {
std::cerr << e.what() << '\n';
std::this_thread::sleep_for(std::chrono::seconds(1));
continue;
}
} }).detach();
} }
void Sign::Init() { void Sign::Init() {
@ -121,19 +129,6 @@ void Sign::Init() {
SignFunction = reinterpret_cast<SignFunctionType>(HookAddress); SignFunction = reinterpret_cast<SignFunctionType>(HookAddress);
} }
void Sign::InitEx() {
while (true) {
try {
Init();
break;
}
catch (const std::exception &e) {
std::cerr << e.what() << '\n';
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
}
std::tuple<std::string, std::string, std::string> Sign::Call(const std::string_view cmd, const std::string_view src, int seq) { std::tuple<std::string, std::string, std::string> Sign::Call(const std::string_view cmd, const std::string_view src, int seq) {
if (SignFunction == nullptr) { if (SignFunction == nullptr) {
throw std::runtime_error("Sign function not initialized"); throw std::runtime_error("Sign function not initialized");

View File

@ -10,7 +10,6 @@ private:
typedef int (*SignFunctionType)(const char *cmd, const unsigned char *src, size_t src_len, int seq, unsigned char *result); typedef int (*SignFunctionType)(const char *cmd, const unsigned char *src, size_t src_len, int seq, unsigned char *result);
SignFunctionType SignFunction = nullptr; SignFunctionType SignFunction = nullptr;
void Init(); void Init();
void InitEx();
public: public:
std::tuple<std::string, std::string, std::string> Call(const std::string_view cmd, const std::string_view src, int seq); std::tuple<std::string, std::string, std::string> Call(const std::string_view cmd, const std::string_view src, int seq);