From ce65c7790dd60c2755d3fd564a99d8f747564b43 Mon Sep 17 00:00:00 2001 From: hgn Date: Mon, 27 May 2024 18:58:18 +0100 Subject: [PATCH] update to new buildscript style --- build.c | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/build.c b/build.c index 9fd147e..c8f0fac 100644 --- a/build.c +++ b/build.c @@ -13,26 +13,31 @@ u32 optimize_test_compile = 0; void build_game_content( struct vg_project *proj ) { - vg_project_new_target( proj, "Content files", k_obj_type_none ); vg_symlink( proj, "textures_qoi", "textures" ); vg_symlink( proj, "maps", "maps" ); vg_symlink( proj, "sound", "sound" ); - vg_syscall( "mkdir -p bin/%s/cfg", proj->uid.buffer ); - vg_syscall( "mkdir -p bin/%s/sav", proj->uid.buffer ); + vg_syscall( "mkdir -p %s/cfg", proj->bin_folder.buffer ); + vg_syscall( "mkdir -p %s/sav", proj->bin_folder.buffer ); } void build_shaders(void); -void build_game_bin( struct vg_project *proj ) +void build_game_bin( struct vg_project *proj, + struct vg_compiler_env *env ) { static int meta = 0; - if( !meta ){ + if( !meta ) + { meta = 1; build_shaders(); vg_low( "\n\n" ); } - vg_project_new_target( proj, "fishladder", k_obj_type_exe ); - vg_add_engine( proj, &(struct vg_engine_config) + struct vg_compiler_conf conf = {0}; + vg_str sources = {0}; + vg_strcat( &sources, "marblecomp.c " ); + + vg_add_engine( proj, + &(struct vg_engine_config) { .fixed_update_hz = 60, .legacy_support_vg_msg1 = 0, @@ -41,17 +46,20 @@ void build_game_bin( struct vg_project *proj ) .use_3d = 0, .custom_game_settings = 1, .custom_shaders = 1 - }); + }, + env, &conf, &sources ); - vg_add_source( proj, "marblecomp.c" ); - vg_compile_project( proj ); + vg_compiler_run( proj, env, &conf, sources.buffer, "fishladder", + k_obj_type_exe ); } /* * Scripts * -------------------------------------------------------------------------- */ -void s_release_all(void){ +#if 0 +void s_release_all(void) +{ vg_info( "running script: s_release_all(void)\n" ); struct vg_project linux_proj, windows_proj; @@ -71,26 +79,34 @@ void s_release_all(void){ vg_tarball_project( &linux_proj ); vg_tarball_project( &windows_proj ); } +#endif -void s_testing_build(void){ +void s_testing_build(void) +{ vg_info( "running script: s_testing_build(void)\n" ); - struct vg_project test_proj; - vg_project_init( &test_proj, &vg_test_env, "marblecomp-test" ); + struct vg_project proj; + vg_project_init( &proj, "bin", "marblecomp-test", 0 ); - build_game_content( &test_proj ); - build_game_bin( &test_proj ); + build_game_content( &proj ); + build_game_bin( &proj, &vg_test_env ); } + int main( int argc, char *argv[] ){ char *arg; - while( vg_argp( argc, argv ) ){ + while( vg_argp( argc, argv ) ) + { +#if 0 if( vg_long_opt( "release-all" ) ) s_release_all(); +#endif if( vg_long_opt( "testing-build" ) ) s_testing_build(); + if( vg_long_opt( "android-build" ) ) return 0; + if( vg_opt('r') ) vg_test_env.optimization = 3; } -- 2.25.1