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-07-07 23:54:50 +00:00
|
|
|
//#define FM_PRINT_COMMANDS
|
|
|
|
|
|
|
|
#include "../4ed_defines.h"
|
|
|
|
#include "4ed_file_moving.h"
|
2017-01-23 06:19:43 +00:00
|
|
|
|
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
|
|
|
|
//
|
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
//
|
|
|
|
// 4coder specific
|
|
|
|
//
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Platform_Windows,
|
|
|
|
Platform_Linux,
|
|
|
|
Platform_Mac,
|
|
|
|
//
|
|
|
|
Platform_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Compiler_CL,
|
|
|
|
Compiler_GCC,
|
|
|
|
//
|
|
|
|
Compiler_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(IS_WINDOWS)
|
|
|
|
# define THIS_OS Platform_Windows
|
|
|
|
#elif defined(IS_LINUX)
|
|
|
|
# define THIS_OS Platform_Linux
|
|
|
|
#elif defined(IS_MAC)
|
|
|
|
# define THIS_OS Platform_Mac
|
|
|
|
#else
|
|
|
|
# error This platform is not enumerated.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IS_CL)
|
|
|
|
# define THIS_COMPILER Compiler_CL
|
|
|
|
#elif defined(IS_GCC)
|
|
|
|
# define THIS_COMPILER Compiler_GCC
|
|
|
|
#else
|
|
|
|
# error This compilers is not enumerated.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *windows_platform_layer[] = { "platform_win32\\win32_4ed.cpp", 0 };
|
|
|
|
char *linux_platform_layer[] = { "platform_linux/linux_4ed.cpp", 0 };
|
|
|
|
char *mac_platform_layer[] = { "platform_mac/mac_4ed.m", "platform_mac/mac_4ed.cpp", 0 };
|
|
|
|
|
|
|
|
char **platform_layers[Platform_COUNT] = {
|
|
|
|
windows_platform_layer,
|
|
|
|
linux_platform_layer ,
|
|
|
|
mac_platform_layer ,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *windows_cl_platform_inc[] = { ".", "platform_all", 0 };
|
|
|
|
char *linux_gcc_platform_inc[] = { "platform_all", "platform_unix", 0 };
|
|
|
|
char *mac_gcc_platform_inc[] = { "platform_all", "platform_unix", 0 };
|
|
|
|
|
|
|
|
char **platform_includes[Platform_COUNT][Compiler_COUNT] = {
|
|
|
|
{windows_cl_platform_inc, 0 },
|
|
|
|
{0 , linux_gcc_platform_inc },
|
|
|
|
{0 , mac_gcc_platform_inc },
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BUILD_DIR "../build"
|
|
|
|
|
|
|
|
enum{
|
|
|
|
OPTS = 0x1,
|
|
|
|
INCLUDES = 0x2,
|
|
|
|
LIBS = 0x4,
|
|
|
|
ICON = 0x8,
|
|
|
|
SHARED_CODE = 0x10,
|
|
|
|
DEBUG_INFO = 0x20,
|
|
|
|
SUPER = 0x40,
|
|
|
|
INTERNAL = 0x80,
|
|
|
|
OPTIMIZATION = 0x100,
|
|
|
|
KEEP_ASSERT = 0x200,
|
|
|
|
SITE_INCLUDES = 0x400,
|
|
|
|
X86 = 0x800,
|
|
|
|
LOG = 0x1000,
|
|
|
|
};
|
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
#if defined(IS_CL)
|
|
|
|
|
|
|
|
//
|
|
|
|
// cl build
|
|
|
|
//
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
#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-06-30 21:28:09 +00:00
|
|
|
build(u32 flags, char *code_path, char **code_files, char *out_path, char *out_file, char *exports, char **inc_folders){
|
2016-09-04 20:41:48 +00:00
|
|
|
Build_Line line;
|
2017-02-25 01:53:40 +00:00
|
|
|
Build_Line link_line;
|
|
|
|
Build_Line line_prefix;
|
2017-07-08 05:40:27 +00:00
|
|
|
|
|
|
|
fm_init_build_line(&line);
|
|
|
|
fm_init_build_line(&link_line);
|
|
|
|
fm_init_build_line(&line_prefix);
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
if (flags & X86){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line_prefix, "%s\\windows_scripts\\setup_cl_x86.bat & ", code_path);
|
2017-06-22 23:16:04 +00:00
|
|
|
}
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & OPTS){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_OPTS);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 23:41:10 +00:00
|
|
|
if (flags & X86){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/DFTECH_32_BIT");
|
2017-03-24 23:41:10 +00:00
|
|
|
}
|
|
|
|
|
2017-06-12 21:35:06 +00:00
|
|
|
if (flags & LOG){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/DUSE_LOG /DUSE_LOGF");
|
2017-06-12 21:35:06 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & INCLUDES){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_INCLUDES);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
if (flags & SITE_INCLUDES){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_SITE_INCLUDES);
|
2016-11-14 04:29:00 +00:00
|
|
|
}
|
|
|
|
|
2017-06-30 21:47:24 +00:00
|
|
|
if (inc_folders != 0){
|
|
|
|
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/I%s\\%s", code_path, inc_folders[i]);
|
2017-06-30 21:47:24 +00:00
|
|
|
}
|
2017-06-30 18:20:34 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & LIBS){
|
2017-02-25 01:53:40 +00:00
|
|
|
if (flags & X86){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_LIBS_X86);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
|
|
|
else{
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_LIBS_X64);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & ICON){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, CL_ICON);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/Zi");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & OPTIMIZATION){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/O2");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SHARED_CODE){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/LD");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SUPER){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/DFRED_SUPER");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INTERNAL){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/DFRED_INTERNAL");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & KEEP_ASSERT){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "/DFRED_KEEP_ASSERT");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2017-02-23 00:22:59 +00:00
|
|
|
if (flags & X86){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(link_line, CL_X86);
|
2017-02-23 00:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(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-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(link_line, "%s", link_type_string);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-06-30 18:20:34 +00:00
|
|
|
for (u32 i = 0; code_files[i]; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "\"%s\\%s\"", code_path, code_files[i]);
|
2017-06-30 18:20:34 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_finish_build_line(&line);
|
|
|
|
fm_finish_build_line(&link_line);
|
|
|
|
fm_finish_build_line(&line_prefix);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
Temp_Dir temp = fm_pushdir(out_path);
|
2017-06-30 18:20:34 +00:00
|
|
|
systemf("%scl %s /Fe%s /link /INCREMENTAL:NO %s", line_prefix.build_options, line.build_options, out_file, link_line.build_options);
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_popdir(temp);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
#elif defined(IS_GCC)
|
|
|
|
|
|
|
|
//
|
|
|
|
// gcc build
|
|
|
|
//
|
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
#if defined(IS_LINUX)
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
# define GCC_OPTS \
|
|
|
|
"-Wno-write-strings " \
|
|
|
|
"-D_GNU_SOURCE -fPIC " \
|
2016-11-14 04:29:00 +00:00
|
|
|
"-fno-threadsafe-statics -pthread"
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
#define GCC_LIBS \
|
|
|
|
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
|
|
|
|
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
#elif defined(IS_MAC)
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
# define GCC_OPTS \
|
|
|
|
"-Wno-write-strings -Wno-deprecated-declarations " \
|
2017-06-29 23:41:39 +00:00
|
|
|
"-Wno-comment -Wno-switch -Wno-null-dereference "
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
#define GCC_LIBS \
|
|
|
|
"-framework Cocoa -framework QuartzCore " \
|
|
|
|
"-framework OpenGL -framework IOKit"
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-06-29 02:53:51 +00:00
|
|
|
#else
|
|
|
|
# error gcc options not set for this platform
|
|
|
|
#endif
|
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
|
|
|
static void
|
2017-06-30 21:28:09 +00:00
|
|
|
build(u32 flags, char *code_path, char **code_files, char *out_path, char *out_file, char *exports, char **inc_folders){
|
2016-09-04 20:41:48 +00:00
|
|
|
Build_Line line;
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_init_build_line(&line);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-02-26 20:13:06 +00:00
|
|
|
if (flags & X86){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_X86);
|
2017-02-26 20:13:06 +00:00
|
|
|
}
|
|
|
|
else{
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_X64);
|
2017-02-26 20:13:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & OPTS){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_OPTS);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INCLUDES){
|
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);
|
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_INCLUDES" %s", freetype_include);
|
2017-06-30 00:34:11 +00:00
|
|
|
#else
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_INCLUDES);
|
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){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_SITE_INCLUDES);
|
2016-11-14 04:29:00 +00:00
|
|
|
}
|
|
|
|
|
2017-06-30 21:28:09 +00:00
|
|
|
if (inc_folders != 0){
|
|
|
|
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-I%s/%s", code_path, inc_folders[i]);
|
2017-06-30 21:28:09 +00:00
|
|
|
}
|
2017-06-30 00:34:11 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & DEBUG_INFO){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-g -O0");
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
if (flags & OPTIMIZATION){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-O3");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & SHARED_CODE){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-shared");
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
2017-06-12 21:35:06 +00:00
|
|
|
if (flags & LOG){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-DUSE_LOG -DUSE_LOGF");
|
2017-06-12 21:35:06 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
if (flags & SUPER){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-DFRED_SUPER");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & INTERNAL){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-DFRED_INTERNAL");
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
if (flags & KEEP_ASSERT){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-DFRED_KEEP_ASSERT");
|
2016-08-31 01:44:02 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "-I\"%s\"", code_path);
|
2017-06-30 01:18:44 +00:00
|
|
|
for (u32 i = 0; code_files[i] != 0; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, "\"%s/%s\"", code_path, code_files[i]);
|
2017-06-30 01:18:44 +00:00
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2016-09-04 20:41:48 +00:00
|
|
|
if (flags & LIBS){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_add_to_line(line, GCC_LIBS);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_finish_build_line(&line);
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2017-07-08 03:38:29 +00:00
|
|
|
Temp_Dir temp = fm_pushdir(out_path);
|
2016-09-04 20:41:48 +00:00
|
|
|
systemf("g++ %s -o %s", line.build_options, out_file);
|
2017-07-08 03:38:29 +00:00
|
|
|
fm_popdir(temp);
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2017-06-30 00:34:11 +00:00
|
|
|
# error build function not defined for this compiler
|
2016-08-28 04:31:06 +00:00
|
|
|
#endif
|
|
|
|
|
2017-06-30 01:18:44 +00:00
|
|
|
static void
|
2017-06-30 21:28:09 +00:00
|
|
|
build(u32 flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports, char **inc_folders){
|
2017-06-30 01:18:44 +00:00
|
|
|
char *code_files[2];
|
|
|
|
code_files[0] = code_file;
|
|
|
|
code_files[1] = 0;
|
|
|
|
|
2017-06-30 21:28:09 +00:00
|
|
|
build(flags, code_path, code_files, out_path, out_file, exports, inc_folders);
|
2017-06-30 01:18:44 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
static void
|
2017-07-08 05:40:27 +00:00
|
|
|
build_and_run(char *cdir, char *filename, char *name, u32 flags){
|
|
|
|
char *dir = fm_str(BUILD_DIR);
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2016-08-29 01:03:26 +00:00
|
|
|
{
|
2017-07-08 05:40:27 +00:00
|
|
|
char *file = fm_str(filename);
|
2017-04-01 06:15:47 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-08 05:40:27 +00:00
|
|
|
build(flags, cdir, file, dir, name, 0, 0);
|
|
|
|
END_TIME_SECTION(fm_str("build ", name));
|
2016-08-29 01:03:26 +00:00
|
|
|
}
|
2017-07-08 05:40:27 +00:00
|
|
|
|
2016-09-06 01:46:41 +00:00
|
|
|
if (prev_error == 0){
|
2017-07-08 05:40:27 +00:00
|
|
|
char *cmd = fm_str(dir, "/", name);
|
2017-04-01 06:15:47 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_execute_in_dir(cdir, cmd, 0);
|
2017-07-08 05:40:27 +00:00
|
|
|
END_TIME_SECTION(fm_str("run ", name));
|
2017-04-01 06:15:47 +00:00
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
static void
|
|
|
|
fsm_generator(char *cdir){
|
|
|
|
build_and_run(cdir, "meta/fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO);
|
|
|
|
}
|
|
|
|
|
2016-09-04 23:58:49 +00:00
|
|
|
static void
|
|
|
|
metagen(char *cdir){
|
2017-07-08 05:40:27 +00:00
|
|
|
build_and_run(cdir, "meta/4ed_metagen.cpp", "metagen", OPTS | DEBUG_INFO | INCLUDES);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buildsuper(char *code_path, char *out_path, char *filename, b32 x86_build){
|
|
|
|
Temp_Dir temp = fm_pushdir(out_path);
|
|
|
|
#if defined(IS_WINDOWS)
|
2016-08-28 17:31:43 +00:00
|
|
|
{
|
2017-07-08 05:40:27 +00:00
|
|
|
char *build_script = "buildsuper.bat";
|
|
|
|
if (x86_build){
|
|
|
|
build_script = "buildsuper_x86.bat";
|
|
|
|
}
|
|
|
|
systemf("call \"%s\\%s\" \"%s\"", code_path, build_script, filename);
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
2017-07-08 05:40:27 +00:00
|
|
|
#elif defined(IS_LINUX) || defined(IS_MAC)
|
|
|
|
{
|
|
|
|
char *build_script = "buildsuper.sh";
|
|
|
|
if (x86_build){
|
|
|
|
build_script = "buildsuper_x86.sh";
|
|
|
|
}
|
|
|
|
systemf("\"%s/%s\" \"%s\"", code_path, build_script, filename);
|
2016-08-28 17:31:43 +00:00
|
|
|
}
|
2017-07-08 05:40:27 +00:00
|
|
|
#else
|
|
|
|
# error The buildsuper rule for this OS is not ready
|
|
|
|
#endif
|
|
|
|
fm_popdir(temp);
|
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
|
|
|
BEGIN_TIME_SECTION();
|
2016-12-14 16:09:54 +00:00
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
char *str = 0;
|
2016-12-14 16:09:54 +00:00
|
|
|
switch (custom_option){
|
|
|
|
case Custom_Default:
|
|
|
|
{
|
2017-07-08 05:40:27 +00:00
|
|
|
str = fm_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-07-08 05:40:27 +00:00
|
|
|
str = fm_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-07-08 05:40:27 +00:00
|
|
|
str = fm_str("../code/power/4coder_casey.cpp");
|
2016-12-14 16:09:54 +00:00
|
|
|
}break;
|
|
|
|
|
|
|
|
case Custom_ChronalVim:
|
|
|
|
{
|
2017-07-08 05:40:27 +00:00
|
|
|
str = fm_str("../4vim/4coder_chronal.cpp");
|
2016-12-14 16:09:54 +00:00
|
|
|
}break;
|
|
|
|
}
|
2017-01-07 02:59:55 +00:00
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
if (str != 0){
|
|
|
|
b32 x86_build = ((flags & X86) != 0);
|
|
|
|
char *dir = fm_str(BUILD_DIR);
|
|
|
|
buildsuper(cdir, dir, str
|
|
|
|
, x86_build);
|
|
|
|
END_TIME_SECTION("build custom");
|
2017-04-01 06:15:47 +00:00
|
|
|
}
|
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-07-08 05:40:27 +00:00
|
|
|
char *dir = fm_str(BUILD_DIR);
|
2017-02-18 01:04:41 +00:00
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
{
|
2017-07-08 05:40:27 +00:00
|
|
|
char *file = fm_str("4ed_app_target.cpp");
|
2016-08-28 17:31:43 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-06-30 00:34:11 +00:00
|
|
|
build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, file, dir, "4ed_app" DLL, "/EXPORT:app_get_functions", 0);
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed_app");
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-07 23:54:50 +00:00
|
|
|
build(OPTS | INCLUDES | LIBS | ICON | flags, cdir, platform_layers[THIS_OS], dir, "4ed", 0, platform_includes[THIS_OS][THIS_COMPILER]);
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed");
|
|
|
|
}
|
2017-06-05 21:48:49 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-08 05:40:27 +00:00
|
|
|
char *themes_folder = fm_str("../build/themes");
|
|
|
|
char *source_themes_folder = fm_str("themes");
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_clear_folder(themes_folder);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_make_folder_if_missing(themes_folder);
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_all(source_themes_folder, "*", themes_folder);
|
2017-06-05 21:48:49 +00:00
|
|
|
END_TIME_SECTION("move files");
|
|
|
|
}
|
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-06-27 15:49:27 +00:00
|
|
|
do_buildsuper(cdir, Custom_Default, flags);
|
|
|
|
//do_buildsuper(cdir, Custom_Experiments, flags);
|
2017-06-24 14:07:32 +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-07-08 05:40:27 +00:00
|
|
|
char *file = fm_str("site/sitegen.cpp");
|
|
|
|
char *dir = fm_str(BUILD_DIR"/site");
|
2016-12-08 17:16:50 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-06-30 00:34:11 +00:00
|
|
|
build(OPTS | SITE_INCLUDES | flags, cdir, file, dir, "sitegen", 0, 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-07-08 05:40:27 +00:00
|
|
|
char *cmd = fm_str("../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-07-07 23:54:50 +00:00
|
|
|
#elif defined(IS_LINUX)
|
2017-02-27 15:01:02 +00:00
|
|
|
append_sc(zip_file, "-linux");
|
2017-07-07 23:54:50 +00:00
|
|
|
#elif defined(IS_MAC)
|
2017-06-27 02:47:00 +00:00
|
|
|
append_sc(zip_file, "-mac");
|
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
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_slash_fix(zip_file->str);
|
2017-06-16 23:10:50 +00:00
|
|
|
}
|
|
|
|
|
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-06-23 00:26:18 +00:00
|
|
|
#define PACK_FONTS_DIR "../code/dist_files/fonts"
|
2017-07-08 05:40:27 +00:00
|
|
|
char *build_dir = fm_str(BUILD_DIR);
|
|
|
|
char *site_dir = fm_str(SITE_DIR);
|
|
|
|
char *pack_dir = fm_str(PACK_DIR);
|
|
|
|
char *pack_fonts_dir = fm_str(PACK_FONTS_DIR);
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
u32 arch_count = 2;
|
|
|
|
char *arch_names[] = {
|
|
|
|
"x64",
|
|
|
|
"x86",
|
|
|
|
};
|
|
|
|
Assert(ArrayCount(arch_names) == arch_count);
|
|
|
|
|
|
|
|
u32 arch_flags[] = {
|
|
|
|
0,
|
|
|
|
X86,
|
|
|
|
};
|
|
|
|
Assert(ArrayCount(arch_flags) == arch_count);
|
|
|
|
|
|
|
|
char *base_package_root = "../current_dist";
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
// NOTE(allen): alpha
|
|
|
|
{
|
2017-07-07 23:54:50 +00:00
|
|
|
Temp_Memory temp = fm_begin_temp();
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
char *tier = "alpha";
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
char *tier_package_root = fm_str(base_package_root, "_", tier);
|
2017-06-12 21:35:06 +00:00
|
|
|
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | LOG;
|
2017-07-07 23:54:50 +00:00
|
|
|
for (u32 i = 0; i < arch_count; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
char *package_root = fm_str(tier_package_root, "_", arch_names[i]);
|
|
|
|
char *par_dir = fm_str(package_root);
|
|
|
|
char *dir = fm_str(par_dir, "/4coder");
|
|
|
|
char *fonts_dir = fm_str(dir, "/fonts");
|
|
|
|
char *zip_dir = fm_str(tier, "_", arch_names[i]);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
build_main(cdir, base_flags | arch_flags[i]);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_clear_folder(par_dir);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_make_folder_if_missing(dir);
|
|
|
|
fm_make_folder_if_missing(fonts_dir);
|
|
|
|
fm_make_folder_if_missing(fm_str(pack_dir, "/", zip_dir));
|
|
|
|
fm_copy_file(fm_str(build_dir, "/4ed"EXE), fm_str(dir, "/4ed"EXE));
|
|
|
|
fm_copy_file(fm_str(build_dir, "/4ed_app"DLL), fm_str(dir, "/4ed_app"DLL));
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_all(pack_fonts_dir, "*", fonts_dir);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file(fm_str(cdir, "/release-config.4coder"), fm_str(dir, "/config.4coder"));
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_folder(dir, "themes");
|
2017-06-16 23:10:50 +00:00
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file(fm_str(cdir, "/LICENSE.txt"), fm_str(dir, "/LICENSE.txt"));
|
|
|
|
fm_copy_file(fm_str(cdir, "/README.txt"), fm_str(dir, "/README.txt"));
|
2017-06-24 13:49:20 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
get_4coder_dist_name(&str, true, zip_dir, tier, arch_names[i], "zip");
|
|
|
|
fm_zip(par_dir, "4coder", str.str);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
fm_end_temp(temp);
|
2017-01-23 06:19:43 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
// NOTE(allen): super
|
|
|
|
|
|
|
|
{
|
2017-07-07 23:54:50 +00:00
|
|
|
Temp_Memory temp = fm_begin_temp();
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-02-26 21:44:40 +00:00
|
|
|
char *tier = "super";
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
char *tier_package_root = fm_str(base_package_root, "_", tier);
|
2017-07-07 23:54:50 +00:00
|
|
|
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | LOG | SUPER;
|
|
|
|
for (u32 i = 0; i < arch_count; ++i){
|
2017-07-08 05:40:27 +00:00
|
|
|
char *package_root = fm_str(tier_package_root, "_", arch_names[i]);
|
|
|
|
char *par_dir = fm_str(package_root);
|
|
|
|
char *dir = fm_str(par_dir, "/4coder");
|
|
|
|
char *fonts_dir = fm_str(dir, "/fonts");
|
|
|
|
char *zip_dir = fm_str(tier, "_", arch_names[i]);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
build_main(cdir, base_flags | arch_flags[i]);
|
|
|
|
do_buildsuper(cdir, Custom_Default, arch_flags[i]);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_clear_folder(par_dir);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_make_folder_if_missing(dir);
|
|
|
|
fm_make_folder_if_missing(fonts_dir);
|
|
|
|
fm_make_folder_if_missing(fm_str(pack_dir, "/", zip_dir));
|
|
|
|
fm_copy_file(fm_str(build_dir, "/4ed" EXE), fm_str(dir, "/4ed" EXE));
|
|
|
|
fm_copy_file(fm_str(build_dir, "/4ed_app" DLL), fm_str(dir, "/4ed_app" DLL));
|
|
|
|
fm_copy_file(fm_str(build_dir, "/custom_4coder" DLL), fm_str(dir, "/custom_4coder" DLL));
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_all(pack_fonts_dir, "*", fonts_dir);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file(fm_str(cdir, "/release-config.4coder"), fm_str(dir, "/config.4coder"));
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_all(0, "4coder_*", dir);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
if (!(arch_flags[i] & X86)){
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file("buildsuper" BAT, fm_str(dir, "/buildsuper" BAT));
|
2017-06-24 13:49:20 +00:00
|
|
|
}
|
|
|
|
else{
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file("buildsuper_x86" BAT, fm_str(dir, "/buildsuper" BAT));
|
2017-06-24 13:49:20 +00:00
|
|
|
}
|
2017-07-08 05:40:27 +00:00
|
|
|
|
|
|
|
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-06-23 01:04:42 +00:00
|
|
|
#if defined(IS_WINDOWS)
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_folder(dir, "windows_scripts");
|
2017-06-23 01:04:42 +00:00
|
|
|
#endif
|
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_folder(dir, "4coder_API");
|
|
|
|
fm_copy_folder(dir, "4coder_helper");
|
|
|
|
fm_copy_folder(dir, "4coder_lib");
|
|
|
|
fm_copy_folder(dir, "4cpp");
|
|
|
|
fm_copy_folder(dir, "languages");
|
|
|
|
fm_copy_folder(dir, "themes");
|
2017-06-16 23:10:50 +00:00
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_copy_file(fm_str(cdir, "/LICENSE.txt"), fm_str(dir, "/LICENSE.txt"));
|
|
|
|
fm_copy_file(fm_str(cdir, "/README.txt"), fm_str(dir, "/README.txt"));
|
2017-06-24 13:49:20 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
get_4coder_dist_name(&str, true, zip_dir, tier, arch_names[i], "zip");
|
|
|
|
fm_zip(par_dir, "4coder", str.str);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_make_folder_if_missing(fm_str(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-07-08 05:40:27 +00:00
|
|
|
fm_copy_file(fm_str(site_dir, "/custom_docs.html"), fm_str(pack_dir, "/super-docs/", str2.str));
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
fm_end_temp(temp);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
|
|
|
|
// NOTE(allen): power
|
2017-07-07 23:54:50 +00:00
|
|
|
{
|
|
|
|
Temp_Memory temp = fm_begin_temp();
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
char *pack_power_par_dir = fm_str("../current_dist_power");
|
|
|
|
char *pack_power_dir = fm_str(pack_power_par_dir, "/power");
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
fm_clear_folder(pack_power_par_dir);
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_make_folder_if_missing(pack_power_dir);
|
|
|
|
fm_make_folder_if_missing(fm_str(pack_dir, "/power"));
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_copy_all("power", "*", pack_power_dir);
|
|
|
|
|
|
|
|
get_4coder_dist_name(&str, 0, "power", "power", 0, "zip");
|
|
|
|
fm_zip(pack_power_par_dir, "power", str.str);
|
|
|
|
|
|
|
|
fm_end_temp(temp);
|
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_init_system();
|
2017-07-08 05:40:27 +00:00
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
char cdir[256];
|
|
|
|
|
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-07 23:54:50 +00:00
|
|
|
i32 n = fm_get_current_directory(cdir, sizeof(cdir));
|
2016-08-31 01:44:02 +00:00
|
|
|
assert(n < sizeof(cdir));
|
|
|
|
END_TIME_SECTION("current directory");
|
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
#if defined(DEV_BUILD) || defined(OPT_BUILD) || defined(DEV_BUILD_X86)
|
2017-06-12 21:35:06 +00:00
|
|
|
u32 flags = DEBUG_INFO | SUPER | INTERNAL | LOG;
|
2017-04-24 15:23:12 +00:00
|
|
|
#if defined(OPT_BUILD)
|
|
|
|
flags |= OPTIMIZATION;
|
|
|
|
#endif
|
2017-07-07 23:54:50 +00:00
|
|
|
#if defined(DEV_BUILD_X86)
|
|
|
|
flags |= X86;
|
|
|
|
#endif
|
2017-06-12 21:35:06 +00:00
|
|
|
standard_build(cdir, flags);
|
2017-02-23 00:22:59 +00:00
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
#elif defined(PACKAGE)
|
2016-09-04 23:58:49 +00:00
|
|
|
package(cdir);
|
2017-07-08 05:40:27 +00:00
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
#elif defined(SITE_BUILD)
|
|
|
|
site_build(cdir, DEBUG_INFO);
|
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
#else
|
2017-07-07 23:54:50 +00:00
|
|
|
#error No build type specified.
|
2016-08-28 04:31:06 +00:00
|
|
|
#endif
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
return(error_state);
|
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#define FTECH_FILE_MOVING_IMPLEMENTATION
|
2017-07-07 23:54:50 +00:00
|
|
|
#include "4ed_file_moving.h"
|
2017-01-23 06:19:43 +00:00
|
|
|
|
2016-08-28 15:42:12 +00:00
|
|
|
// BOTTOM
|
2017-01-23 06:19:43 +00:00
|
|
|
|