From 659f33751d682adbcc974a3f730b9f117de163fa Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Fri, 9 Jun 2023 16:55:04 -0400 Subject: [PATCH] Shorten the enum names --- generate.jai | 22 ++++++++++------------ windows.jai | 2 +- windows/dr_libs.lib | Bin 754930 -> 754930 bytes 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/generate.jai b/generate.jai index 9b819c1..f0387f5 100644 --- a/generate.jai +++ b/generate.jai @@ -1,11 +1,10 @@ -#!/usr/bin/env jai -libs_to_include: Libs = Libs.DR_WAV | Libs.DR_FLAC | Libs.DR_MP3; // @consider making this a metaprogram/command line arg? +libs_to_build :: Libs.WAV | .FLAC | .MP3; // @consider making this a metaprogram/command line arg. Can then use this as a git submodule in a project and a script/build file generate bindings for what the project requires. Libs :: enum_flags { - DR_WAV; - DR_FLAC; - DR_MP3; + WAV; + FLAC; + MP3; } AT_COMPILE_TIME :: true; @@ -40,7 +39,7 @@ else { } generate_bindings :: () -> bool { - if libs_to_include == 0 { + if libs_to_build == 0 { log_error("You need to specify at least one library for binding generation!\n"); return true; } @@ -55,12 +54,11 @@ generate_bindings :: () -> bool { src_files: [..] string; extra: [..] string; - libs_info := type_info(Libs); - for libs_info.values { - if libs_to_include & cast(Libs)it { - name := libs_info.names[it_index]; - array_add(*src_files, tprint("%/%.c", SOURCE_PATH, to_lower_copy(name))); - array_add(*extra, tprint("/D%_IMPLEMENTATION", name)); + libs := type_info(Libs); + for libs.names { + if libs_to_build & (xx libs.values[it_index]) { + array_add(*src_files, tprint("%/dr_%.c", SOURCE_PATH, to_lower_copy(it))); + array_add(*extra, tprint("/DDR_%_IMPLEMENTATION", it)); } } diff --git a/windows.jai b/windows.jai index 9d0cc33..b04d266 100644 --- a/windows.jai +++ b/windows.jai @@ -1,7 +1,7 @@ // // This file was auto-generated using the following command: // -// jai ./generate.jai +// jai generate.jai // diff --git a/windows/dr_libs.lib b/windows/dr_libs.lib index cbbbfcbe41b5b11604ee97f7eb584fc8dd1db771..4bb8ed3f047476a9386164665d5c542e1efda725 100644 GIT binary patch delta 131 zcmey=srRWq z2PHD8G0&@QZ?8^d0%B$$W&vVWAZFWMoyh(*5vH>2Fgrx${KM?+^AB?XG3WOAhq;0e F0s#K-E#?3K delta 131 zcmey=srRW