Package script updated
This commit is contained in:
parent
0bae74aa48
commit
6e97a504a9
|
@ -108,27 +108,14 @@ char **platform_includes[Platform_COUNT][Compiler_COUNT] = {
|
|||
{0 , mac_gcc_platform_inc },
|
||||
};
|
||||
|
||||
//
|
||||
// Custom targets
|
||||
//
|
||||
char *default_custom_target = "../code/custom/4coder_default_bindings.cpp";
|
||||
|
||||
enum{
|
||||
Custom_Default,
|
||||
//
|
||||
Custom_COUNT
|
||||
};
|
||||
|
||||
char *custom_files[] = {
|
||||
"../code/custom/4coder_default_bindings.cpp",
|
||||
};
|
||||
|
||||
//
|
||||
// Architectures
|
||||
//
|
||||
// NOTE(allen): Architectures
|
||||
|
||||
enum{
|
||||
Arch_X64,
|
||||
Arch_X86,
|
||||
|
||||
//
|
||||
Arch_COUNT,
|
||||
Arch_None = Arch_COUNT,
|
||||
|
@ -139,9 +126,7 @@ char *arch_names[] = {
|
|||
"x86",
|
||||
};
|
||||
|
||||
//
|
||||
// Build flags
|
||||
//
|
||||
// NOTE(allen): Build flags
|
||||
|
||||
enum{
|
||||
OPTS = 0x1,
|
||||
|
@ -199,7 +184,7 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
|
|||
fm_init_build_line(&line);
|
||||
|
||||
if (arch == Arch_X86){
|
||||
fm_add_to_line(line, "%s\\windows_scripts\\setup_cl_x86.bat &", code_path);
|
||||
fm_add_to_line(line, "%s\\custom\\bin\\setup_cl_x86.bat &", code_path);
|
||||
}
|
||||
|
||||
fm_add_to_line(line, "cl");
|
||||
|
@ -287,6 +272,8 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
|
|||
|
||||
systemf("%s", line.build_options);
|
||||
fm_popdir(temp);
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -413,38 +400,6 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char *code_file, char
|
|||
build(arena, flags, arch, code_path, code_files, out_path, out_file, defines, exports, inc_folders);
|
||||
}
|
||||
|
||||
// TODO(NAME): build metadata fully from C++ and eliminate build_metadata.bat and build_metadata.sh
|
||||
|
||||
internal void
|
||||
build_metadata(void){
|
||||
systemf(".%s%s ..%scode%s4coder_default_bindings.cpp", SLASH, "build_metadata" BAT, SLASH, SLASH);
|
||||
}
|
||||
|
||||
internal void
|
||||
site_build(Arena *arena, char *cdir, u32 flags){
|
||||
build_metadata();
|
||||
|
||||
{
|
||||
char *file = fm_str(arena, "site/4ed_sitegen.cpp");
|
||||
char *dir = fm_str(arena, BUILD_DIR);
|
||||
BEGIN_TIME_SECTION();
|
||||
build(arena, OPTS | flags, Arch_X64, cdir, file, dir, "sitegen", get_defines_from_flags(arena, flags), 0, includes);
|
||||
END_TIME_SECTION("build sitegen");
|
||||
}
|
||||
|
||||
if (prev_error == 0){
|
||||
BEGIN_TIME_SECTION();
|
||||
char *cmd = fm_str(arena, BUILD_DIR "/sitegen");
|
||||
char *code_dir = fm_str(arena, ".");
|
||||
char *asset_dir = fm_str(arena, "../4coder-non-source/site_resources");
|
||||
char *site_source_dir = fm_str(arena, "site/source_material");
|
||||
char *dest_dir = fm_str(arena, "../site");
|
||||
fm_make_folder_if_missing(arena, dest_dir);
|
||||
systemf("%s %s %s %s %s", cmd, code_dir, asset_dir, site_source_dir, dest_dir);
|
||||
END_TIME_SECTION("run sitegen");
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
build_and_run(Arena *arena, char *cdir, char *filename, char *name, u32 flags){
|
||||
char *dir = fm_str(arena, BUILD_DIR);
|
||||
|
@ -484,7 +439,9 @@ string_build(Arena *arena, char *cdir){
|
|||
}
|
||||
|
||||
internal void
|
||||
do_buildsuper(Arena *arena, char *cdir, char *file, u32 arch){
|
||||
buildsuper(Arena *arena, char *cdir, char *file, u32 arch){
|
||||
printf("BUILDSUPER: cdir: %s; file: %s; arch: %u\n", cdir, file, arch);
|
||||
|
||||
BEGIN_TIME_SECTION();
|
||||
Temp_Dir temp = fm_pushdir(fm_str(arena, BUILD_DIR));
|
||||
|
||||
|
@ -498,6 +455,7 @@ do_buildsuper(Arena *arena, char *cdir, char *file, u32 arch){
|
|||
|
||||
fm_popdir(temp);
|
||||
END_TIME_SECTION("build custom");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// TODO(allen): Remove this
|
||||
|
@ -559,24 +517,22 @@ build_main(Arena *arena, char *cdir, b32 update_local_theme, u32 flags, u32 arch
|
|||
char *source_themes_folder = fm_str(arena, "themes");
|
||||
fm_clear_folder(themes_folder);
|
||||
fm_make_folder_if_missing(arena, themes_folder);
|
||||
fm_copy_all(source_themes_folder, "*", themes_folder);
|
||||
fm_copy_all(source_themes_folder, themes_folder);
|
||||
END_TIME_SECTION("move files");
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
internal void
|
||||
standard_build(Arena *arena, char *cdir, u32 flags, u32 arch){
|
||||
do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Default]), arch);
|
||||
|
||||
buildsuper(arena, cdir, fm_str(arena, default_custom_target), arch);
|
||||
build_main(arena, cdir, true, flags, arch);
|
||||
}
|
||||
|
||||
internal char*
|
||||
get_4coder_dist_name(Arena *arena, u32 platform, char *tier, u32 arch){
|
||||
char *name = fm_str(arena, "4coder-alpha-" MAJOR_STR "-" MINOR_STR "-" PATCH_STR);
|
||||
if (strcmp(tier, "alpha") != 0){
|
||||
name = fm_str(arena, name, "-", tier);
|
||||
}
|
||||
char *name = fm_str(arena, "4coder-" MAJOR_STR "-" MINOR_STR "-" PATCH_STR "-", tier);
|
||||
if (platform != Platform_None){
|
||||
name = fm_str(arena, name, "-", platform_names[platform]);
|
||||
}
|
||||
|
@ -586,80 +542,84 @@ get_4coder_dist_name(Arena *arena, u32 platform, char *tier, u32 arch){
|
|||
return(name);
|
||||
}
|
||||
|
||||
enum{
|
||||
Tier_Demo,
|
||||
Tier_Super,
|
||||
Tier_COUNT,
|
||||
};
|
||||
|
||||
internal void
|
||||
package(Arena *arena, char *cdir){
|
||||
// NOTE(allen): meta
|
||||
char *build_dir = fm_str(arena, BUILD_DIR);
|
||||
char *pack_dir = fm_str(arena, PACK_DIR);
|
||||
char *fonts_source_dir = fm_str(arena, "../4coder-non-source/dist_files/fonts");
|
||||
char *dist_files[3];
|
||||
dist_files[0] = fm_str(arena, "../4coder-non-source/dist_files");
|
||||
dist_files[1] = fm_str(arena, "ship_files");
|
||||
dist_files[2] = fm_str(arena, "ship_files_super");
|
||||
|
||||
char *base_package_root = "../current_dist";
|
||||
printf("build dir: %s\n", build_dir);
|
||||
printf("pack dir: %s\n", pack_dir);
|
||||
printf("dist files: %s, %s, %s\n", dist_files[0], dist_files[1], dist_files[2]);
|
||||
fflush(stdout);
|
||||
|
||||
// NOTE(allen): alpha and super builds
|
||||
enum{
|
||||
Tier_Alpha = 0,
|
||||
Tier_Super = 1,
|
||||
Tier_COUNT = 2
|
||||
};
|
||||
|
||||
char *tiers[] = { "alpha", "super" };
|
||||
char *tier_names[] = { "demo", "super", };
|
||||
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO;
|
||||
u32 tier_flags[] = { 0, SUPER, };
|
||||
|
||||
for (u32 tier_index = 0; tier_index < Tier_COUNT; ++tier_index){
|
||||
char *tier = tiers[tier_index];
|
||||
u32 flags = base_flags | tier_flags[tier_index];
|
||||
fm_make_folder_if_missing(arena, pack_dir);
|
||||
|
||||
for (u32 i = 0; i < Tier_COUNT; i += 1){
|
||||
char *tier_name = tier_names[i];
|
||||
u32 flags = base_flags | tier_flags[i];
|
||||
|
||||
Temp_Memory temp = begin_temp(arena);
|
||||
char *tier_package_root = fm_str(arena, base_package_root, "_", tier);
|
||||
for (u32 arch = 0; arch < Arch_COUNT; ++arch){
|
||||
char *par_dir = fm_str(arena, tier_package_root, "_", arch_names[arch]);
|
||||
char *dir = fm_str(arena, par_dir, "/4coder");
|
||||
char *fonts_dir = fm_str(arena, dir, "/fonts");
|
||||
char *zip_dir = fm_str(arena, pack_dir, "/", tier, "_", arch_names[arch]);
|
||||
char *current_dist_tier = fm_str(arena, ".." SLASH "current_dist_", tier_name);
|
||||
|
||||
build_metadata();
|
||||
for (u32 arch = 0; arch < Arch_COUNT; ++arch){
|
||||
char *arch_name = arch_names[arch];
|
||||
char *parent_dir = fm_str(arena, current_dist_tier, "_", arch_name);
|
||||
char *dir = fm_str(arena, parent_dir, SLASH "4coder");
|
||||
char *zip_dir = fm_str(arena, pack_dir, SLASH, tier_name, "_", arch_name);
|
||||
|
||||
printf("\nbuild: %s_%s\n", tier_name, arch_name);
|
||||
printf("parent_dir: %s\n", parent_dir);
|
||||
printf("dir: %s\n", dir);
|
||||
printf("zip_dir: %s\n", zip_dir);
|
||||
fflush(stdout);
|
||||
|
||||
buildsuper(arena, cdir, fm_str(arena, default_custom_target), arch);
|
||||
build_main(arena, cdir, false, flags, arch);
|
||||
|
||||
fm_clear_folder(par_dir);
|
||||
|
||||
fm_make_folder_if_missing(arena, parent_dir);
|
||||
fm_clear_folder(parent_dir);
|
||||
fm_make_folder_if_missing(arena, dir);
|
||||
fm_copy_file(fm_str(arena, build_dir, "/4ed" EXE), fm_str(arena, dir, "/4ed" EXE));
|
||||
fm_copy_file(fm_str(arena, build_dir, "/4ed_app" DLL), fm_str(arena, dir, "/4ed_app" DLL));
|
||||
|
||||
fm_copy_folder(arena, cdir, dir, "themes");
|
||||
fm_copy_file(fm_str(arena, cdir, "/LICENSE.txt"), fm_str(arena, dir, "/LICENSE.txt"));
|
||||
fm_copy_file(fm_str(arena, cdir, "/README.txt"), fm_str(arena, dir, "/README.txt"));
|
||||
fm_copy_file(fm_str(arena, cdir, "/changes.txt"), fm_str(arena, dir, "/changes.txt"));
|
||||
|
||||
fm_make_folder_if_missing(arena, fonts_dir);
|
||||
fm_copy_all(fonts_source_dir, "*", fonts_dir);
|
||||
fm_copy_file(fm_str(arena, cdir, "/release-config.4coder"), fm_str(arena, dir, "/config.4coder"));
|
||||
|
||||
if (tier_index == Tier_Super){
|
||||
fm_copy_all(0, "4coder_*", dir);
|
||||
|
||||
do_buildsuper(arena, cdir, fm_str(arena, custom_files[Custom_Default]), arch);
|
||||
fm_copy_file(fm_str(arena, build_dir, "/custom_4coder" DLL), fm_str(arena, dir, "/custom_4coder" DLL));
|
||||
|
||||
char *build_script = fm_str(arena, "buildsuper_", arch_names[arch], BAT);
|
||||
fm_copy_file(build_script, fm_str(arena, dir, "/buildsuper" BAT));
|
||||
|
||||
if (This_OS == Platform_Windows){
|
||||
fm_copy_folder(arena, cdir, dir, "windows_scripts");
|
||||
i32 dist_file_count = ArrayCount(dist_files);
|
||||
if (i == Tier_Demo){
|
||||
dist_file_count -= 1;
|
||||
}
|
||||
|
||||
fm_copy_folder(arena, cdir, dir, "4coder_API");
|
||||
fm_copy_folder(arena, cdir, dir, "4coder_lib");
|
||||
fm_copy_folder(arena, cdir, dir, "4coder_generated");
|
||||
fm_copy_folder(arena, cdir, dir, "languages");
|
||||
for (i32 j = 0; j < dist_file_count; j += 1){
|
||||
fm_copy_all(dist_files[j], dir);
|
||||
}
|
||||
|
||||
char *dist_name = get_4coder_dist_name(arena, This_OS, tier, arch);
|
||||
char *zip_name = fm_str(arena, zip_dir, "/", dist_name, ".zip");
|
||||
if (i == Tier_Super){
|
||||
char *custom_src_dir = fm_str(arena, cdir, SLASH, "custom");
|
||||
char *custom_dst_dir = fm_str(arena, dir, SLASH, "custom");
|
||||
fm_make_folder_if_missing(arena, custom_dst_dir);
|
||||
fm_copy_all(custom_src_dir, custom_dst_dir);
|
||||
}
|
||||
|
||||
char *dist_name = get_4coder_dist_name(arena, This_OS, tier_name, arch);
|
||||
char *zip_name = fm_str(arena, zip_dir, SLASH, dist_name, ".zip");
|
||||
fm_make_folder_if_missing(arena, zip_dir);
|
||||
fm_zip(par_dir, "4coder", zip_name);
|
||||
fm_zip(parent_dir, "4coder", zip_name);
|
||||
}
|
||||
|
||||
end_temp(temp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
@echo off
|
||||
|
||||
build.bat /DPACKAGE
|
||||
bin\build.bat /DPACKAGE
|
||||
|
|
|
@ -57,7 +57,7 @@ internal void fm_make_folder_if_missing(Arena *arena, char *dir);
|
|||
internal void fm_clear_folder(char *folder);
|
||||
internal void fm_delete_file(char *file);
|
||||
internal void fm_copy_file(char *file, char *newname);
|
||||
internal void fm_copy_all(char *source, char *tag, char *folder);
|
||||
internal void fm_copy_all(char *source, char *folder);
|
||||
internal void fm_copy_folder(Arena *arena, char *src_dir, char *dst_dir, char *src_folder);
|
||||
|
||||
// File Reading and Writing
|
||||
|
@ -352,6 +352,7 @@ fm_make_folder_if_missing(Arena *arena, char *dir){
|
|||
internal void
|
||||
fm_clear_folder(char *folder){
|
||||
fprintf(stdout, "clearing folder %s\n", folder);
|
||||
fflush(stdout);
|
||||
systemf("del /S /Q /F %s\\* > nul & rmdir /S /Q %s > nul & mkdir %s > nul", folder, folder, folder);
|
||||
}
|
||||
|
||||
|
@ -362,19 +363,16 @@ fm_delete_file(char *file){
|
|||
|
||||
internal void
|
||||
fm_copy_file(char *file, char *newname){
|
||||
printf("copy %s to %s\n", file, newname);
|
||||
fflush(stdout);
|
||||
CopyFileA(file, newname, 0);
|
||||
}
|
||||
|
||||
internal void
|
||||
fm_copy_all(char *source, char *tag, char *folder){
|
||||
if (source){
|
||||
fprintf(stdout, "copy %s\\%s to %s\n", source, tag, folder);
|
||||
systemf("copy %s\\%s %s\\* > nul", source, tag, folder);
|
||||
}
|
||||
else{
|
||||
fprintf(stdout, "copy %s to %s\n", tag, folder);
|
||||
systemf("copy %s %s\\* > nul", tag, folder);
|
||||
}
|
||||
fm_copy_all(char *source, char *folder){
|
||||
fprintf(stdout, "copy %s to %s\n", source, folder);
|
||||
fflush(stdout);
|
||||
systemf("xcopy /s /e /y /q %s %s > nul", source, folder);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -396,14 +394,17 @@ fm_write_file(char *file_name, char *data, u32 size){
|
|||
|
||||
internal void
|
||||
fm_zip(char *parent, char *folder, char *dest){
|
||||
printf("zipping %s\\%s to %s\n", parent, folder, dest);
|
||||
fflush(stdout);
|
||||
|
||||
char cdir[512];
|
||||
fm_get_current_directory(cdir, sizeof(cdir));
|
||||
|
||||
Temp_Dir temp = fm_pushdir(parent);
|
||||
systemf("%s\\zip %s\\4ed_gobble.zip", cdir, cdir);
|
||||
systemf("%s\\bin\\zip %s\\4ed_gobble.zip > nul", cdir, cdir);
|
||||
fm_popdir(temp);
|
||||
|
||||
systemf("copy %s\\4ed_gobble.zip %s & del %s\\4ed_gobble.zip", cdir, dest, cdir);
|
||||
systemf("copy %s\\4ed_gobble.zip %s > nul & del %s\\4ed_gobble.zip > nul", cdir, dest, cdir);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -492,6 +493,7 @@ fm_make_folder_if_missing(Partition *part, char *dir){
|
|||
internal void
|
||||
fm_clear_folder(char *folder){
|
||||
fprintf(stdout, "clearing folder %s\n", folder);
|
||||
fflush(stdout);
|
||||
systemf("rm -rf %s* > /dev/null", folder);
|
||||
}
|
||||
|
||||
|
@ -544,7 +546,7 @@ fm_copy_folder(Arena *arena, char *src_dir, char *dst_dir, char *src_folder){
|
|||
Temp_Dir temp = fm_pushdir(src_dir);
|
||||
fm_make_folder_if_missing(arena, fm_str(arena, dst_dir, "/", src_folder));
|
||||
char *copy_name = fm_str(arena, dst_dir, "/", src_folder);
|
||||
fm_copy_all(src_folder, "*", copy_name);
|
||||
fm_copy_all(src_folder, copy_name);
|
||||
fm_popdir(temp);
|
||||
}
|
||||
|
||||
|
|
|
@ -136,11 +136,7 @@ get_standard_blacklist(Arena *arena){
|
|||
}
|
||||
|
||||
function void
|
||||
open_files_pattern_match(Application_Links *app,
|
||||
String_Const_u8 dir,
|
||||
Project_File_Pattern_Array whitelist,
|
||||
Project_File_Pattern_Array blacklist,
|
||||
u32 flags){
|
||||
open_files_pattern_match(Application_Links *app, String_Const_u8 dir, Project_File_Pattern_Array whitelist, Project_File_Pattern_Array blacklist, u32 flags){
|
||||
ProfileScope(app, "open all files in directory pattern");
|
||||
Scratch_Block scratch(app);
|
||||
String_Const_u8 directory = dir;
|
||||
|
@ -181,79 +177,6 @@ open_all_files_in_hot_with_extension(Application_Links *app, String_Const_u8_Arr
|
|||
# error no project configuration names for this platform
|
||||
#endif
|
||||
|
||||
function Project*
|
||||
parse_project__config_data__version_0(Application_Links *app, Arena *arena,
|
||||
String_Const_u8 file_dir, Config *parsed){
|
||||
Project *project = push_array_zero(arena, Project, 1);
|
||||
|
||||
// Set new project directory
|
||||
{
|
||||
project->dir = push_string_copy(arena, file_dir);
|
||||
|
||||
project->load_path_array.paths = push_array(arena, Project_File_Load_Path, 1);
|
||||
project->load_path_array.count = 1;
|
||||
|
||||
project->load_path_array.paths[0].path = project->dir;
|
||||
project->load_path_array.paths[0].recursive = false;
|
||||
project->load_path_array.paths[0].relative = false;
|
||||
|
||||
project->name = project->dir;
|
||||
}
|
||||
|
||||
// Read the settings from project.4coder
|
||||
String_Const_u8 str = {};
|
||||
if (config_string_var(parsed, "extensions", 0, &str)){
|
||||
String_Const_u8_Array extension_list =
|
||||
parse_extension_line_to_extension_list(app, arena, str);
|
||||
project->pattern_array = get_pattern_array_from_string_array(arena, extension_list);
|
||||
project->blacklist_pattern_array = get_standard_blacklist(arena);
|
||||
}
|
||||
|
||||
b32 open_recursively = false;
|
||||
if (config_bool_var(parsed, "open_recursively", 0, &open_recursively)){
|
||||
project->load_path_array.paths[0].recursive = open_recursively;
|
||||
}
|
||||
|
||||
char fkey_command_name[] = "fkey_command_" PlatformName;
|
||||
|
||||
project->command_array.commands = push_array(arena, Project_Command, 16);
|
||||
project->command_array.count = 16;
|
||||
|
||||
Project_Command *command = project->command_array.commands;
|
||||
for (i32 j = 1; j <= 16; ++j, ++command){
|
||||
project->fkey_commands[j - 1] = j - 1;
|
||||
block_zero_struct(command);
|
||||
|
||||
command->name = push_u8_stringf(arena, "%d", j);
|
||||
|
||||
Config_Compound *compound = 0;
|
||||
if (config_compound_var(parsed, fkey_command_name, j, &compound)){
|
||||
String_Const_u8 cmd = {};
|
||||
if (config_compound_string_member(parsed, compound, "cmd", 0, &cmd)){
|
||||
command->cmd = push_string_copy(arena, cmd);
|
||||
}
|
||||
|
||||
String_Const_u8 out = {};
|
||||
if (config_compound_string_member(parsed, compound, "out", 1, &out)){
|
||||
command->out = push_string_copy(arena, out);
|
||||
}
|
||||
|
||||
b32 footer_panel = false;
|
||||
if (config_compound_bool_member(parsed, compound, "footer_panel", 2, &footer_panel)){
|
||||
command->footer_panel = footer_panel;
|
||||
}
|
||||
|
||||
b32 save_dirty_files = false;
|
||||
if (config_compound_bool_member(parsed, compound, "save_dirty_files", 3, &save_dirty_files)){
|
||||
command->save_dirty_files = save_dirty_files;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project->loaded = true;
|
||||
return(project);
|
||||
}
|
||||
|
||||
function void
|
||||
parse_project__extract_pattern_array(Arena *arena, Config *parsed, char *root_variable_name, Project_File_Pattern_Array *array_out){
|
||||
Config_Compound *compound = 0;
|
||||
|
@ -288,8 +211,7 @@ parse_project__version_1__os_match(String_Const_u8 str, String_Const_u8 this_os_
|
|||
}
|
||||
|
||||
function Project*
|
||||
parse_project__config_data__version_1(Application_Links *app, Arena *arena,
|
||||
String_Const_u8 root_dir, Config *parsed){
|
||||
parse_project__config_data__version_1(Application_Links *app, Arena *arena, String_Const_u8 root_dir, Config *parsed){
|
||||
Project *project = push_array_zero(arena, Project, 1);
|
||||
|
||||
// Set new project directory
|
||||
|
@ -502,34 +424,25 @@ parse_project__config_data__version_1(Application_Links *app, Arena *arena,
|
|||
}
|
||||
|
||||
function Project*
|
||||
parse_project__config_data(Application_Links *app, Arena *arena,
|
||||
String_Const_u8 file_dir, Config *parsed){
|
||||
parse_project__config_data(Application_Links *app, Arena *arena, String_Const_u8 file_dir, Config *parsed){
|
||||
i32 version = 0;
|
||||
if (parsed->version != 0){
|
||||
version = *parsed->version;
|
||||
}
|
||||
|
||||
Project *result = 0;
|
||||
switch (version){
|
||||
case 0:
|
||||
{
|
||||
return(parse_project__config_data__version_0(app, arena, file_dir, parsed));
|
||||
}break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
return(parse_project__config_data__version_1(app, arena, file_dir, parsed));
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
return(0);
|
||||
result = parse_project__config_data__version_1(app, arena, file_dir, parsed);
|
||||
}break;
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
function Project_Parse_Result
|
||||
parse_project__data(Application_Links *app, Arena *arena, String_Const_u8 file_name,
|
||||
Data raw_data, String_Const_u8 file_dir){
|
||||
parse_project__data(Application_Links *app, Arena *arena, String_Const_u8 file_name, Data raw_data, String_Const_u8 file_dir){
|
||||
String_Const_u8 data = SCu8(raw_data);
|
||||
Project_Parse_Result result = {};
|
||||
Token_Array array = token_array_from_text(app, arena, data);
|
||||
|
|
|
@ -1,34 +1,52 @@
|
|||
@echo off
|
||||
|
||||
REM This stores the path of the buildsuper.bat script
|
||||
REM in CODE_HOME. This way you can always include the
|
||||
REM default files no matter where you store your code.
|
||||
REM And no matter how you call buildsuper.bat.
|
||||
set code_home=%~dp0
|
||||
if %code_home:~-1%==\ (set code_home=%code_home:~0,-1%)
|
||||
REM usage: <script> [target [mode]]
|
||||
REM works from any directory, but must remain in custom/bin path to work
|
||||
REM target : if specified determines the file that acts as the build target
|
||||
REM when not specified the build target is 4coder_default_bindings.cpp
|
||||
REM mode : if set to "release" builds with optimizations
|
||||
REM The build steps are:
|
||||
REM 1. preprocess the build target
|
||||
REM 2. build the metadata generator
|
||||
REM 3. run the metadata generator on the result from (1)
|
||||
REM 4. build the build target
|
||||
REM 5. cleanup after the metadata generator
|
||||
REM All output files are generated in the current directory when the script is run
|
||||
|
||||
if NOT "%Platform%" == "X86" IF NOT "%Platform%" == "x86" (call "%code_home%\windows_scripts\setup_cl_x86.bat")
|
||||
set location=%cd%
|
||||
set me="%~dp0"
|
||||
cd %me%
|
||||
cd ..
|
||||
set custom_root=%cd%
|
||||
set custom_bin=%custom_root%\bin
|
||||
cd %location%
|
||||
|
||||
set src=%1
|
||||
if "%src%" == "" set src=4coder_default_bindings.cpp
|
||||
if NOT "%Platform%" == "X86" IF NOT "%Platform%" == "x86" (call "%custom_bin%\setup_cl_x86.bat")
|
||||
|
||||
set target=%1
|
||||
if "%target%" == "" set target=%custom_root%\4coder_default_bindings.cpp
|
||||
|
||||
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX
|
||||
set opts=%opts% /GR- /nologo /FC
|
||||
set debug=/Zi
|
||||
set release=/O2 /Zi
|
||||
set build_dll=/LD /link /INCREMENTAL:NO /OPT:REF
|
||||
set build_dll=%build_dll% /EXPORT:get_version /EXPORT:init_apis
|
||||
|
||||
set mode=%debug%
|
||||
if "%2" == "release" (set mode=%release%)
|
||||
|
||||
set preproc_file=4coder_command_metadata.i
|
||||
set meta_macros=/DMETA_PASS
|
||||
cl /I"%code_home%" %opts% %mode% %src% /P /Fi%preproc_file% %meta_macros%
|
||||
cl /I"%code_home%" %opts% %mode% "%code_home%\4coder_metadata_generator.cpp" /Femetadata_generator
|
||||
metadata_generator -R "%code_home%" "%cd%\\%preproc_file%"
|
||||
set opts=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /wd4457 /WX
|
||||
set opts=%opts% /GR- /nologo /FC
|
||||
set opts=%opts% -I%custom_root%
|
||||
set opts=%opts% %mode%
|
||||
|
||||
cl %opts% /I"%code_home%" %mode% "%src%" /Fecustom_4coder %build_dll% %exports%
|
||||
set preproc_file=4coder_command_metadata.i
|
||||
set meta_opts=/P /Fi%preproc_file% /DMETA_PASS
|
||||
|
||||
set build_dll=/LD /link /INCREMENTAL:NO /OPT:REF /RELEASE /PDBALTPATH:%%%%_PDB%%%%
|
||||
set build_dll=%build_dll% /EXPORT:get_version /EXPORT:init_apis
|
||||
|
||||
call cl %opts% %meta_opts% %target%
|
||||
call cl %opts% "%custom_root%\4coder_metadata_generator.cpp" /Femetadata_generator
|
||||
metadata_generator -R "%custom_root%" "%cd%\%preproc_file%"
|
||||
|
||||
call cl %opts% %target% /Fecustom_4coder %build_dll%
|
||||
|
||||
REM file spammation preventation
|
||||
del metadata_generator*
|
||||
|
|
|
@ -405,17 +405,17 @@ static Command_Metadata fcoder_metacmd_table[214] = {
|
|||
{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 163 },
|
||||
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 178 },
|
||||
{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 184 },
|
||||
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 930 },
|
||||
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 936 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 942 },
|
||||
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 950 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 958 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 984 },
|
||||
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1318 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1325 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1331 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1337 },
|
||||
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1377 },
|
||||
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 843 },
|
||||
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 849 },
|
||||
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 855 },
|
||||
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 863 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 871 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 897 },
|
||||
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1231 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1238 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1244 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1250 },
|
||||
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1290 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), false, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 295 },
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
version(1);
|
||||
project_name = "4coder";
|
||||
|
||||
patterns = {
|
||||
"*.c",
|
||||
"*.cpp",
|
||||
|
@ -23,15 +24,20 @@ load_paths = {
|
|||
};
|
||||
|
||||
build_x64_win32 = "echo build: x64 & bin\\build.bat";
|
||||
build_x64_linux = "echo build: x64 & bin/build.sh";
|
||||
build_x64_mac = "echo build: x64 & bin/build.sh";
|
||||
build_x64_unix = "echo build: x64 & bin/build.sh";
|
||||
|
||||
command_list = {
|
||||
{ .name = "build x64",
|
||||
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||
.cmd = { {build_x64_win32, .os = "win" },
|
||||
{build_x64_linux, .os = "linux"},
|
||||
{build_x64_max , .os = "mac" }, }, },
|
||||
{build_x64_unix , .os = "linux"},
|
||||
{build_x64_unix , .os = "mac" }, }, },
|
||||
|
||||
{ .name = "package",
|
||||
.out = "*compilation*", .footer_panel = false, .save_dirty_files = true,
|
||||
.cmd = { {"echo package & bin\\package.bat", .os = "win" },
|
||||
{"echo package & bin/package.sh" , .os = "linux"},
|
||||
{"echo package & bin/package.sh" , .os = "mac" }, }, },
|
||||
|
||||
{ .name = "run one time",
|
||||
.out = "*run*", .footer_panel = false, .save_dirty_files = false,
|
||||
|
@ -79,5 +85,6 @@ fkey_command[2] = "build keycode generator";
|
|||
fkey_command[4] = "run one time";
|
||||
fkey_command[5] = "build C++ lexer generator";
|
||||
fkey_command[6] = "build token tester";
|
||||
fkey_command[11] = "package";
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
version(1);
|
||||
project_name = "4coder custom";
|
||||
|
||||
patterns = {
|
||||
"*.c",
|
||||
"*.cpp",
|
||||
"*.h",
|
||||
"*.m",
|
||||
"*.bat",
|
||||
"*.sh",
|
||||
"*.4coder",
|
||||
"*.txt",
|
||||
};
|
||||
blacklist_patterns = {
|
||||
".*",
|
||||
};
|
||||
load_paths_only = {
|
||||
{"."},
|
||||
};
|
||||
load_paths = {
|
||||
{ load_paths_only, .os = "win" },
|
||||
{ load_paths_only, .os = "linux"},
|
||||
{ load_paths_only, .os = "mac" },
|
||||
};
|
||||
|
||||
build_super_x64_win32 = "custom\\bin\\buildsuper_x64.bat";
|
||||
build_super_x86_win32 = "custom\\bin\\buildsuper_x86.bat";
|
||||
build_super_x64_unix = "custom/bin/buildsuper_x64.sh";
|
||||
build_super_x86_unix = "custom/bin/buildsuper_x86.sh";
|
||||
|
||||
command_list = {
|
||||
{ .name = "build super x64",
|
||||
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||
.cmd = { {build_super_x64_win32, .os ="win" },
|
||||
{build_super_x64_unix , .os ="linux"},
|
||||
{build_super_x64_unix , .os ="mac" }, }, },
|
||||
|
||||
{ .name = "build super x86",
|
||||
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||
.cmd = { {build_super_x86_win32, .os ="win" },
|
||||
{build_super_x86_unix, .os ="linux" },
|
||||
{build_super_x86_unix, .os ="mac" }, }, },
|
||||
|
||||
{ .name = "build C++ lexer generator",
|
||||
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||
.cmd = { {"custom\\bin\\build_one_time custom\\languages\\4coder_cpp_lexer_gen.cpp ..\\build", .os ="win" },
|
||||
}, },
|
||||
|
||||
{ .name = "build token tester",
|
||||
.out = "*compilation*", .footer_panel = true, .save_dirty_files = true,
|
||||
.cmd = { {"custom\\bin\\build_one_time custom\\languages\\4coder_cpp_lexer_test.cpp ..\\build", .os = "win" },
|
||||
}, },
|
||||
|
||||
{ .name = "run one time",
|
||||
.out = "*run*", .footer_panel = false, .save_dirty_files = false,
|
||||
.cmd = { {"pushd ..\\build & one_time", .os = "win" },
|
||||
}, },
|
||||
};
|
||||
|
||||
fkey_command[1] = "build super x64";
|
||||
fkey_command[2] = "build C++ lexer generator";
|
||||
fkey_command[3] = "build token tester";
|
||||
fkey_command[4] = "run one time";
|
||||
fkey_command[5] = "build super x86";
|
Loading…
Reference in New Issue