2016-08-28 04:31:06 +00:00
|
|
|
/*
|
2017-07-09 19:22:57 +00:00
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* ??.??.????
|
|
|
|
*
|
|
|
|
* 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"
|
2018-11-27 20:09:24 +00:00
|
|
|
# include "../4coder_lib/4coder_arena.h"
|
|
|
|
# include "../4coder_lib/4coder_arena.cpp"
|
|
|
|
# define FSTRING_IMPLEMENTATION
|
|
|
|
# include "../4coder_lib/4coder_string.h"
|
2017-01-23 06:19:43 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
#define FTECH_FILE_MOVING_IMPLEMENTATION
|
|
|
|
#include "4ed_file_moving.h"
|
2016-08-28 04:31:06 +00:00
|
|
|
|
2018-11-27 18:07:07 +00:00
|
|
|
#include "../4coder_API/4coder_version.h"
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
//
|
2017-07-08 19:25:23 +00:00
|
|
|
// OS and compiler index
|
2017-07-07 23:54:50 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Platform_Windows,
|
|
|
|
Platform_Linux,
|
|
|
|
Platform_Mac,
|
|
|
|
//
|
|
|
|
Platform_COUNT,
|
2017-07-08 19:25:23 +00:00
|
|
|
Platform_None = Platform_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *platform_names[] = {
|
|
|
|
"win",
|
|
|
|
"linux",
|
|
|
|
"mac",
|
2017-07-07 23:54:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Compiler_CL,
|
|
|
|
Compiler_GCC,
|
|
|
|
//
|
|
|
|
Compiler_COUNT,
|
2017-07-08 19:25:23 +00:00
|
|
|
Compiler_None = Compiler_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *compiler_names[] = {
|
|
|
|
"cl",
|
|
|
|
"gcc",
|
2017-07-07 23:54:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(IS_WINDOWS)
|
2017-07-08 19:25:23 +00:00
|
|
|
# define This_OS Platform_Windows
|
2017-07-07 23:54:50 +00:00
|
|
|
#elif defined(IS_LINUX)
|
2017-07-08 19:25:23 +00:00
|
|
|
# define This_OS Platform_Linux
|
2017-07-07 23:54:50 +00:00
|
|
|
#elif defined(IS_MAC)
|
2017-07-08 19:25:23 +00:00
|
|
|
# define This_OS Platform_Mac
|
2017-07-07 23:54:50 +00:00
|
|
|
#else
|
|
|
|
# error This platform is not enumerated.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IS_CL)
|
2017-07-08 19:25:23 +00:00
|
|
|
# define This_Compiler Compiler_CL
|
2017-07-07 23:54:50 +00:00
|
|
|
#elif defined(IS_GCC)
|
2017-07-08 19:25:23 +00:00
|
|
|
# define This_Compiler Compiler_GCC
|
2017-07-07 23:54:50 +00:00
|
|
|
#else
|
|
|
|
# error This compilers is not enumerated.
|
|
|
|
#endif
|
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
//
|
|
|
|
// Universal directories
|
|
|
|
//
|
|
|
|
|
|
|
|
#define BUILD_DIR "../build"
|
|
|
|
#define PACK_DIR "../distributions"
|
|
|
|
#define SITE_DIR "../site"
|
|
|
|
|
2017-07-13 20:26:19 +00:00
|
|
|
#define FOREIGN "../4coder-non-source/foreign"
|
|
|
|
#define FOREIGN_WIN "..\\4coder-non-source\\foreign"
|
|
|
|
|
|
|
|
char *includes[] = { FOREIGN, FOREIGN"/freetype2", 0, };
|
2017-07-09 00:48:53 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
//
|
|
|
|
// Platform layer file tables
|
|
|
|
//
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
char *windows_platform_layer[] = { "platform_win32/win32_4ed.cpp", 0 };
|
2017-07-07 23:54:50 +00:00
|
|
|
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 ,
|
|
|
|
};
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
char *windows_cl_platform_inc[] = { "platform_all", 0 };
|
2017-07-07 23:54:50 +00:00
|
|
|
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] = {
|
2017-11-11 16:27:04 +00:00
|
|
|
{windows_cl_platform_inc, 0 },
|
|
|
|
{0 , linux_gcc_platform_inc},
|
|
|
|
{0 , mac_gcc_platform_inc },
|
2017-07-07 23:54:50 +00:00
|
|
|
};
|
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
//
|
|
|
|
// Custom targets
|
|
|
|
//
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Custom_Default,
|
|
|
|
Custom_Experiments,
|
|
|
|
Custom_Casey,
|
|
|
|
Custom_ChronalVim,
|
|
|
|
//
|
|
|
|
Custom_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
char *custom_files[] = {
|
|
|
|
"../code/4coder_default_bindings.cpp",
|
2018-05-10 08:12:47 +00:00
|
|
|
"../code/4coder_experiments.cpp",
|
|
|
|
"../code/4coder_casey.cpp",
|
2017-07-08 19:25:23 +00:00
|
|
|
"../4vim/4coder_chronal.cpp",
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Architectures
|
|
|
|
//
|
|
|
|
|
|
|
|
enum{
|
|
|
|
Arch_X64,
|
|
|
|
Arch_X86,
|
|
|
|
//
|
|
|
|
Arch_COUNT,
|
|
|
|
Arch_None = Arch_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
char *arch_names[] = {
|
|
|
|
"x64",
|
|
|
|
"x86",
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Build flags
|
|
|
|
//
|
2017-07-07 23:54:50 +00:00
|
|
|
|
|
|
|
enum{
|
|
|
|
OPTS = 0x1,
|
2017-07-09 00:48:53 +00:00
|
|
|
LIBS = 0x2,
|
|
|
|
ICON = 0x4,
|
|
|
|
SHARED_CODE = 0x8,
|
|
|
|
DEBUG_INFO = 0x10,
|
|
|
|
OPTIMIZATION = 0x20,
|
2017-07-07 23:54:50 +00:00
|
|
|
SUPER = 0x40,
|
|
|
|
INTERNAL = 0x80,
|
2017-07-09 00:48:53 +00:00
|
|
|
KEEP_ASSERT = 0x100,
|
|
|
|
LOG = 0x200,
|
2017-07-07 23:54:50 +00:00
|
|
|
};
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
internal char**
|
2018-11-27 20:09:24 +00:00
|
|
|
get_defines_from_flags(Partition *part, u32 flags){
|
2017-07-09 00:48:53 +00:00
|
|
|
char **result = 0;
|
|
|
|
if (flags & KEEP_ASSERT){
|
2018-11-27 20:09:24 +00:00
|
|
|
result = fm_list(part, fm_list_one_item(part, "FRED_KEEP_ASSERT"), result);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
|
|
|
if (flags & INTERNAL){
|
2018-11-27 20:09:24 +00:00
|
|
|
result = fm_list(part, fm_list_one_item(part, "FRED_INTERNAL"), result);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
|
|
|
if (flags & SUPER){
|
2018-11-27 20:09:24 +00:00
|
|
|
result = fm_list(part, fm_list_one_item(part, "FRED_SUPER"), result);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
|
|
|
if (flags & LOG){
|
|
|
|
char *log_defines[] = { "USE_LOG", "USE_LOGF", 0};
|
2018-11-27 20:09:24 +00:00
|
|
|
result = fm_list(part, log_defines, result);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
|
|
|
return(result);
|
|
|
|
}
|
|
|
|
|
2017-06-30 00:34:11 +00:00
|
|
|
//
|
2017-07-08 19:25:23 +00:00
|
|
|
// build implementation: cl
|
2017-06-30 00:34:11 +00:00
|
|
|
//
|
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
#if defined(IS_CL)
|
|
|
|
|
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
|
|
|
|
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-07-13 20:26:19 +00:00
|
|
|
FOREIGN_WIN"\\x64\\freetype.lib"
|
2017-02-25 01:53:40 +00:00
|
|
|
|
|
|
|
#define CL_LIBS_X86 \
|
|
|
|
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
2017-07-13 20:26:19 +00:00
|
|
|
FOREIGN_WIN"\\x86\\freetype.lib"
|
2016-09-04 20:41:48 +00:00
|
|
|
|
2018-02-25 06:35:08 +00:00
|
|
|
#define CL_ICON "..\\4coder-non-source\\res\\icon.res"
|
2017-02-23 00:22:59 +00:00
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){
|
2017-07-09 02:09:24 +00:00
|
|
|
Temp_Dir temp = fm_pushdir(out_path);
|
2017-07-09 19:22:57 +00:00
|
|
|
|
2017-07-09 02:09:24 +00:00
|
|
|
Build_Line line;
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_init_build_line(&line);
|
2017-07-08 19:25:23 +00:00
|
|
|
|
|
|
|
if (arch == Arch_X86){
|
2017-07-09 02:09:24 +00:00
|
|
|
fm_add_to_line(line, "%s\\windows_scripts\\setup_cl_x86.bat &", code_path);
|
2017-06-22 23:16:04 +00:00
|
|
|
}
|
2017-07-09 19:22:57 +00:00
|
|
|
|
2017-07-09 02:09:24 +00:00
|
|
|
fm_add_to_line(line, "cl");
|
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-07-08 19:25:23 +00:00
|
|
|
switch (arch){
|
2017-07-09 19:22:57 +00:00
|
|
|
case Arch_X64: fm_add_to_line(line, "-DFTECH_64_BIT"); break;
|
|
|
|
case Arch_X86: fm_add_to_line(line, "-DFTECH_32_BIT"); break;
|
2017-07-08 19:25:23 +00:00
|
|
|
default: InvalidCodePath;
|
2017-03-24 23:41:10 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
fm_add_to_line(line, "-I%s", code_path);
|
2017-06-30 21:47:24 +00:00
|
|
|
if (inc_folders != 0){
|
|
|
|
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *str = fm_str(part, code_path, "/", inc_folders[i]);
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-I%s", str);
|
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-07-08 19:25:23 +00:00
|
|
|
switch (arch){
|
2017-07-09 00:50:58 +00:00
|
|
|
case Arch_X64: fm_add_to_line(line, CL_LIBS_X64); break;
|
|
|
|
case Arch_X86: fm_add_to_line(line, CL_LIBS_X86); break;
|
2017-07-08 19:25:23 +00:00
|
|
|
default: InvalidCodePath;
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & ICON){
|
2018-05-09 05:22:33 +00:00
|
|
|
fm_add_to_line(line, CL_ICON);
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-Zi");
|
2019-02-05 09:13:38 +00:00
|
|
|
fm_add_to_line(line, "-DDO_CRAZY_EXPENSIVE_ASSERTS");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & OPTIMIZATION){
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-O2");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & SHARED_CODE){
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-LD");
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
if (defines != 0){
|
|
|
|
for (u32 i = 0; defines[i] != 0; ++i){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *define_flag = fm_str(part, "-D", defines[i]);
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "%s", define_flag);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
2016-09-04 20:41:48 +00:00
|
|
|
}
|
2017-07-09 19:22:57 +00:00
|
|
|
|
2017-07-09 02:09:24 +00:00
|
|
|
for (u32 i = 0; code_files[i]; ++i){
|
|
|
|
fm_add_to_line(line, "\"%s\\%s\"", code_path, code_files[i]);
|
|
|
|
}
|
2017-07-09 19:22:57 +00:00
|
|
|
|
|
|
|
fm_add_to_line(line, "-Fe%s", out_file);
|
|
|
|
|
2019-01-25 21:03:52 +00:00
|
|
|
fm_add_to_line(line, "-link -INCREMENTAL:NO -RELEASE -PDBALTPATH:%%_PDB%%");
|
2017-07-08 19:25:23 +00:00
|
|
|
switch (arch){
|
2017-07-09 19:22:57 +00:00
|
|
|
case Arch_X64: fm_add_to_line(line, "-MACHINE:X64"); break;
|
|
|
|
case Arch_X86: fm_add_to_line(line, "-MACHINE:X86"); break;
|
2017-07-08 19:25:23 +00:00
|
|
|
default: InvalidCodePath;
|
2017-02-23 00:22:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & DEBUG_INFO){
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-DEBUG");
|
2017-02-23 00:22:59 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
if (flags & SHARED_CODE){
|
2017-07-09 00:48:53 +00:00
|
|
|
Assert(exports != 0);
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-OPT:REF");
|
2017-07-09 00:48:53 +00:00
|
|
|
for (u32 i = 0; exports[i] != 0; ++i){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *str = fm_str(part, "-EXPORT:", exports[i]);
|
2017-07-09 02:09:24 +00:00
|
|
|
fm_add_to_line(line, "%s", str);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
2016-08-28 04:31:06 +00:00
|
|
|
}
|
|
|
|
else{
|
2017-07-09 19:22:57 +00:00
|
|
|
fm_add_to_line(line, "-NODEFAULTLIB:library");
|
2017-06-30 18:20:34 +00:00
|
|
|
}
|
|
|
|
|
2017-07-08 05:40:27 +00:00
|
|
|
fm_finish_build_line(&line);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-09 02:09:24 +00:00
|
|
|
systemf("%s", 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
|
|
|
//
|
2017-07-08 19:25:23 +00:00
|
|
|
// build implementation: gcc
|
2017-06-30 00:34:11 +00:00
|
|
|
//
|
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
#elif defined(IS_GCC)
|
|
|
|
|
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 " \
|
2018-10-06 19:04:45 +00:00
|
|
|
"-fno-threadsafe-statics -pthread " \
|
|
|
|
"-Wno-unused-result"
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2018-12-19 03:16:08 +00:00
|
|
|
#define GCC_LIBS_COMMON \
|
2018-12-19 03:48:02 +00:00
|
|
|
"-lX11 -lpthread -lm -lrt " \
|
2017-06-29 02:53:51 +00:00
|
|
|
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
|
2017-06-29 23:20:18 +00:00
|
|
|
|
2017-11-11 19:54:31 +00:00
|
|
|
#define GCC_LIBS_X64 GCC_LIBS_COMMON
|
|
|
|
#define GCC_LIBS_X86 GCC_LIBS_COMMON
|
|
|
|
|
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 " \
|
2018-10-06 19:04:45 +00:00
|
|
|
"-Wno-comment -Wno-switch -Wno-null-dereference " \
|
2018-10-06 19:16:31 +00:00
|
|
|
"-Wno-tautological-compare " \
|
|
|
|
"-Wno-unused-result "
|
2018-10-06 19:04:45 +00:00
|
|
|
|
2017-11-11 19:54:31 +00:00
|
|
|
#define GCC_LIBS_COMMON \
|
2017-06-29 02:53:51 +00:00
|
|
|
"-framework Cocoa -framework QuartzCore " \
|
2017-11-07 21:35:26 +00:00
|
|
|
"-framework CoreServices " \
|
2017-11-11 19:54:31 +00:00
|
|
|
"-framework OpenGL -framework IOKit "
|
|
|
|
|
|
|
|
#define GCC_LIBS_X64 GCC_LIBS_COMMON \
|
2018-12-19 03:38:52 +00:00
|
|
|
FOREIGN "/x64/libfreetype-mac.a"
|
2017-11-11 19:54:31 +00:00
|
|
|
|
|
|
|
#define GCC_LIBS_X86 GCC_LIBS_COMMON \
|
2018-12-19 03:38:52 +00:00
|
|
|
FOREIGN "/x86/libfreetype-mac.a"
|
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-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
build(Partition *part, u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, 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-07-08 19:33:34 +00:00
|
|
|
switch (arch){
|
|
|
|
case Arch_X64:
|
2017-07-09 00:48:53 +00:00
|
|
|
fm_add_to_line(line, "-m64");
|
2017-07-08 19:33:34 +00:00
|
|
|
fm_add_to_line(line, "-DFTECH_64_BIT"); break;
|
|
|
|
|
|
|
|
case Arch_X86:
|
2017-07-09 00:48:53 +00:00
|
|
|
fm_add_to_line(line, "-m32");
|
2017-07-08 19:33:34 +00:00
|
|
|
fm_add_to_line(line, "-DFTECH_32_BIT"); break;
|
|
|
|
|
|
|
|
default: InvalidCodePath;
|
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
|
|
|
}
|
|
|
|
|
2017-07-09 00:48:53 +00:00
|
|
|
fm_add_to_line(line, "-I%s", code_path);
|
2017-06-30 21:28:09 +00:00
|
|
|
if (inc_folders != 0){
|
|
|
|
for (u32 i = 0; inc_folders[i] != 0; ++i){
|
2018-12-13 17:14:32 +00:00
|
|
|
char *str = fm_str(part, code_path, "/", inc_folders[i]);
|
2017-07-09 00:48:53 +00:00
|
|
|
fm_add_to_line(line, "-I%s", str);
|
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-07-09 00:48:53 +00:00
|
|
|
if (defines != 0){
|
|
|
|
for (u32 i = 0; defines[i]; ++i){
|
2018-12-13 17:14:32 +00:00
|
|
|
char *define_flag = fm_str(part, "-D", defines[i]);
|
2017-07-09 00:50:58 +00:00
|
|
|
fm_add_to_line(line, "%s", define_flag);
|
2017-07-09 00:48:53 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
}
|
2017-07-09 19:22:57 +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-11-11 19:54:31 +00:00
|
|
|
if (arch == Arch_X64){
|
|
|
|
fm_add_to_line(line, GCC_LIBS_X64);
|
|
|
|
}
|
|
|
|
else if (arch == Arch_X86)
|
|
|
|
{
|
|
|
|
fm_add_to_line(line, GCC_LIBS_X86);
|
|
|
|
}
|
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-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
build(Partition *part, u32 flags, u32 arch, char *code_path, char *code_file, char *out_path, char *out_file, char **defines, 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;
|
2018-11-27 20:09:24 +00:00
|
|
|
build(part, flags, arch, code_path, code_files, out_path, out_file, defines, exports, inc_folders);
|
2017-07-08 19:25:23 +00:00
|
|
|
}
|
|
|
|
|
2017-11-22 20:05:58 +00:00
|
|
|
// TODO(NAME): build metadata fully from C++ and eliminate build_metadata.bat and build_metadata.sh
|
|
|
|
|
2018-06-16 20:57:32 +00:00
|
|
|
internal void
|
|
|
|
build_metadata(void){
|
2018-09-07 22:39:33 +00:00
|
|
|
systemf(".%s%s ..%scode%s4coder_default_bindings.cpp", SLASH, "build_metadata" BAT, SLASH, SLASH);
|
2018-06-16 20:57:32 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
site_build(Partition *part, char *cdir, u32 flags){
|
2018-06-16 20:57:32 +00:00
|
|
|
build_metadata();
|
2017-11-22 20:05:58 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
{
|
2018-11-27 20:09:24 +00:00
|
|
|
char *file = fm_str(part, "site/4ed_sitegen.cpp");
|
|
|
|
char *dir = fm_str(part, BUILD_DIR);
|
2017-07-08 19:25:23 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
build(part, OPTS | flags, Arch_X64, cdir, file, dir, "sitegen", get_defines_from_flags(part, flags), 0, includes);
|
2017-07-08 19:25:23 +00:00
|
|
|
END_TIME_SECTION("build sitegen");
|
|
|
|
}
|
|
|
|
|
2017-07-09 19:49:41 +00:00
|
|
|
if (prev_error == 0){
|
2017-07-08 19:25:23 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
char *cmd = fm_str(part, BUILD_DIR "/sitegen");
|
|
|
|
char *code_dir = fm_str(part, ".");
|
|
|
|
char *asset_dir = fm_str(part, "../4coder-non-source/site_resources");
|
|
|
|
char *site_source_dir = fm_str(part, "site/source_material");
|
|
|
|
char *dest_dir = fm_str(part, "../site");
|
|
|
|
fm_make_folder_if_missing(part, dest_dir);
|
2017-07-09 03:25:29 +00:00
|
|
|
systemf("%s %s %s %s %s", cmd, code_dir, asset_dir, site_source_dir, dest_dir);
|
2017-07-08 19:25:23 +00:00
|
|
|
END_TIME_SECTION("run sitegen");
|
|
|
|
}
|
2017-06-30 01:18:44 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
build_and_run(Partition *part, char *cdir, char *filename, char *name, u32 flags){
|
|
|
|
char *dir = fm_str(part, BUILD_DIR);
|
2017-07-08 19:25:23 +00:00
|
|
|
|
2016-08-29 01:03:26 +00:00
|
|
|
{
|
2018-11-27 20:09:24 +00:00
|
|
|
char *file = fm_str(part, filename);
|
2017-04-01 06:15:47 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
build(part, flags, Arch_X64, cdir, file, dir, name, get_defines_from_flags(part, flags), 0, includes);
|
|
|
|
END_TIME_SECTION(fm_str(part, "build ", name));
|
2016-08-29 01:03:26 +00:00
|
|
|
}
|
2017-07-08 19:25:23 +00:00
|
|
|
|
2016-09-06 01:46:41 +00:00
|
|
|
if (prev_error == 0){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *cmd = fm_str(part, 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);
|
2018-11-27 20:09:24 +00:00
|
|
|
END_TIME_SECTION(fm_str(part, "run ", name));
|
2017-04-01 06:15:47 +00:00
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
fsm_generator(Partition *part, char *cdir){
|
|
|
|
build_and_run(part, cdir, "meta/4ed_fsm_table_generator.cpp", "fsmgen", OPTS | DEBUG_INFO);
|
2017-07-08 05:40:27 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
metagen(Partition *part, char *cdir){
|
|
|
|
build_and_run(part, cdir, "meta/4ed_metagen.cpp", "metagen", OPTS | DEBUG_INFO);
|
2017-07-08 05:40:27 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:49:41 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
string_build(Partition *part, char *cdir){
|
|
|
|
char *dir = fm_str(part, BUILD_DIR);
|
2017-07-09 19:49:41 +00:00
|
|
|
|
|
|
|
{
|
2018-11-27 20:09:24 +00:00
|
|
|
char *file = fm_str(part, "string/4ed_string_builder.cpp");
|
2017-07-09 19:49:41 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
build(part, OPTS | DEBUG_INFO, Arch_X64, cdir, file, dir, "string_builder", 0, 0, includes);
|
2017-07-09 19:49:41 +00:00
|
|
|
END_TIME_SECTION("build string_builder");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prev_error == 0){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *cmd = fm_str(part, cdir, "/", dir, "/string_builder");
|
2017-07-09 19:49:41 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_execute_in_dir(fm_str(part, cdir, "/string"), cmd, 0);
|
2017-07-09 19:49:41 +00:00
|
|
|
END_TIME_SECTION("run string_builder");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
do_buildsuper(Partition *part, char *cdir, char *file, u32 arch){
|
2017-04-01 06:15:47 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
Temp_Dir temp = fm_pushdir(fm_str(part, BUILD_DIR));
|
2016-12-14 16:09:54 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
char *build_script = fm_str(part, "buildsuper_", arch_names[arch], BAT);
|
2017-01-07 02:59:55 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
char *build_command = fm_str(part, "\"", cdir, "/", build_script, "\" \"", file, "\"");
|
2017-07-08 19:25:23 +00:00
|
|
|
if (This_OS == Platform_Windows){
|
2018-11-27 20:09:24 +00:00
|
|
|
build_command = fm_str(part, "call ", build_command);
|
2017-04-01 06:15:47 +00:00
|
|
|
}
|
2017-07-08 19:33:34 +00:00
|
|
|
systemf("%s", build_command);
|
2017-07-08 19:25:23 +00:00
|
|
|
|
|
|
|
fm_popdir(temp);
|
|
|
|
END_TIME_SECTION("build custom");
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
|
|
|
|
2017-09-10 18:24:26 +00:00
|
|
|
// TODO(allen): Remove this
|
2017-07-18 20:17:57 +00:00
|
|
|
internal i32
|
|
|
|
get_freetype_include(char *out, u32 max){
|
|
|
|
i32 size = 0;
|
2017-09-10 18:24:26 +00:00
|
|
|
#if 0
|
2017-07-18 20:17:57 +00:00
|
|
|
#if defined(IS_LINUX)
|
|
|
|
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);
|
2017-09-10 18:24:26 +00:00
|
|
|
memcpy(out, freetype_include, size);
|
2017-07-18 20:17:57 +00:00
|
|
|
pclose(file);
|
|
|
|
}
|
2017-09-10 18:24:26 +00:00
|
|
|
#elif defined(IS_MAC)
|
|
|
|
char *freetype_include = "/usr/local/include/freetype2";
|
|
|
|
size = strlen(freetype_include);
|
2019-02-05 09:13:38 +00:00
|
|
|
memcpy(out, freetype_include, size);
|
2017-09-10 18:24:26 +00:00
|
|
|
#endif
|
2017-07-18 20:17:57 +00:00
|
|
|
#endif
|
|
|
|
return(size);
|
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
build_main(Partition *part, char *cdir, b32 update_local_theme, u32 flags, u32 arch){
|
|
|
|
char *dir = fm_str(part, BUILD_DIR);
|
2017-02-18 01:04:41 +00:00
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
{
|
2018-11-27 20:09:24 +00:00
|
|
|
char *file = fm_str(part, "4ed_app_target.cpp");
|
|
|
|
char **exports = fm_list_one_item(part, "app_get_functions");
|
2017-07-18 19:53:12 +00:00
|
|
|
|
|
|
|
char **build_includes = includes;
|
|
|
|
|
|
|
|
char ft_include[512];
|
|
|
|
i32 ft_size = get_freetype_include(ft_include, sizeof(ft_include) - 1);
|
|
|
|
if (ft_size > 0){
|
|
|
|
ft_include[ft_size] = 0;
|
2017-09-10 18:24:26 +00:00
|
|
|
fprintf(stdout, "FREETYPE: %s\n", ft_include);
|
2018-11-27 20:09:24 +00:00
|
|
|
build_includes = fm_list(part, build_includes, fm_list_one_item(part, ft_include));
|
2017-07-18 19:53:12 +00:00
|
|
|
}
|
|
|
|
|
2016-08-28 17:31:43 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
build(part, OPTS | SHARED_CODE | flags, arch, cdir, file, dir, "4ed_app" DLL, get_defines_from_flags(part, flags), exports, build_includes);
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed_app");
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
char **inc = (char**)fm_list(part, includes, platform_includes[This_OS][This_Compiler]);
|
|
|
|
build(part, OPTS | LIBS | ICON | flags, arch, cdir, platform_layers[This_OS], dir, "4ed", get_defines_from_flags(part, flags), 0, inc);
|
2016-08-28 17:31:43 +00:00
|
|
|
END_TIME_SECTION("build 4ed");
|
|
|
|
}
|
2017-06-05 21:48:49 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
if (update_local_theme){
|
2017-06-05 21:48:49 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2018-11-27 20:09:24 +00:00
|
|
|
char *themes_folder = fm_str(part, "../build/themes");
|
|
|
|
char *source_themes_folder = fm_str(part, "themes");
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_clear_folder(themes_folder);
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_make_folder_if_missing(part, 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
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
standard_build(Partition *part, char *cdir, u32 flags, u32 arch){
|
|
|
|
fsm_generator(part, cdir);
|
|
|
|
metagen(part, cdir);
|
2019-02-14 04:21:52 +00:00
|
|
|
//do_buildsuper(part, cdir, fm_str(part, custom_files[Custom_Default]), arch);
|
|
|
|
do_buildsuper(part, cdir, fm_str(part, custom_files[Custom_Experiments]), arch);
|
2018-11-27 20:09:24 +00:00
|
|
|
//do_buildsuper(part, cdir, fm_str(part, custom_files[Custom_Casey]), arch);
|
|
|
|
//do_buildsuper(part, cdir, fm_str(part, custom_files[Custom_ChronalVim]), arch);
|
|
|
|
build_main(part, cdir, true, flags, arch);
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
internal char*
|
2018-11-27 20:09:24 +00:00
|
|
|
get_4coder_dist_name(Partition *part, u32 platform, char *tier, u32 arch){
|
|
|
|
char *name = fm_str(part, "4coder-alpha-" MAJOR_STR "-" MINOR_STR "-" PATCH_STR);
|
2017-07-08 19:25:23 +00:00
|
|
|
if (strcmp(tier, "alpha") != 0){
|
2018-11-27 20:09:24 +00:00
|
|
|
name = fm_str(part, name, "-", tier);
|
2016-11-14 06:39:03 +00:00
|
|
|
}
|
2017-07-08 19:25:23 +00:00
|
|
|
if (platform != Platform_None){
|
2018-11-27 20:09:24 +00:00
|
|
|
name = fm_str(part, name, "-", platform_names[platform]);
|
2017-02-27 14:53:38 +00:00
|
|
|
}
|
2017-07-08 19:25:23 +00:00
|
|
|
if (arch != Arch_None){
|
2018-11-27 20:09:24 +00:00
|
|
|
name = fm_str(part, name, "-", arch_names[arch]);
|
2017-02-26 21:44:40 +00:00
|
|
|
}
|
2017-07-08 19:25:23 +00:00
|
|
|
return(name);
|
2017-06-16 23:10:50 +00:00
|
|
|
}
|
|
|
|
|
2017-07-09 19:22:57 +00:00
|
|
|
internal void
|
2018-11-27 20:09:24 +00:00
|
|
|
package(Partition *part, char *cdir){
|
2016-09-04 23:58:49 +00:00
|
|
|
// NOTE(allen): meta
|
2018-11-27 20:09:24 +00:00
|
|
|
fsm_generator(part, cdir);
|
|
|
|
metagen(part, cdir);
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
char *build_dir = fm_str(part, BUILD_DIR);
|
|
|
|
char *pack_dir = fm_str(part, PACK_DIR);
|
|
|
|
char *fonts_source_dir = fm_str(part, "../4coder-non-source/dist_files/fonts");
|
2017-07-07 23:54:50 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
char *base_package_root = "../current_dist";
|
2017-07-07 23:54:50 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
// NOTE(allen): alpha and super builds
|
|
|
|
enum{
|
2018-05-28 01:00:13 +00:00
|
|
|
Tier_Alpha = 0,
|
|
|
|
Tier_Super = 1,
|
|
|
|
Tier_COUNT = 2
|
2017-07-07 23:54:50 +00:00
|
|
|
};
|
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
char *tiers[] = { "alpha", "super" };
|
|
|
|
u32 base_flags = OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | LOG;
|
|
|
|
u32 tier_flags[] = { 0, SUPER, };
|
2016-09-04 23:58:49 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
for (u32 tier_index = 0; tier_index < Tier_COUNT; ++tier_index){
|
|
|
|
char *tier = tiers[tier_index];
|
|
|
|
u32 flags = base_flags | tier_flags[tier_index];
|
2017-02-26 21:44:40 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
Temp_Memory temp = begin_temp_memory(part);
|
|
|
|
char *tier_package_root = fm_str(part, base_package_root, "_", tier);
|
2017-07-08 19:25:23 +00:00
|
|
|
for (u32 arch = 0; arch < Arch_COUNT; ++arch){
|
2018-11-27 20:09:24 +00:00
|
|
|
char *par_dir = fm_str(part, tier_package_root, "_", arch_names[arch]);
|
|
|
|
char *dir = fm_str(part, par_dir, "/4coder");
|
|
|
|
char *fonts_dir = fm_str(part, dir, "/fonts");
|
|
|
|
char *zip_dir = fm_str(part, pack_dir, "/", tier, "_", arch_names[arch]);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2018-06-16 20:57:32 +00:00
|
|
|
build_metadata();
|
2018-11-27 20:09:24 +00:00
|
|
|
build_main(part, cdir, false, flags, arch);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-07 23:54:50 +00:00
|
|
|
fm_clear_folder(par_dir);
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_make_folder_if_missing(part, dir);
|
|
|
|
fm_copy_file(fm_str(part, build_dir, "/4ed" EXE), fm_str(part, dir, "/4ed" EXE));
|
|
|
|
fm_copy_file(fm_str(part, build_dir, "/4ed_app" DLL), fm_str(part, dir, "/4ed_app" DLL));
|
2017-06-16 23:10:50 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_copy_folder(part, cdir, dir, "themes");
|
|
|
|
fm_copy_file(fm_str(part, cdir, "/LICENSE.txt"), fm_str(part, dir, "/LICENSE.txt"));
|
|
|
|
fm_copy_file(fm_str(part, cdir, "/README.txt"), fm_str(part, dir, "/README.txt"));
|
|
|
|
fm_copy_file(fm_str(part, cdir, "/changes.txt"), fm_str(part, dir, "/changes.txt"));
|
2017-06-24 13:49:20 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_make_folder_if_missing(part, fonts_dir);
|
2017-07-08 19:25:23 +00:00
|
|
|
fm_copy_all(fonts_source_dir, "*", fonts_dir);
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_copy_file(fm_str(part, cdir, "/release-config.4coder"), fm_str(part, dir, "/config.4coder"));
|
2017-02-25 01:53:40 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
if (tier_index == Tier_Super){
|
|
|
|
fm_copy_all(0, "4coder_*", dir);
|
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
do_buildsuper(part, cdir, fm_str(part, custom_files[Custom_Default]), arch);
|
|
|
|
fm_copy_file(fm_str(part, build_dir, "/custom_4coder" DLL), fm_str(part, dir, "/custom_4coder" DLL));
|
2017-07-08 19:25:23 +00:00
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
char *build_script = fm_str(part, "buildsuper_", arch_names[arch], BAT);
|
|
|
|
fm_copy_file(build_script, fm_str(part, dir, "/buildsuper" BAT));
|
2017-07-08 19:25:23 +00:00
|
|
|
|
|
|
|
if (This_OS == Platform_Windows){
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_copy_folder(part, cdir, dir, "windows_scripts");
|
2017-07-08 19:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
fm_copy_folder(part, cdir, dir, "4coder_API");
|
|
|
|
fm_copy_folder(part, cdir, dir, "4coder_lib");
|
|
|
|
fm_copy_folder(part, cdir, dir, "4coder_generated");
|
|
|
|
fm_copy_folder(part, cdir, dir, "languages");
|
2017-06-24 13:49:20 +00:00
|
|
|
}
|
|
|
|
|
2018-11-27 20:09:24 +00:00
|
|
|
char *dist_name = get_4coder_dist_name(part, This_OS, tier, arch);
|
|
|
|
char *zip_name = fm_str(part, zip_dir, "/", dist_name, ".zip");
|
|
|
|
fm_make_folder_if_missing(part, zip_dir);
|
2017-07-08 19:25:23 +00:00
|
|
|
fm_zip(par_dir, "4coder", zip_name);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2018-11-27 20:09:24 +00:00
|
|
|
end_temp_memory(temp);
|
2017-02-25 01:53:40 +00:00
|
|
|
}
|
2016-09-04 23:58:49 +00:00
|
|
|
}
|
2016-08-31 01:44:02 +00:00
|
|
|
|
|
|
|
int main(int argc, char **argv){
|
2018-11-27 20:09:24 +00:00
|
|
|
Partition part = fm_init_system();
|
2016-08-31 01:44:02 +00:00
|
|
|
|
2017-07-08 19:25:23 +00:00
|
|
|
char cdir[256];
|
2016-08-31 01:44:02 +00:00
|
|
|
BEGIN_TIME_SECTION();
|
2017-07-07 23:54:50 +00:00
|
|
|
i32 n = fm_get_current_directory(cdir, sizeof(cdir));
|
2017-07-08 19:25:23 +00:00
|
|
|
Assert(n < sizeof(cdir));
|
2016-08-31 01:44:02 +00:00
|
|
|
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-07-08 19:25:23 +00:00
|
|
|
u32 arch = Arch_X64;
|
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)
|
2017-07-08 19:25:23 +00:00
|
|
|
arch = Arch_X86;
|
2017-07-07 23:54:50 +00:00
|
|
|
#endif
|
2018-11-27 20:09:24 +00:00
|
|
|
standard_build(&part, cdir, flags, arch);
|
2017-02-23 00:22:59 +00:00
|
|
|
|
2016-08-28 04:31:06 +00:00
|
|
|
#elif defined(PACKAGE)
|
2018-11-27 20:09:24 +00:00
|
|
|
package(&part, cdir);
|
2017-07-08 19:25:23 +00:00
|
|
|
|
2016-11-14 04:29:00 +00:00
|
|
|
#elif defined(SITE_BUILD)
|
2018-11-27 20:09:24 +00:00
|
|
|
site_build(&part, cdir, DEBUG_INFO);
|
2016-11-14 04:29:00 +00:00
|
|
|
|
2017-07-09 19:49:41 +00:00
|
|
|
#elif defined(STRING_BUILD)
|
2018-11-27 20:09:24 +00:00
|
|
|
string_build(&part, cdir);
|
2017-07-09 19:49:41 +00:00
|
|
|
|
2016-08-31 01:44:02 +00:00
|
|
|
#else
|
2017-07-08 19:25:23 +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
|
|
|
|
2016-08-28 15:42:12 +00:00
|
|
|
// BOTTOM
|
2017-01-23 06:19:43 +00:00
|
|
|
|