fixed site building system
parent
45e46f78a7
commit
108250307a
81
build.cpp
81
build.cpp
|
@ -430,7 +430,8 @@ enum{
|
||||||
SUPER = 0x40,
|
SUPER = 0x40,
|
||||||
INTERNAL = 0x80,
|
INTERNAL = 0x80,
|
||||||
OPTIMIZATION = 0x100,
|
OPTIMIZATION = 0x100,
|
||||||
KEEP_ASSERT = 0x200
|
KEEP_ASSERT = 0x200,
|
||||||
|
SITE_INCLUDES = 0x400,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -483,6 +484,9 @@ init_build_line(Build_Line *line){
|
||||||
#define CL_INCLUDES \
|
#define CL_INCLUDES \
|
||||||
"/I..\\foreign /I..\\foreign\\freetype2"
|
"/I..\\foreign /I..\\foreign\\freetype2"
|
||||||
|
|
||||||
|
#define CL_SITE_INCLUDES \
|
||||||
|
"/I..\\..\\code"
|
||||||
|
|
||||||
#define CL_LIBS \
|
#define CL_LIBS \
|
||||||
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
||||||
"..\\foreign\\freetype.lib"
|
"..\\foreign\\freetype.lib"
|
||||||
|
@ -491,10 +495,7 @@ init_build_line(Build_Line *line){
|
||||||
"..\\res\\icon.res"
|
"..\\res\\icon.res"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_cl(uint32_t flags,
|
build_cl(uint32_t flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
||||||
char *code_path, char *code_file,
|
|
||||||
char *out_path, char *out_file,
|
|
||||||
char *exports){
|
|
||||||
slash_fix(out_path);
|
slash_fix(out_path);
|
||||||
slash_fix(code_path);
|
slash_fix(code_path);
|
||||||
|
|
||||||
|
@ -509,6 +510,10 @@ build_cl(uint32_t flags,
|
||||||
build_ap(line, CL_INCLUDES);
|
build_ap(line, CL_INCLUDES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags & SITE_INCLUDES){
|
||||||
|
build_ap(line, CL_SITE_INCLUDES);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & LIBS){
|
if (flags & LIBS){
|
||||||
build_ap(line, CL_LIBS);
|
build_ap(line, CL_LIBS);
|
||||||
}
|
}
|
||||||
|
@ -552,31 +557,26 @@ build_cl(uint32_t flags,
|
||||||
snprintf(link_options, sizeof(link_options), "/NODEFAULTLIB:library");
|
snprintf(link_options, sizeof(link_options), "/NODEFAULTLIB:library");
|
||||||
}
|
}
|
||||||
|
|
||||||
systemf("pushd %s & cl %s %s\\%s /Fe%s /link /DEBUG /INCREMENTAL:NO %s",
|
systemf("pushd %s & cl %s %s\\%s /Fe%s /link /DEBUG /INCREMENTAL:NO %s", out_path, line.build_options, code_path, code_file, out_file, link_options);
|
||||||
out_path, line.build_options, code_path, code_file, out_file, link_options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NOTE(inso): added ../code to GCC_OPTS to allow metagen to build.
|
|
||||||
// this is currently needed because it is built with cwd ../meta but includes
|
|
||||||
// 4cpp_lexer.h which is in code/ whereas metagen.cpp is in code/site
|
|
||||||
|
|
||||||
#define GCC_OPTS \
|
#define GCC_OPTS \
|
||||||
"-Wno-write-strings -D_GNU_SOURCE -fPIC " \
|
"-Wno-write-strings -D_GNU_SOURCE -fPIC " \
|
||||||
"-fno-threadsafe-statics -pthread -I../code"
|
"-fno-threadsafe-statics -pthread"
|
||||||
|
|
||||||
#define GCC_INCLUDES \
|
#define GCC_INCLUDES \
|
||||||
"-I../foreign"
|
"-I../foreign"
|
||||||
|
|
||||||
|
#define GCC_SITE_INCLUDES \
|
||||||
|
"-I../../code"
|
||||||
|
|
||||||
#define GCC_LIBS \
|
#define GCC_LIBS \
|
||||||
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
|
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
|
||||||
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
|
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_gcc(uint32_t flags,
|
build_gcc(uint32_t flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
||||||
char *code_path, char *code_file,
|
|
||||||
char *out_path, char *out_file,
|
|
||||||
char *exports){
|
|
||||||
Build_Line line;
|
Build_Line line;
|
||||||
init_build_line(&line);
|
init_build_line(&line);
|
||||||
|
|
||||||
|
@ -601,6 +601,10 @@ build_gcc(uint32_t flags,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags & SITE_INCLUDES){
|
||||||
|
build_ap(line, GCC_SITE_INCLUDES);
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & DEBUG_INFO){
|
if (flags & DEBUG_INFO){
|
||||||
build_ap(line, "-g -O0");
|
build_ap(line, "-g -O0");
|
||||||
}
|
}
|
||||||
|
@ -642,10 +646,7 @@ build_gcc(uint32_t flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build(uint32_t flags,
|
build(uint32_t flags, char *code_path, char *code_file, char *out_path, char *out_file, char *exports){
|
||||||
char *code_path, char *code_file,
|
|
||||||
char *out_path, char *out_file,
|
|
||||||
char *exports){
|
|
||||||
#if defined(IS_CL)
|
#if defined(IS_CL)
|
||||||
build_cl(flags, code_path, code_file, out_path, out_file, exports);
|
build_cl(flags, code_path, code_file, out_path, out_file, exports);
|
||||||
#elif defined(IS_GCC)
|
#elif defined(IS_GCC)
|
||||||
|
@ -683,6 +684,7 @@ buildsuper(char *code_path, char *out_path, char *filename){
|
||||||
#define D_META_FSM_DIR "../meta/fsmgen"
|
#define D_META_FSM_DIR "../meta/fsmgen"
|
||||||
#define D_META_GEN_DIR "../meta/metagen"
|
#define D_META_GEN_DIR "../meta/metagen"
|
||||||
#define D_BUILD_DIR "../build"
|
#define D_BUILD_DIR "../build"
|
||||||
|
#define D_BUILD_SITE_DIR "../build/site"
|
||||||
|
|
||||||
#define D_PACK_DIR "../distributions"
|
#define D_PACK_DIR "../distributions"
|
||||||
#define D_PACK_DATA_DIR "../data/dist_files"
|
#define D_PACK_DATA_DIR "../data/dist_files"
|
||||||
|
@ -700,6 +702,7 @@ static char *META_DIR = 0;
|
||||||
static char *META_FSM_DIR = 0;
|
static char *META_FSM_DIR = 0;
|
||||||
static char *META_GEN_DIR = 0;
|
static char *META_GEN_DIR = 0;
|
||||||
static char *BUILD_DIR = 0;
|
static char *BUILD_DIR = 0;
|
||||||
|
static char *BUILD_SITE_DIR = 0;
|
||||||
static char *PACK_DIR = 0;
|
static char *PACK_DIR = 0;
|
||||||
static char *PACK_DATA_DIR = 0;
|
static char *PACK_DATA_DIR = 0;
|
||||||
static char *DATA_DIR = 0;
|
static char *DATA_DIR = 0;
|
||||||
|
@ -738,6 +741,10 @@ init_global_strings(){
|
||||||
append_sc(&builder, D_BUILD_DIR);
|
append_sc(&builder, D_BUILD_DIR);
|
||||||
append_ss(&builder, term);
|
append_ss(&builder, term);
|
||||||
|
|
||||||
|
BUILD_SITE_DIR = get_head(builder);
|
||||||
|
append_sc(&builder, D_BUILD_SITE_DIR);
|
||||||
|
append_ss(&builder, term);
|
||||||
|
|
||||||
PACK_DIR = get_head(builder);
|
PACK_DIR = get_head(builder);
|
||||||
append_sc(&builder, D_PACK_DIR);
|
append_sc(&builder, D_PACK_DIR);
|
||||||
append_ss(&builder, term);
|
append_ss(&builder, term);
|
||||||
|
@ -803,8 +810,7 @@ static void
|
||||||
metagen(char *cdir){
|
metagen(char *cdir){
|
||||||
{
|
{
|
||||||
BEGIN_TIME_SECTION();
|
BEGIN_TIME_SECTION();
|
||||||
build(OPTS | DEBUG_INFO, cdir, "4ed_metagen.cpp",
|
build(OPTS | DEBUG_INFO, cdir, "4ed_metagen.cpp", META_DIR, "metagen", 0);
|
||||||
META_DIR, "metagen", 0);
|
|
||||||
END_TIME_SECTION("build metagen");
|
END_TIME_SECTION("build metagen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,15 +853,13 @@ static void
|
||||||
build_main(char *cdir, uint32_t flags){
|
build_main(char *cdir, uint32_t flags){
|
||||||
{
|
{
|
||||||
BEGIN_TIME_SECTION();
|
BEGIN_TIME_SECTION();
|
||||||
build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, "4ed_app_target.cpp",
|
build(OPTS | INCLUDES | SHARED_CODE | flags, cdir, "4ed_app_target.cpp", BUILD_DIR, "4ed_app"DLL, "/EXPORT:app_get_functions");
|
||||||
BUILD_DIR, "4ed_app"DLL, "/EXPORT:app_get_functions");
|
|
||||||
END_TIME_SECTION("build 4ed_app");
|
END_TIME_SECTION("build 4ed_app");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
BEGIN_TIME_SECTION();
|
BEGIN_TIME_SECTION();
|
||||||
build(OPTS | INCLUDES | LIBS | ICON | flags, cdir, PLAT_LAYER,
|
build(OPTS | INCLUDES | LIBS | ICON | flags, cdir, PLAT_LAYER, BUILD_DIR, "4ed", 0);
|
||||||
BUILD_DIR, "4ed", 0);
|
|
||||||
END_TIME_SECTION("build 4ed");
|
END_TIME_SECTION("build 4ed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -868,6 +872,13 @@ standard_build(char *cdir, uint32_t flags){
|
||||||
build_main(cdir, flags);
|
build_main(cdir, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
site_build(char *cdir, uint32_t flags){
|
||||||
|
BEGIN_TIME_SECTION();
|
||||||
|
build(OPTS | SITE_INCLUDES | flags, cdir, "site/sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0);
|
||||||
|
END_TIME_SECTION("build site");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_4coder_dist_name(String *zip_file, int32_t OS_specific, char *tier, char *ext){
|
get_4coder_dist_name(String *zip_file, int32_t OS_specific, char *tier, char *ext){
|
||||||
zip_file->size = 0;
|
zip_file->size = 0;
|
||||||
|
@ -1005,6 +1016,24 @@ int main(int argc, char **argv){
|
||||||
return(error_state);
|
return(error_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(SITE_BUILD)
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
init_time_system();
|
||||||
|
init_global_strings();
|
||||||
|
|
||||||
|
char cdir[256];
|
||||||
|
|
||||||
|
BEGIN_TIME_SECTION();
|
||||||
|
int32_t n = get_current_directory(cdir, sizeof(cdir));
|
||||||
|
assert(n < sizeof(cdir));
|
||||||
|
END_TIME_SECTION("current directory");
|
||||||
|
|
||||||
|
site_build(cdir, DEBUG_INFO);
|
||||||
|
|
||||||
|
return(error_state);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error No build type specified
|
#error No build type specified
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
build.bat /DSITE_BUILD
|
|
@ -10,9 +10,7 @@
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
#include "4coder_version.h"
|
#include "4coder_version.h"
|
||||||
|
|
||||||
#include "internal_4coder_string.cpp"
|
#include "internal_4coder_string.cpp"
|
||||||
|
|
||||||
#include "4cpp_lexer.h"
|
#include "4cpp_lexer.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
Loading…
Reference in New Issue