2016-08-28 04:31:06 +00:00
|
|
|
/*
|
2017-04-01 06:15:47 +00:00
|
|
|
4coder development build rule.
|
2016-08-28 04:31:06 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#include "../4tech_defines.h"
|
|
|
|
#include "4tech_file_moving.h"
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
#include <assert.h>
|
2016-09-04 20:41:48 +00:00
|
|
|
#include <string.h>
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#include "../4coder_API/version.h"
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#define FSTRING_IMPLEMENTATION
|
|
|
|
#include "../4coder_lib/4coder_string.h"
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
//
|
|
|
|
// reusable
|
|
|
|
//
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
#define IS_64BIT
|
|
|
|
|
2017-03-19 18:25:12 +00:00
|
|
|
#define LLU_CAST(n) (long long unsigned int)(n)
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
#define BEGIN_TIME_SECTION() uint64_t start = get_time()
|
2017-03-19 18:25:12 +00:00
|
|
|
#define END_TIME_SECTION(n) uint64_t total = get_time() - start; printf("%-20s: %.2llu.%.6llu\n", (n), LLU_CAST(total/1000000), LLU_CAST(total%1000000));
|
2016-08-28 15:42:12 +00:00
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
//
|
|
|
|
// 4coder specific
|
|
|
|
//
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
#define EXE ".exe"
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
#define EXE ""
|
|
|
|
#else
|
|
|
|
#error No EXE format specified for this OS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
#define PDB ".pdb"
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
#define PDB ""
|
|
|
|
#else
|
|
|
|
#error No EXE format specified for this OS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
#define DLL ".dll"
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
#define DLL ".so"
|
|
|
|
#else
|
|
|
|
#error No EXE format specified for this OS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
#define BAT ".bat"
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
#define BAT ".sh"
|
|
|
|
#else
|
|
|
|
#error No EXE format specified for this OS
|
|
|
|
#endif
|
2016-08-28 04:31:06 +00:00
|
|
|
|
|
|
|
static void
|
2016-09-04 20:41:48 +00:00
|
|
|
swap_ptr(char **A, char **B){
|
|
|
|
char *a = *A;
|
|
|
|
char *b = *B;
|
2016-08-28 04:31:06 +00:00
|
|
|
*A = b;
|
|
|
|
*B = a;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum{
|
|
|
|
OPTS = 0x1,
|
|
|
|
INCLUDES = 0x2,
|
|
|
|
LIBS = 0x4,
|
|
|
|
ICON = 0x8,
|
|
|
|
SHARED_CODE = 0x10,
|
2016-08-28 17:31:43 +00:00
|
|
|
DEBUG_INFO = 0x20,
|
|
|
|
SUPER = 0x40,
|
|
|
|
INTERNAL = 0x80,
|
2016-08-31 01:44:02 +00:00
|
|
|
OPTIMIZATION = 0x100,
|
2016-11-14 04:29:00 +00:00
|
|
|
KEEP_ASSERT = 0x200,
|
|
|
|
SITE_INCLUDES = 0x400,
|
2017-02-23 00:22:59 +00:00
|
|
|
X86 = 0x800,
|
2016-08-28 04:31:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
#define BUILD_LINE_MAX 4096
|
|
|
|
typedef struct Build_Line{
|
|
|
|
char build_optionsA[BUILD_LINE_MAX];
|
|
|
|
char build_optionsB[BUILD_LINE_MAX];
|
|
|
|
char *build_options;
|
|
|
|
char *build_options_prev;
|
2017-01-23 06:19:43 +00:00
|
|
|
i32 build_max;
|
2016-09-04 20:41:48 +00:00
|
|
|
} Build_Line;
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_build_line(Build_Line *line){
|
|
|
|
line->build_options = line->build_optionsA;
|
|
|
|
line->build_options_prev = line->build_optionsB;
|
|
|
|
line->build_optionsA[0] = 0;
|
|
|
|
line->build_optionsB[0] = 0;
|
|
|
|
line->build_max = BUILD_LINE_MAX;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(IS_CL)
|
|
|
|
|
|
|
|
#define build_ap(line, str, ...) do{ \
|
|
|
|
snprintf(line.build_options, \
|
|
|
|
line.build_max, "%s "str, \
|
|
|
|
line.build_options_prev, __VA_ARGS__); \
|
|
|
|
swap_ptr(&line.build_options, \
|
|
|
|
&line.build_options_prev); \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#elif defined(IS_GCC)
|
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#define build_ap(line, str, ...) do{ \
|
|
|
|
snprintf(line.build_options, line.build_max, "%s "str, \
|
|
|
|
line.build_options_prev, ##__VA_ARGS__); \
|
|
|
|
swap_ptr(&line.build_options, &line.build_options_prev); \
|
2016-09-04 20:41:48 +00:00
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CL_OPTS \
|
2017-01-23 06:19:43 +00:00
|
|
|
"-W4 -wd4310 -wd4100 -wd4201 -wd4505 -wd4996 " \
|
|
|
|
"-wd4127 -wd4510 -wd4512 -wd4610 -wd4390 " \
|
|
|
|
"-wd4611 -WX -GR- -EHa- -nologo -FC"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2016-11-24 06:02:18 +00:00
|
|
|
#define CL_INCLUDES "/I..\\foreign /I..\\foreign\\freetype2"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2016-11-28 19:13:53 +00:00
|
|
|
#define CL_SITE_INCLUDES "/I..\\..\\foreign /I..\\..\\code"
|
2016-11-14 04:29:00 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
#define CL_LIBS_X64 \
|
2016-09-04 20:41:48 +00:00
|
|
|
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
2017-02-25 01:53:40 +00:00
|
|
|
"..\\foreign_x64\\freetype.lib"
|
|
|
|
|
|
|
|
#define CL_LIBS_X86 \
|
|
|
|
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
|
|
|
"..\\foreign_x86\\freetype.lib"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2016-11-24 06:02:18 +00:00
|
|
|
#define CL_ICON "..\\res\\icon.res"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2017-02-23 00:22:59 +00:00
|
|
|
#define CL_X86 "-MACHINE:X86"
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
static void
|
2017-01-23 06:19:43 +00:00
|
|
|
build_cl(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
2016-09-04 20:41:48 +00:00
|
|
|
Build_Line line;
|
|
|
|
init_build_line(&line);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
Build_Line link_line;
|
2017-02-23 00:22:59 +00:00
|
|
|
init_build_line(&link_line);
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
Build_Line line_prefix;
|
|
|
|
init_build_line(&line_prefix);
|
|
|
|
|
|
|
|
if (flags & X86){
|
|
|
|
build_ap(line_prefix, "SETUP_CLX86 & ");
|
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & OPTS){
|
|
|
|
build_ap(line, CL_OPTS);
|
|
|
|
}
|
|
|
|
|
2017-03-24 23:41:10 +00:00
|
|
|
if (flags & X86){
|
|
|
|
build_ap(line, "/DFTECH_32_BIT");
|
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & INCLUDES){
|
|
|
|
build_ap(line, CL_INCLUDES);
|
|
|
|
}
|
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
if (flags & SITE_INCLUDES){
|
|
|
|
build_ap(line, CL_SITE_INCLUDES);
|
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & LIBS){
|
2017-02-25 01:53:40 +00:00
|
|
|
if (flags & X86){
|
|
|
|
build_ap(line, CL_LIBS_X86);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
build_ap(line, CL_LIBS_X64);
|
|
|
|
}
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & ICON){
|
|
|
|
build_ap(line, CL_ICON);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
|
|
|
build_ap(line, "/Zi");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & OPTIMIZATION){
|
|
|
|
build_ap(line, "/O2");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SHARED_CODE){
|
|
|
|
build_ap(line, "/LD");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SUPER){
|
|
|
|
build_ap(line, "/DFRED_SUPER");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INTERNAL){
|
|
|
|
build_ap(line, "/DFRED_INTERNAL");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & KEEP_ASSERT){
|
|
|
|
build_ap(line, "/DFRED_KEEP_ASSERT");
|
|
|
|
}
|
|
|
|
|
2017-02-23 00:22:59 +00:00
|
|
|
if (flags & X86){
|
|
|
|
build_ap(link_line, CL_X86);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
2017-02-24 02:30:29 +00:00
|
|
|
build_ap(link_line, "/DEBUG");
|
2017-02-23 00:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char link_type_string[1024];
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & SHARED_CODE){
|
|
|
|
assert(exports);
|
2017-02-23 00:22:59 +00:00
|
|
|
snprintf(link_type_string, sizeof(link_type_string), "/OPT:REF %s", exports);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
else{
|
2017-02-23 00:22:59 +00:00
|
|
|
snprintf(link_type_string, sizeof(link_type_string), "/NODEFAULTLIB:library");
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
2017-02-23 00:22:59 +00:00
|
|
|
build_ap(link_line, "%s", link_type_string);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-02-24 02:30:29 +00:00
|
|
|
swap_ptr(&line.build_options, &line.build_options_prev);
|
|
|
|
swap_ptr(&link_line.build_options, &link_line.build_options_prev);
|
2017-02-25 01:53:40 +00:00
|
|
|
swap_ptr(&line_prefix.build_options, &line_prefix.build_options_prev);
|
|
|
|
|
2016-11-24 06:02:18 +00:00
|
|
|
Temp_Dir temp = pushdir(out_path);
|
2017-03-17 04:48:27 +00:00
|
|
|
systemf("%scl %s \"%s\\%s\" /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, code_path, code_file, out_file, link_line.build_options);
|
2016-11-24 06:02:18 +00:00
|
|
|
popdir(temp);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define GCC_OPTS \
|
|
|
|
"-Wno-write-strings -D_GNU_SOURCE -fPIC " \
|
2016-11-14 04:29:00 +00:00
|
|
|
"-fno-threadsafe-statics -pthread"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2017-02-26 20:13:06 +00:00
|
|
|
#define GCC_X86 "-m32"
|
|
|
|
|
|
|
|
#define GCC_X64 "-m64"
|
|
|
|
|
2016-11-24 06:02:18 +00:00
|
|
|
#define GCC_INCLUDES "-I../foreign -I../code"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2016-11-28 19:13:53 +00:00
|
|
|
#define GCC_SITE_INCLUDES "-I../../foreign -I../../code"
|
2016-11-14 04:29:00 +00:00
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
#define GCC_LIBS \
|
|
|
|
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
|
|
|
|
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
|
|
|
|
|
|
|
|
static void
|
2017-01-23 06:19:43 +00:00
|
|
|
build_gcc(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
2016-09-04 20:41:48 +00:00
|
|
|
Build_Line line;
|
|
|
|
init_build_line(&line);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-02-26 20:13:06 +00:00
|
|
|
if (flags & X86){
|
|
|
|
build_ap(line, GCC_X86);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
build_ap(line, GCC_X64);
|
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & OPTS){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, GCC_OPTS);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INCLUDES){
|
2016-09-05 01:27:37 +00:00
|
|
|
// TODO(allen): Abstract this out.
|
2016-09-05 03:32:26 +00:00
|
|
|
#if defined(IS_LINUX)
|
2017-01-23 06:19:43 +00:00
|
|
|
i32 size = 0;
|
2016-09-04 20:41:48 +00:00
|
|
|
char freetype_include[512];
|
|
|
|
FILE *file = popen("pkg-config --cflags freetype2", "r");
|
|
|
|
if (file != 0){
|
|
|
|
fgets(freetype_include, sizeof(freetype_include), file);
|
|
|
|
size = strlen(freetype_include);
|
|
|
|
freetype_include[size-1] = 0;
|
|
|
|
pclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
build_ap(line, GCC_INCLUDES" %s", freetype_include);
|
2016-09-05 01:27:37 +00:00
|
|
|
#endif
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
if (flags & SITE_INCLUDES){
|
|
|
|
build_ap(line, GCC_SITE_INCLUDES);
|
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & DEBUG_INFO){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-g -O0");
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
if (flags & OPTIMIZATION){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-O3");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & SHARED_CODE){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-shared");
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
if (flags & SUPER){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-DFRED_SUPER");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INTERNAL){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-DFRED_INTERNAL");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
if (flags & KEEP_ASSERT){
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "-DFRED_KEEP_ASSERT");
|
2016-08-31 01:44:02 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
build_ap(line, "%s/%s", code_path, code_file);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & LIBS){
|
|
|
|
build_ap(line, GCC_LIBS);
|
|
|
|
}
|
|
|
|
|
|
|
|
swap_ptr(&line.build_options, &line.build_options_prev);
|
|
|
|
|
2016-11-23 03:37:28 +00:00
|
|
|
Temp_Dir temp = pushdir(out_path);
|
2016-09-04 20:41:48 +00:00
|
|
|
systemf("g++ %s -o %s", line.build_options, out_file);
|
2016-11-23 03:37:28 +00:00
|
|
|
popdir(temp);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-04-01 06:15:47 +00:00
|
|
|
build(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
2016-08-28 04:31:06 +00:00
|
|
|
#if defined(IS_CL)
|
2017-04-01 06:15:47 +00:00
|
|
|
build_cl(flags, code_path, code_file, out_path, out_file, exports);
|
2016-09-04 20:41:48 +00:00
|
|
|
#elif defined(IS_GCC)
|
2017-04-01 06:15:47 +00:00
|
|
|
build_gcc(flags, code_path, code_file, out_path, out_file, exports);
|
2016-08-28 04:31:06 +00:00
|
|
|
#else
|
2017-04-01 06:15:47 +00:00
|
|
|
#error The build rule for this compiler is not ready
|
2016-08-28 04:31:06 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-02-25 01:53:40 +00:00
|
|
|
buildsuper(char *code_path, char *out_path, char *filename, b32 x86_build){
|
2016-11-24 06:02:18 +00:00
|
|
|
Temp_Dir temp = pushdir(out_path);
|
2016-08-28 04:31:06 +00:00
|
|
|
#if defined(IS_CL)
|
2017-02-25 01:53:40 +00:00
|
|
|
{
|
|
|
|
char *prefix = "";
|
|
|
|
char *build_script = "buildsuper.bat";
|
|
|
|
if (x86_build){
|
|
|
|
prefix = "setup_clx86 & ";
|
|
|
|
build_script = "buildsuper_x86.bat";
|
|
|
|
}
|
|
|
|
systemf("%scall \"%s\\%s\" %s", prefix, code_path, build_script, filename);
|
|
|
|
}
|
2016-09-04 20:41:48 +00:00
|
|
|
#elif defined(IS_GCC)
|
2017-02-25 01:53:40 +00:00
|
|
|
{
|
2017-03-17 17:45:41 +00:00
|
|
|
systemf("\"%s/buildsuper.sh\" \"%s\"", code_path, filename);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
#else
|
|
|
|
#error The build rule for this compiler is not ready
|
|
|
|
#endif
|
2016-11-24 06:02:18 +00:00
|
|
|
popdir(temp);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
#define PLAT_LAYER "win32_4ed.cpp"
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
#define PLAT_LAYER "linux_4ed.cpp"
|
|
|
|
#else
|
|
|
|
#error No platform layer defined for this OS.
|
|
|
|
#endif
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
#define META_DIR "../meta"
|
|
|
|
#define BUILD_DIR "../build"
|
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
static void
|
2016-09-04 23:58:49 +00:00
|
|
|
fsm_generator(char *cdir){
|
2016-08-29 01:03:26 +00:00
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
DECL_STR(file, "meta/fsm_table_generator.cpp");
|
|
|
|
DECL_STR(dir, META_DIR);
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
|
|
|
build(OPTS | DEBUG_INFO, cdir, file, dir, "fsmgen", 0);
|
|
|
|
END_TIME_SECTION("build fsm generator");
|
2016-08-29 01:03:26 +00:00
|
|
|
}
|
2016-08-30 21:23:34 +00:00
|
|
|
|
2016-09-06 01:46:41 +00:00
|
|
|
if (prev_error == 0){
|
2017-04-01 06:15:47 +00:00
|
|
|
DECL_STR(cmd, META_DIR"/fsmgen");
|
|
|
|
BEGIN_TIME_SECTION();
|
|
|
|
execute_in_dir(cdir, cmd, 0);
|
|
|
|
END_TIME_SECTION("run fsm generator");
|
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
metagen(char *cdir){
|
2016-08-28 17:31:43 +00:00
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
DECL_STR(file, "meta/4ed_metagen.cpp");
|
|
|
|
DECL_STR(dir, META_DIR);
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
|
|
|
build(OPTS | INCLUDES | DEBUG_INFO, cdir, file, dir, "metagen", 0);
|
|
|
|
END_TIME_SECTION("build metagen");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-04-01 06:15:47 +00:00
|
|
|
if (prev_error == 0){
|
|
|
|
DECL_STR(cmd, META_DIR "/metagen");
|
|
|
|
BEGIN_TIME_SECTION();
|
|
|
|
execute_in_dir(cdir, cmd, 0);
|
|
|
|
END_TIME_SECTION("run metagen");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
2016-12-14 16:09:54 +00:00
|
|
|
enum{
|
|
|
|
Custom_Default,
|
|
|
|
Custom_Experiments,
|
|
|
|
Custom_Casey,
|
|
|
|
Custom_ChronalVim,
|
2017-01-07 02:59:55 +00:00
|
|
|
Custom_COUNT
|
2016-12-14 16:09:54 +00:00
|
|
|
};
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
static void
|
2017-02-25 01:53:40 +00:00
|
|
|
do_buildsuper(char *cdir, i32 custom_option, u32 flags){
|
2017-04-01 06:15:47 +00:00
|
|
|
char space[1024];
|
|
|
|
String str = make_fixed_width_string(space);
|
2016-10-28 21:25:16 +00:00
|
|
|
|
2017-04-01 06:15:47 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2016-12-14 16:09:54 +00:00
|
|
|
|
|
|
|
switch (custom_option){
|
|
|
|
case Custom_Default:
|
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
copy_sc(&str, "../code/4coder_default_bindings.cpp");
|
2016-12-14 16:09:54 +00:00
|
|
|
}break;
|
2016-12-27 20:04:41 +00:00
|
|
|
|
2016-12-14 16:09:54 +00:00
|
|
|
case Custom_Experiments:
|
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
copy_sc(&str, "../code/power/4coder_experiments.cpp");
|
2016-12-27 20:04:41 +00:00
|
|
|
}break;
|
2016-12-14 16:09:54 +00:00
|
|
|
|
2016-12-27 20:04:41 +00:00
|
|
|
case Custom_Casey:
|
2016-12-14 16:09:54 +00:00
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
copy_sc(&str, "../code/power/4coder_casey.cpp");
|
2016-12-14 16:09:54 +00:00
|
|
|
}break;
|
|
|
|
|
|
|
|
case Custom_ChronalVim:
|
|
|
|
{
|
2017-04-01 06:15:47 +00:00
|
|
|
copy_sc(&str, "../4vim/4coder_chronal.cpp");
|
2016-12-14 16:09:54 +00:00
|
|
|
}break;
|
|
|
|
}
|
2017-04-01 06:15:47 +00:00
|
|
|
terminate_with_null(&str);
|
2017-01-07 02:59:55 +00:00
|
|
|
|
2017-04-01 06:15:47 +00:00
|
|
|
b32 x86_build = false;
|
|
|
|
if (flags & X86){
|
|
|
|
x86_build = true;
|
|
|
|
}
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(dir, BUILD_DIR);
|
2017-02-25 01:53:40 +00:00
|
|
|
buildsuper(cdir, dir, str.str, x86_build);
|
2017-01-07 02:59:55 +00:00
|
|
|
|
2017-04-01 06:15:47 +00:00
|
|
|
END_TIME_SECTION("build custom");
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-01-23 06:19:43 +00:00
|
|
|
build_main(char *cdir, u32 flags){
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(dir, BUILD_DIR);
|
2017-02-18 01:04:41 +00:00
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
{
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(file, "4ed_app_target.cpp");
|
2016-08-28 17:31:43 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-03-17 04:48:27 +00:00
|
|
|
build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, file, dir, "4ed_app" DLL, "/EXPORT:app_get_functions");
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed_app");
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-07 02:59:55 +00:00
|
|
|
build(OPTS | INCLUDES | LIBS | ICON | flags, cdir, PLAT_LAYER, dir, "4ed", 0);
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed");
|
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
static void
|
2017-01-23 06:19:43 +00:00
|
|
|
standard_build(char *cdir, u32 flags){
|
2016-09-04 23:58:49 +00:00
|
|
|
fsm_generator(cdir);
|
|
|
|
metagen(cdir);
|
2017-05-27 20:04:13 +00:00
|
|
|
do_buildsuper(cdir, Custom_Default, flags);
|
2017-05-21 01:22:20 +00:00
|
|
|
//do_buildsuper(cdir, Custom_Experiments, flags);
|
2017-05-27 20:04:13 +00:00
|
|
|
//do_buildsuper(cdir, Custom_Casey, flags);
|
2017-02-25 01:53:40 +00:00
|
|
|
//do_buildsuper(cdir, Custom_ChronalVim, flags);
|
2016-09-06 21:22:35 +00:00
|
|
|
build_main(cdir, flags);
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
static void
|
2017-01-23 06:19:43 +00:00
|
|
|
site_build(char *cdir, u32 flags){
|
2016-11-14 06:39:03 +00:00
|
|
|
{
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(file, "site/sitegen.cpp");
|
|
|
|
DECL_STR(dir, BUILD_DIR"/site");
|
2016-12-08 17:16:50 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-07 02:59:55 +00:00
|
|
|
build(OPTS | SITE_INCLUDES | flags, cdir, file, dir, "sitegen", 0);
|
2016-12-08 17:16:50 +00:00
|
|
|
END_TIME_SECTION("build sitegen");
|
2016-11-14 06:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(cmd, "../build/site/sitegen . ../site_resources site/source_material ../site");
|
2017-01-23 06:19:43 +00:00
|
|
|
systemf("%s", cmd);
|
2016-11-22 18:26:58 +00:00
|
|
|
END_TIME_SECTION("run sitegen");
|
2016-11-14 06:39:03 +00:00
|
|
|
}
|
2016-11-14 04:29:00 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
#define PACK_DIR "../distributions"
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
static void
|
2017-02-26 21:44:40 +00:00
|
|
|
get_4coder_dist_name(String *zip_file, b32 OS_specific, char *folder, char *tier, char *arch, char *ext){
|
2016-09-04 23:58:49 +00:00
|
|
|
zip_file->size = 0;
|
2016-09-05 03:23:33 +00:00
|
|
|
|
2017-01-07 02:59:55 +00:00
|
|
|
append_sc(zip_file, PACK_DIR"/");
|
2017-02-26 21:44:40 +00:00
|
|
|
if (folder != 0){
|
|
|
|
append_sc(zip_file, folder);
|
|
|
|
append_sc(zip_file, "/");
|
|
|
|
}
|
|
|
|
append_sc(zip_file, "4coder-");
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2016-09-05 03:23:33 +00:00
|
|
|
append_sc (zip_file, "alpha");
|
2016-09-04 23:58:49 +00:00
|
|
|
append_sc (zip_file, "-");
|
|
|
|
append_int_to_str (zip_file, MAJOR);
|
|
|
|
append_sc (zip_file, "-");
|
|
|
|
append_int_to_str (zip_file, MINOR);
|
|
|
|
append_sc (zip_file, "-");
|
|
|
|
append_int_to_str (zip_file, PATCH);
|
2017-02-27 15:01:02 +00:00
|
|
|
if (tier != 0 && !match_cc(tier, "alpha")){
|
2016-09-05 03:23:33 +00:00
|
|
|
append_sc (zip_file, "-");
|
|
|
|
append_sc (zip_file, tier);
|
|
|
|
}
|
2017-02-27 14:53:38 +00:00
|
|
|
if (OS_specific){
|
|
|
|
#if defined(IS_WINDOWS)
|
2017-02-27 15:01:02 +00:00
|
|
|
append_sc(zip_file, "-win");
|
2017-02-27 14:53:38 +00:00
|
|
|
#elif defined(IS_LINUX) && defined(IS_64BIT)
|
2017-02-27 15:01:02 +00:00
|
|
|
append_sc(zip_file, "-linux");
|
2017-02-27 14:53:38 +00:00
|
|
|
#else
|
|
|
|
#error No OS string for zips on this OS
|
|
|
|
#endif
|
|
|
|
}
|
2017-02-26 21:44:40 +00:00
|
|
|
if (arch != 0){
|
|
|
|
append_sc (zip_file, "-");
|
|
|
|
append_sc (zip_file, arch);
|
|
|
|
}
|
|
|
|
append_sc (zip_file, ".");
|
|
|
|
append_sc (zip_file, ext);
|
2016-09-04 23:58:49 +00:00
|
|
|
terminate_with_null(zip_file);
|
2017-02-03 00:52:39 +00:00
|
|
|
|
|
|
|
slash_fix(zip_file->str);
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
package(char *cdir){
|
2016-09-05 03:23:33 +00:00
|
|
|
char str_space[1024];
|
2017-03-30 20:11:26 +00:00
|
|
|
String str = make_fixed_width_string(str_space);
|
2016-09-04 23:58:49 +00:00
|
|
|
|
|
|
|
// NOTE(allen): meta
|
|
|
|
fsm_generator(cdir);
|
|
|
|
metagen(cdir);
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
#define SITE_DIR "../site"
|
2017-03-30 20:11:26 +00:00
|
|
|
#define PACK_DATA_DIR "../data/dist_files"
|
|
|
|
#define PACK_FONTS_DIR PACK_DATA_DIR"/fonts"
|
2017-02-25 01:53:40 +00:00
|
|
|
#define DATA_DIR "../data/test"
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(build_dir, BUILD_DIR);
|
|
|
|
DECL_STR(site_dir, SITE_DIR);
|
|
|
|
DECL_STR(pack_dir, PACK_DIR);
|
|
|
|
DECL_STR(pack_data_dir, PACK_DATA_DIR);
|
2017-03-30 20:11:26 +00:00
|
|
|
DECL_STR(pack_fonts_dir, PACK_FONTS_DIR);
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(data_dir, DATA_DIR);
|
|
|
|
|
2017-03-30 20:11:26 +00:00
|
|
|
#define PACK_ALPHA_PAR_DIR "../current_dist"
|
|
|
|
#define PACK_ALPHA_DIR PACK_ALPHA_PAR_DIR"/4coder"
|
|
|
|
#define PACK_ALPHA_FONTS_DIR PACK_ALPHA_DIR"/fonts"
|
2017-01-07 02:59:55 +00:00
|
|
|
DECL_STR(pack_alpha_par_dir, PACK_ALPHA_PAR_DIR);
|
|
|
|
DECL_STR(pack_alpha_dir, PACK_ALPHA_DIR);
|
2017-03-30 20:11:26 +00:00
|
|
|
DECL_STR(pack_alpha_fonts_dir, PACK_ALPHA_FONTS_DIR);
|
2017-01-07 02:59:55 +00:00
|
|
|
|
2017-03-30 20:11:26 +00:00
|
|
|
#define PACK_ALPHA_X86_PAR_DIR "../current_dist_x86"
|
|
|
|
#define PACK_ALPHA_X86_DIR PACK_ALPHA_X86_PAR_DIR"/4coder"
|
|
|
|
#define PACK_ALPHA_X86_FONTS_DIR PACK_ALPHA_X86_DIR"/fonts"
|
2017-02-25 01:53:40 +00:00
|
|
|
DECL_STR(pack_alpha_x86_par_dir, PACK_ALPHA_X86_PAR_DIR);
|
|
|
|
DECL_STR(pack_alpha_x86_dir, PACK_ALPHA_X86_DIR);
|
2017-03-30 20:11:26 +00:00
|
|
|
DECL_STR(pack_alpha_x86_fonts_dir, PACK_ALPHA_X86_FONTS_DIR);
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
// NOTE(allen): alpha
|
|
|
|
{
|
|
|
|
char *dest_dirs[] = {
|
|
|
|
pack_alpha_dir,
|
|
|
|
pack_alpha_x86_dir,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *dest_par_dirs[] = {
|
2017-02-26 20:13:06 +00:00
|
|
|
pack_alpha_par_dir,
|
|
|
|
pack_alpha_x86_par_dir,
|
2017-02-25 01:53:40 +00:00
|
|
|
};
|
|
|
|
|
2017-03-30 20:11:26 +00:00
|
|
|
char *dest_fonts_dirs[] = {
|
|
|
|
pack_alpha_fonts_dir,
|
|
|
|
pack_alpha_x86_fonts_dir,
|
|
|
|
};
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
char *zip_dirs[] = {
|
|
|
|
"alpha",
|
|
|
|
"alpha_x86",
|
|
|
|
};
|
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
char *tier = "alpha";
|
|
|
|
|
|
|
|
char *archs[] = {
|
|
|
|
"x64",
|
|
|
|
"x86",
|
|
|
|
};
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs));
|
|
|
|
u32 count = ArrayCount(dest_dirs);
|
2017-01-23 06:19:43 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO;
|
|
|
|
u32 flags[] = {
|
|
|
|
0,
|
|
|
|
X86,
|
|
|
|
};
|
2017-01-23 06:19:43 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
for (u32 i = 0; i < count; ++i){
|
|
|
|
char *dir = dest_dirs[i];
|
|
|
|
char *par_dir = dest_par_dirs[i];
|
2017-03-30 20:11:26 +00:00
|
|
|
char *fonts_dir = dest_fonts_dirs[i];
|
2017-02-25 01:53:40 +00:00
|
|
|
char *zip_dir = zip_dirs[i];
|
2017-02-26 21:44:40 +00:00
|
|
|
char *arch = archs[i];
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
build_main(cdir, base_flags | flags[i]);
|
|
|
|
|
|
|
|
clear_folder(par_dir);
|
2017-03-30 20:11:26 +00:00
|
|
|
make_folder_if_missing(dir, 0);
|
|
|
|
make_folder_if_missing(dir, "fonts");
|
2017-02-25 01:53:40 +00:00
|
|
|
make_folder_if_missing(pack_dir, zip_dir);
|
2017-03-17 04:48:27 +00:00
|
|
|
copy_file(build_dir, "4ed" EXE, dir, 0, 0);
|
|
|
|
copy_file(build_dir, "4ed_app" DLL, dir, 0, 0);
|
2017-03-30 20:11:26 +00:00
|
|
|
copy_all(pack_fonts_dir, "*", fonts_dir);
|
2017-02-25 01:53:40 +00:00
|
|
|
copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder");
|
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip");
|
2017-02-25 01:53:40 +00:00
|
|
|
zip(par_dir, "4coder", str.str);
|
|
|
|
}
|
2017-01-23 06:19:43 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
// NOTE(allen): super
|
2017-03-30 20:11:26 +00:00
|
|
|
#define PACK_SUPER_PAR_DIR "../current_dist_super"
|
|
|
|
#define PACK_SUPER_DIR PACK_SUPER_PAR_DIR"/4coder"
|
|
|
|
#define PACK_SUPER_FONTS_DIR PACK_SUPER_DIR"/fonts"
|
2017-02-25 01:53:40 +00:00
|
|
|
DECL_STR(pack_super_par_dir, PACK_SUPER_PAR_DIR);
|
|
|
|
DECL_STR(pack_super_dir, PACK_SUPER_DIR);
|
2017-03-30 20:11:26 +00:00
|
|
|
DECL_STR(pack_super_fonts_dir, PACK_SUPER_FONTS_DIR);
|
2016-09-05 02:59:02 +00:00
|
|
|
|
2017-03-30 20:11:26 +00:00
|
|
|
#define PACK_SUPER_X86_PAR_DIR "../current_dist_super_x86"
|
|
|
|
#define PACK_SUPER_X86_DIR PACK_SUPER_X86_PAR_DIR"/4coder"
|
|
|
|
#define PACK_SUPER_X86_FONTS_DIR PACK_SUPER_X86_DIR"/fonts"
|
2017-02-25 01:53:40 +00:00
|
|
|
DECL_STR(pack_super_x86_par_dir, PACK_SUPER_X86_PAR_DIR);
|
|
|
|
DECL_STR(pack_super_x86_dir, PACK_SUPER_X86_DIR);
|
2017-03-30 20:11:26 +00:00
|
|
|
DECL_STR(pack_super_x86_fonts_dir, PACK_SUPER_X86_FONTS_DIR);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
char *dest_dirs[] = {
|
|
|
|
pack_super_dir,
|
|
|
|
pack_super_x86_dir,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *dest_par_dirs[] = {
|
2017-02-26 20:13:06 +00:00
|
|
|
pack_super_par_dir,
|
|
|
|
pack_super_x86_par_dir,
|
2017-02-25 01:53:40 +00:00
|
|
|
};
|
|
|
|
|
2017-03-30 20:11:26 +00:00
|
|
|
char *dest_fonts_dirs[] = {
|
|
|
|
pack_super_fonts_dir,
|
|
|
|
pack_super_x86_fonts_dir,
|
|
|
|
};
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
char *zip_dirs[] = {
|
|
|
|
"super",
|
|
|
|
"super_x86",
|
|
|
|
};
|
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
char *tier = "super";
|
|
|
|
|
|
|
|
char *archs[] = {
|
|
|
|
"x64",
|
|
|
|
"x86",
|
|
|
|
};
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
Assert(ArrayCount(dest_dirs) == ArrayCount(dest_par_dirs));
|
|
|
|
u32 count = ArrayCount(dest_dirs);
|
|
|
|
|
|
|
|
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER;
|
|
|
|
u32 flags[] = {
|
|
|
|
0,
|
|
|
|
X86,
|
|
|
|
};
|
|
|
|
|
|
|
|
for (u32 i = 0; i < count; ++i){
|
|
|
|
char *dir = dest_dirs[i];
|
|
|
|
char *par_dir = dest_par_dirs[i];
|
2017-03-30 20:11:26 +00:00
|
|
|
char *fonts_dir = dest_fonts_dirs[i];
|
2017-02-25 01:53:40 +00:00
|
|
|
char *zip_dir = zip_dirs[i];
|
2017-02-26 21:44:40 +00:00
|
|
|
char *arch = archs[i];
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
build_main(cdir, base_flags | flags[i]);
|
|
|
|
do_buildsuper(cdir, Custom_Default, flags[i]);
|
|
|
|
|
|
|
|
clear_folder(par_dir);
|
2017-03-30 20:11:26 +00:00
|
|
|
make_folder_if_missing(dir, 0);
|
|
|
|
make_folder_if_missing(dir, "fonts");
|
2017-02-25 01:53:40 +00:00
|
|
|
make_folder_if_missing(pack_dir, zip_dir);
|
|
|
|
|
2017-03-17 04:48:27 +00:00
|
|
|
copy_file(build_dir, "4ed" EXE, dir, 0, 0);
|
|
|
|
copy_file(build_dir, "4ed_app" DLL, dir, 0, 0);
|
|
|
|
copy_file(build_dir, "custom_4coder" DLL, dir, 0, 0);
|
2017-03-30 20:11:26 +00:00
|
|
|
copy_all(pack_fonts_dir, "*", fonts_dir);
|
2017-02-25 01:53:40 +00:00
|
|
|
copy_file(data_dir, "release-config.4coder", dir, 0, "config.4coder");
|
|
|
|
|
|
|
|
copy_all(0, "4coder_*", dir);
|
|
|
|
|
2017-03-17 04:48:27 +00:00
|
|
|
copy_file(0, "buildsuper" BAT, dir, 0, 0);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
DECL_STR(custom_dir, "4coder_API");
|
|
|
|
DECL_STR(custom_helper_dir, "4coder_helper");
|
|
|
|
DECL_STR(custom_lib_dir, "4coder_lib");
|
|
|
|
DECL_STR(fcpp_dir, "4cpp");
|
|
|
|
|
|
|
|
char *dir_array[] = {
|
|
|
|
custom_dir,
|
|
|
|
custom_helper_dir,
|
|
|
|
custom_lib_dir,
|
|
|
|
fcpp_dir,
|
|
|
|
};
|
|
|
|
i32 dir_count = ArrayCount(dir_array);
|
|
|
|
|
2017-03-17 04:48:27 +00:00
|
|
|
for (i32 j = 0; j < dir_count; ++j){
|
|
|
|
char *d = dir_array[j];
|
2017-02-25 01:53:40 +00:00
|
|
|
make_folder_if_missing(dir, d);
|
|
|
|
|
|
|
|
char space[256];
|
2017-03-17 04:48:27 +00:00
|
|
|
String copy_name = make_fixed_width_string(space);
|
|
|
|
append_sc(©_name, dir);
|
|
|
|
append_s_char(©_name, platform_correct_slash);
|
|
|
|
append_sc(©_name, d);
|
|
|
|
terminate_with_null(©_name);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-03-17 04:48:27 +00:00
|
|
|
copy_all(d, "*", copy_name.str);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
get_4coder_dist_name(&str, true, zip_dir, tier, arch, "zip");
|
2017-02-25 01:53:40 +00:00
|
|
|
zip(par_dir, "4coder", str.str);
|
|
|
|
}
|
|
|
|
|
|
|
|
make_folder_if_missing(pack_dir, "super-docs");
|
2017-02-26 21:44:40 +00:00
|
|
|
get_4coder_dist_name(&str, false, "super-docs", "API", 0, "html");
|
2017-03-30 20:11:26 +00:00
|
|
|
String str2 = front_of_directory(str);
|
2017-02-25 01:53:40 +00:00
|
|
|
copy_file(site_dir, "custom_docs.html", pack_dir, "super-docs", str2.str);
|
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
|
|
|
|
// NOTE(allen): power
|
2017-02-25 01:53:40 +00:00
|
|
|
#define PACK_POWER_PAR_DIR "../current_dist_power"
|
|
|
|
#define PACK_POWER_DIR PACK_POWER_PAR_DIR"/power"
|
|
|
|
DECL_STR(pack_power_par_dir, PACK_POWER_PAR_DIR);
|
|
|
|
DECL_STR(pack_power_dir, PACK_POWER_DIR);
|
|
|
|
|
2017-01-07 02:59:55 +00:00
|
|
|
clear_folder(pack_power_par_dir);
|
|
|
|
make_folder_if_missing(pack_power_dir, 0);
|
|
|
|
make_folder_if_missing(pack_dir, "power");
|
|
|
|
copy_all("power", "*", pack_power_dir);
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
get_4coder_dist_name(&str, 0, "power", 0, 0, "zip");
|
2017-01-07 02:59:55 +00:00
|
|
|
zip(pack_power_par_dir, "power", str.str);
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
|
2017-04-24 15:23:12 +00:00
|
|
|
#if defined(DEV_BUILD) || defined(OPT_BUILD)
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
int main(int argc, char **argv){
|
|
|
|
init_time_system();
|
|
|
|
|
|
|
|
char cdir[256];
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-23 06:19:43 +00:00
|
|
|
i32 n = get_current_directory(cdir, sizeof(cdir));
|
2016-08-31 01:44:02 +00:00
|
|
|
assert(n < sizeof(cdir));
|
|
|
|
END_TIME_SECTION("current directory");
|
|
|
|
|
2017-04-24 15:23:12 +00:00
|
|
|
u32 flags = DEBUG_INFO | SUPER | INTERNAL;
|
|
|
|
#if defined(OPT_BUILD)
|
|
|
|
flags |= OPTIMIZATION;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
standard_build(cdir, flags);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
|
|
|
return(error_state);
|
|
|
|
}
|
|
|
|
|
2017-02-23 00:22:59 +00:00
|
|
|
#elif defined(DEV_BUILD_X86)
|
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
|
|
|
init_time_system();
|
|
|
|
|
|
|
|
char cdir[256];
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
|
|
|
i32 n = get_current_directory(cdir, sizeof(cdir));
|
|
|
|
assert(n < sizeof(cdir));
|
|
|
|
END_TIME_SECTION("current directory");
|
|
|
|
|
|
|
|
standard_build(cdir, DEBUG_INFO | SUPER | INTERNAL | X86);
|
|
|
|
|
|
|
|
return(error_state);
|
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
#elif defined(PACKAGE)
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
int main(int argc, char **argv){
|
|
|
|
init_time_system();
|
|
|
|
|
|
|
|
char cdir[256];
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-23 06:19:43 +00:00
|
|
|
i32 n = get_current_directory(cdir, sizeof(cdir));
|
2016-09-04 23:58:49 +00:00
|
|
|
assert(n < sizeof(cdir));
|
|
|
|
END_TIME_SECTION("current directory");
|
|
|
|
|
|
|
|
package(cdir);
|
|
|
|
|
|
|
|
return(error_state);
|
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
#elif defined(SITE_BUILD)
|
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
|
|
|
init_time_system();
|
|
|
|
|
|
|
|
char cdir[256];
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-01-23 06:19:43 +00:00
|
|
|
i32 n = get_current_directory(cdir, sizeof(cdir));
|
2016-11-14 04:29:00 +00:00
|
|
|
assert(n < sizeof(cdir));
|
|
|
|
END_TIME_SECTION("current directory");
|
|
|
|
|
|
|
|
site_build(cdir, DEBUG_INFO);
|
|
|
|
|
|
|
|
return(error_state);
|
|
|
|
}
|
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
#else
|
|
|
|
#error No build type specified
|
2016-08-28 04:31:06 +00:00
|
|
|
#endif
|
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#define FTECH_FILE_MOVING_IMPLEMENTATION
|
|
|
|
#include "4tech_file_moving.h"
|
|
|
|
|
2016-08-28 15:42:12 +00:00
|
|
|
// BOTTOM
|
2017-01-23 06:19:43 +00:00
|
|
|
|
|
|
|
|