2 #include "vg/vg_platform.h"
5 #include "vg/vg_build.h"
6 #include "vg/vg_build_utils_shader.h"
9 * c build.c --release --clang
10 * c build.c --clang -p
11 * c build.c --file=game -rc --clang --play
14 int compiled_something
= 0;
16 void build_server( enum compiler compiler
)
18 vg_build_start( "skaterift_server", compiler
);
19 vg_build_object( "server.c " );
20 vg_build_link( "-lm -lsdkencryptedappticket -lsteam_api " );
21 vg_build_library_dir( "-L./vg/dep/steam " );
23 vg_build_bin_dependency_file( "vg/dep/steam/steamclient.so" );
24 vg_build_bin_dependency_file( "vg/dep/steam/libsteam_api.so" );
25 vg_build_bin_dependency_file( "vg/dep/steam/libsdkencryptedappticket.so" );
28 compiled_something
= 1;
31 void build_shaders(void);
32 void build_game( enum compiler compiler
)
34 static int shaders_built
= 0;
41 vg_build_start( "skaterift", compiler
);
42 vg_build_object( "skaterift.c " );
43 vg_build_add_link_for_graphics();
44 vg_build_add_link_for_game();
46 vg_build_copy_graphics_dependencies();
47 vg_build_copy_game_dependencies();
49 vg_build_symbolic_link( "textures_src", "textures" );
50 vg_build_symbolic_link( "models_src", "models" );
51 vg_build_symbolic_link( "maps_src", "maps" );
52 vg_build_symbolic_link( "sound_src", "sound" );
53 vg_build_syscall( "mkdir -p %s/cfg", vg_compiler
.build_dir
);
56 compiled_something
= 1;
59 int main( int argc
, char *argv
[] )
61 time_t uid
= time(NULL
);
64 while( vg_argp( argc
, argv
) )
66 if( vg_long_opt( "debug" ) || vg_opt( 'd' ) )
67 vg_build_mode_debug();
69 if( vg_long_opt( "release" ) || vg_opt( 'r' ) )
70 vg_build_mode_release();
72 if( vg_long_opt( "clang-server" ) )
73 build_server( k_compiler_clang
);
75 if( vg_long_opt( "clang" ) )
76 build_game( k_compiler_clang
);
78 if( vg_long_opt( "gcc" ) )
79 build_game( k_compiler_gcc
);
81 if( vg_long_opt( "mingw" ) )
82 build_game( k_compiler_mingw
);
84 if( vg_opt('p') || vg_long_opt("run") )
86 chdir( vg_compiler
.build_dir
);
87 if( vg_compiler
.compiler
== k_compiler_mingw
)
88 vg_build_syscall( "wine %s.exe", vg_compiler
.name
);
90 vg_build_syscall( "./%s", vg_compiler
.name
);
94 if( vg_long_opt( "tar" ) || vg_opt( 't' ) )
96 vg_build_syscall( "mkdir -p dist" );
97 if( compiled_something
)
98 vg_build_syscall( "tar -chzvf dist/%s-%u.tar.gz %s",
99 vg_compiler
.name
, uid
, vg_compiler
.build_dir
);
102 if( vg_long_opt( "zip" ) || vg_opt( 'z' ) )
104 vg_build_syscall( "mkdir -p dist" );
105 if( compiled_something
)
106 vg_build_syscall( "zip -r9 dist/%s-%u.zip %s",
107 vg_compiler
.name
, uid
, vg_compiler
.build_dir
);
112 #define _S( NAME, VS, FS ) \
113 vg_build_shader( "shaders/" VS, "shaders/" FS, NULL, "shaders", NAME )
115 void build_shaders(void)
117 vg_shader_set_include_dir( "shaders" );
120 _S( "scene_standard", "scene.vs", "scene_standard.fs" );
121 _S( "scene_standard_alphatest", "scene.vs", "scene_standard_alphatest.fs" );
122 _S( "scene_vertex_blend", "scene.vs", "scene_vertex_blend.fs" );
123 _S( "scene_terrain", "scene.vs", "scene_terrain.fs" );
124 _S( "scene_route", "scene.vs", "scene_route.fs" );
125 _S( "scene_depth", "scene.vs", "scene_depth.fs" );
126 _S( "scene_position", "scene.vs", "scene_position.fs" );
127 _S( "scene_water", "scene.vs", "scene_water.fs" );
128 _S( "scene_water_fast", "scene.vs", "scene_water_fast.fs" );
131 _S( "model_sky", "model.vs", "model_sky.fs" );
132 _S( "model_menu", "model.vs", "model_menu.fs" );
133 _S( "model_character_view", "model_skinned.vs", "model_character_view.fs" );
134 _S( "model_gate", "model_gate.vs", "model_gate_lq.fs" );
137 _S( "blit", "blit.vs", "blit.fs" );
138 _S( "blitblur", "blit.vs", "blitblur.fs" );
139 _S( "blitcolour","blit.vs", "colour.fs" );
140 _S( "routeui", "routeui.vs", "routeui.fs" );
144 _S( "scoretext", "shaders/scoretext.vs", "shaders/vblend.fs" );