move texture compiler to native code
[carveJwlIkooP6JGAAIwe30JlM.git] / build.c
diff --git a/build.c b/build.c
index 9367e81b64929c187d69d6ce5d32e2c337143100..94869b4874606405bdc715fbb3078875c2baedd5 100644 (file)
--- a/build.c
+++ b/build.c
@@ -127,6 +127,8 @@ void build_shaders(void){
    _S( "blitcolour","blit.vs",      "colour.fs" );
    _S( "blit_transition", "blit.vs", "blit_transition.fs" );
    _S( "routeui",   "routeui.vs",   "routeui.fs" );
+
+   vg_build_shader_impl( "shaders/impl.c" );
 }
 
 void build_game_content( struct vg_project *proj )
@@ -163,7 +165,8 @@ void build_game_bin( struct vg_project *proj )
             .log_source_info = 1,
             .steam_api = 1,
             .use_3d = 1,
-            .custom_game_settings = 0
+            .custom_game_settings = 0,
+            .custom_shaders = 1
          });
 
    vg_add_source( proj, "skaterift.c " );
@@ -202,11 +205,25 @@ void compile_server( struct vg_project *proj )
    vg_compile_project( proj );
 }
 
+void compile_tools( struct vg_env *env, struct vg_project *proj )
+{
+   struct vg_env backup = *env;
+   env->optimization = 3; /* force optimization always */
+   env->debug_asan = 0;
+
+   vg_project_new_target( proj, "tools/qoi", k_obj_type_shared );
+   vg_add_source( proj, "qoi_lib.c " );
+   vg_compile_project( proj );
+
+   *env = backup;
+}
+
 /*
  * Scripts
  * -------------------------------------------------------------------------- */
 
-void s_release_all(void){
+void s_release_all(void)
+{
    vg_info( "running script: s_release_all(void)\n" );
 
    struct vg_project content_proj, windows_proj, linux_proj;
@@ -221,12 +238,14 @@ void s_release_all(void){
    env.platform = k_platform_windows;
    vg_project_init( &windows_proj, &env, "skaterift" );
    build_game_bin( &windows_proj );
+   compile_tools( &env, &windows_proj );
 
    /* binaries for linux */
    env = vg_release_env;
    env.platform = k_platform_linux;
    vg_project_init( &linux_proj, &env, "skaterift" );
    build_game_bin( &linux_proj );
+   compile_tools( &env, &linux_proj );
 
    /* package them up for storage */
    vg_tarball_project( &content_proj );
@@ -239,17 +258,21 @@ void s_release_all(void){
    fclose( fp );
 }
 
-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, "skaterift-test" );
 
    build_game_bin( &test_proj );
+   compile_tools( &vg_test_env, &test_proj );
    build_game_content( &test_proj );
+   vg_add_blob( &test_proj, "steam_appid.txt", "" );
 }
 
-void s_testing_server(void){
+void s_testing_server(void)
+{
    vg_info( "running script: s_testing_server(void)\n" );
 
    struct vg_project test_proj;
@@ -257,7 +280,8 @@ void s_testing_server(void){
    compile_server( &test_proj );
 }
 
-int main( int argc, char *argv[] ){
+int main( int argc, char *argv[] )
+{
    char *arg;
    while( vg_argp( argc, argv ) ){
       if( vg_long_opt( "release-all" ) )