Skip to content

Commit

Permalink
test an arm64 build on azure
Browse files Browse the repository at this point in the history
  • Loading branch information
phlptp committed Aug 4, 2023
1 parent 792d892 commit 44c8c8d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 7 deletions.
14 changes: 14 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ jobs:
- bash: cpplint --counting=detailed --recursive examples include/CLI tests
displayName: Checking against google style guide

- job: msvc_arm64
strategy:
matrix:
vs_arm64:
vmImage: "windows-2022"
cli11.std: 17
cli11.build_type: Debug
cli11.options: -G "Visual Studio 17 2022" -A ARM64
pool:
vmImage: $(vmImage)

steps:
- template: .ci/azure-build.yml

- job: Native
strategy:
matrix:
Expand Down
49 changes: 42 additions & 7 deletions examples/testEXE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,52 @@
#include <iostream>
#include <string>

namespace key {
enum class my_enum {
val1,
val2
};

std::optional<my_enum> deserialize(const std::string& value) {
if (value == "val1") {
return my_enum::val1;
}
else if (value == "val2") {
return my_enum::val2;
}
else {
return std::nullopt;
}
}

// More deserialize overloads for a gazillion different types...

template<class T>
concept Deserializable = requires (const std::string & value) {
{ deserialize<T>(value) } -> std::same_as<bool>;
};

template<class T>
bool lexical_cast(const std::string& src, T& dst) {
auto result = deserialize<T>(src);
if (result)
dst = *result;
return !!result;
}

}
int main(int argc, const char *argv[]) {

int logLevel{0};
CLI::App app{"Test App"};

app.add_option("-v", logLevel, "level");
CLI::App app;

key::my_enum test{ key::my_enum::val2 };

auto *subcom = app.add_subcommand("sub", "")->fallthrough();
subcom->preparse_callback([&app](size_t) { app.get_subcommand("sub")->add_option_group("group"); });
app.add_option("--test", test);

CLI11_PARSE(app, argc, argv);
// More code...
CLI11_PARSE(app,argc,argv);

std::cout << "level: " << logLevel << std::endl;
std::cout<<static_cast<int>(test)<<"=="<<static_cast<int>(key::my_enum::val2)<<std::endl;
return 0;
}

0 comments on commit 44c8c8d

Please sign in to comment.