Skip to content

Commit

Permalink
Add support for C3 language
Browse files Browse the repository at this point in the history
  • Loading branch information
radekm committed Nov 24, 2024
1 parent e82f934 commit d0a0cdc
Show file tree
Hide file tree
Showing 6 changed files with 565 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn build_exe(
"generators/sokolodin.cc",
"generators/sokolrust.cc",
"generators/sokoljai.cc",
"generators/sokolc3.cc",
"generators/sokolzig.cc",
"generators/yaml.cc",
};
Expand Down
3 changes: 2 additions & 1 deletion src/shdc/args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static void print_help_string(getopt_context_t& ctx) {
" - sokol_rust Rust module file\n"
" - sokol_d D module file\n"
" - sokol_jai Jai module file\n"
" - sokol_c3 C3 module file\n"
" - bare raw output of SPIRV-Cross compiler, in text or binary format\n"
" - bare_yaml like bare, but with reflection file in YAML format\n\n"
"Options:\n\n");
Expand Down Expand Up @@ -214,7 +215,7 @@ Args Args::parse(int argc, const char** argv) {
case OPTION_FORMAT:
args.output_format = Format::from_str(ctx.current_opt_arg);
if (args.output_format == Format::INVALID) {
fmt::print(stderr, "sokol-shdc: unknown output format {}, must be [sokol|sokol_impl|sokol_zig|sokol_nim|sokol_odin|sokol_rust|sokol_jai|bare|base_yaml]\n", ctx.current_opt_arg);
fmt::print(stderr, "sokol-shdc: unknown output format {}, must be [sokol|sokol_impl|sokol_zig|sokol_nim|sokol_odin|sokol_rust|sokol_jai|sokol_c3|bare|base_yaml]\n", ctx.current_opt_arg);
args.valid = false;
args.exit_code = 10;
return args;
Expand Down
3 changes: 3 additions & 0 deletions src/shdc/generators/generate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "sokolzig.h"
#include "sokold.h"
#include "sokoljai.h"
#include "sokolc3.h"
#include "yaml.h"
#include <memory>

Expand All @@ -34,6 +35,8 @@ std::unique_ptr<Generator> make_generator(Format::Enum format) {
return std::make_unique<SokolDGenerator>();
case Format::SOKOL_JAI:
return std::make_unique<SokolJaiGenerator>();
case Format::SOKOL_C3:
return std::make_unique<SokolC3Generator>();
default:
return std::make_unique<SokolCGenerator>();
}
Expand Down
Loading

0 comments on commit d0a0cdc

Please sign in to comment.