Fix 32 bit windows build

master
Allen Webster 2021-01-24 15:30:57 -08:00
parent 7c822233c5
commit 10bb28bb40
6 changed files with 144 additions and 149 deletions

View File

@ -180,17 +180,14 @@ get_defines_from_flags(Arena *arena, u32 flags){
#if COMPILER_CL #if COMPILER_CL
#define CL_OPTS \ #define CL_OPTS \
"-W4 -wd4310 -wd4100 -wd4201 -wd4505 -wd4996 " \ "-W4 -wd4310 -wd4100 -wd4201 -wd4505 -wd4996 " \
"-wd4127 -wd4510 -wd4512 -wd4610 -wd4390 " \ "-wd4127 -wd4510 -wd4512 -wd4610 -wd4390 " \
"-wd4611 -wd4189 -WX -GR- -EHa- -nologo -FC" "-wd4611 -wd4189 -WX -GR- -EHa- -nologo -FC"
#define CL_LIBS_X64 \ #define CL_LIBS_COMMON \
"user32.lib winmm.lib gdi32.lib opengl32.lib comdlg32.lib userenv.lib " \ "user32.lib winmm.lib gdi32.lib opengl32.lib comdlg32.lib userenv.lib "
FOREIGN_WIN "\\x64\\freetype.lib" #define CL_LIBS_X64 CL_LIBS_COMMON FOREIGN_WIN "\\x64\\freetype.lib"
#define CL_LIBS_X86 CL_LIBS_COMMON FOREIGN_WIN "\\x86\\freetype.lib"
#define CL_LIBS_X86 \
"user32.lib winmm.lib gdi32.lib opengl32.lib comdlg32.lib " \
FOREIGN_WIN "\\x86\\freetype.lib"
#define CL_ICON "..\\4coder-non-source\\res\\icon.res" #define CL_ICON "..\\4coder-non-source\\res\\icon.res"
@ -303,19 +300,19 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
#if OS_LINUX #if OS_LINUX
# define GCC_OPTS \ # define GCC_OPTS \
"-Wno-write-strings " \ "-Wno-write-strings " \
"-D_GNU_SOURCE -fPIC " \ "-D_GNU_SOURCE -fPIC " \
"-fno-threadsafe-statics -pthread " \ "-fno-threadsafe-statics -pthread " \
"-Wno-unused-result " \ "-Wno-unused-result " \
"-std=c++11" "-std=c++11"
#define GCC_LIBS_COMMON \ # define GCC_LIBS_COMMON \
"-lX11 -lpthread -lm -lrt " \ "-lX11 -lpthread -lm -lrt " \
"-lGL -ldl -lXfixes -lfreetype -lfontconfig" "-lGL -ldl -lXfixes -lfreetype -lfontconfig"
#define GCC_LIBS_X64 GCC_LIBS_COMMON # define GCC_LIBS_X64 GCC_LIBS_COMMON
#define GCC_LIBS_X86 GCC_LIBS_COMMON # define GCC_LIBS_X86 GCC_LIBS_COMMON
#else #else
# error gcc options not set for this platform # error gcc options not set for this platform
@ -597,7 +594,7 @@ get_4coder_dist_name(Arena *arena, u32 platform, char *tier, u32 arch){
function void function void
package_for_arch(Arena *arena, u32 arch, char *cdir, char *build_dir, char *pack_dir, i32 tier, char *tier_name, char *current_dist_tier, u32 flags, char** dist_files, i32 dist_file_count){ package_for_arch(Arena *arena, u32 arch, char *cdir, char *build_dir, char *pack_dir, i32 tier, char *tier_name, char *current_dist_tier, u32 flags, char** dist_files, i32 dist_file_count){
char *arch_name = arch_names[arch]; char *arch_name = arch_names[arch];
char *parent_dir = fm_str(arena, current_dist_tier, "_", arch_name); char *parent_dir = fm_str(arena, current_dist_tier, "_", arch_name);
char *dir = fm_str(arena, parent_dir, SLASH "4coder"); char *dir = fm_str(arena, parent_dir, SLASH "4coder");
char *zip_dir = fm_str(arena, pack_dir, SLASH, tier_name, "_", arch_name); char *zip_dir = fm_str(arena, pack_dir, SLASH, tier_name, "_", arch_name);

View File

@ -1,3 +1,2 @@
@echo off @echo off
bin\build.bat /DDEV_BUILD_X86
build.bat /DDEV_BUILD_X86

View File

@ -19,7 +19,7 @@ data_from_file(Arena *arena, FILE *file){
result.size = ftell(file); result.size = ftell(file);
fseek(file, 0, SEEK_SET); fseek(file, 0, SEEK_SET);
result.str = push_array(arena, u8, result.size + 1); result.str = push_array(arena, u8, result.size + 1);
fread(result.str, 1, result.size, file); fread(result.str, 1, (size_t)result.size, file);
result.str[result.size] = 0; result.str[result.size] = 0;
} }
return(result); return(result);

View File

@ -1032,7 +1032,7 @@ CUSTOM_DOC("Prints the current project to the file it was loaded from; prints in
for (String8Node *node = prj_string.first; for (String8Node *node = prj_string.first;
node != 0; node != 0;
node = node->next){ node = node->next){
fwrite(node->string.str, 1, node->string.size, file); fwrite(node->string.str, 1, (size_t)node->string.size, file);
} }
fclose(file); fclose(file);
print_message(app, str8_lit("Reloading project buffer\n")); print_message(app, str8_lit("Reloading project buffer\n"));

View File

@ -122,9 +122,8 @@ system_memory_annotation_sig(){
// 4ed path // 4ed path
// //
extern "C" { extern "C" BOOL CALL_CONVENTION
BOOL GetUserProfileDirectoryW(HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchSize); GetUserProfileDirectoryW(HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchSize);
}
internal internal
system_get_path_sig(){ system_get_path_sig(){

View File

@ -2,146 +2,146 @@ version(2);
project_name = "4coder"; project_name = "4coder";
patterns = { patterns = {
"*.c", "*.c",
"*.cpp", "*.cpp",
"*.h", "*.h",
"*.m", "*.m",
"*.mm", "*.mm",
"*.bat", "*.bat",
"*.sh", "*.sh",
"*.4coder", "*.4coder",
"*.txt", "*.txt",
}; };
blacklist_patterns = { blacklist_patterns = {
".*", ".*",
}; };
load_path_shared = { .path = ".", .recursive = true, .relative = true, }; load_path_shared = { .path = ".", .recursive = true, .relative = true, };
load_paths = { load_paths = {
.win = { load_path_shared }, .win = { load_path_shared },
.linux = { load_path_shared }, .linux = { load_path_shared },
.mac = { load_path_shared }, .mac = { load_path_shared },
}; };
commands = { commands = {
.build_x64 = { .build_x64 = {
.win = "echo build: x64 & bin\\build.bat", .win = "echo build: x64 & bin\\build.bat",
.linux = "echo build: x64 & bin/build-linux.sh", .linux = "echo build: x64 & bin/build-linux.sh",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_x86 = { .build_x86 = {
.win = "echo build: x86 & bin\\build.bat /DDEV_BUILD_X86", .win = "echo build: x86 & bin\\build.bat /DDEV_BUILD_X86",
.linux = "echo build: x86 & bin/build-linux.sh /DDEV_BUILD_X86", .linux = "echo build: x86 & bin/build-linux.sh /DDEV_BUILD_X86",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.package = { .package = {
.win = "echo package & bin\\package.bat", .win = "echo package & bin\\package.bat",
.linux = "echo package & bin/package.sh", .linux = "echo package & bin/package.sh",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = false, .footer_panel = false,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.run_one_time = { .run_one_time = {
.win = "pushd ..\\build & one_time", .win = "pushd ..\\build & one_time",
.linux = "pushd ../build & one_time", .linux = "pushd ../build & one_time",
.out = "*run*", .out = "*run*",
.footer_panel = false, .footer_panel = false,
.save_dirty_files = false, .save_dirty_files = false,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_custom_api_docs = { .build_custom_api_docs = {
.win = "custom\\bin\\build_one_time docs\\4ed_doc_custom_api_main.cpp ..\\build", .win = "custom\\bin\\build_one_time docs\\4ed_doc_custom_api_main.cpp ..\\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_C___lexer_generator = { .build_C___lexer_generator = {
.win = "custom\bin\build_one_time custom\languages\4coder_cpp_lexer_gen.cpp ..\build", .win = "custom\bin\build_one_time custom\languages\4coder_cpp_lexer_gen.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_token_tester = { .build_token_tester = {
.win = "custom\bin\build_one_time custom\languages\4coder_cpp_lexer_test.cpp ..\build", .win = "custom\bin\build_one_time custom\languages\4coder_cpp_lexer_test.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_system_api = { .build_system_api = {
.win = "custom\bin\build_one_time 4ed_system_api.cpp ..\build", .win = "custom\bin\build_one_time 4ed_system_api.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_font_api = { .build_font_api = {
.win = "custom\bin\build_one_time 4ed_font_api.cpp ..\build", .win = "custom\bin\build_one_time 4ed_font_api.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_graphics_api = { .build_graphics_api = {
.win = "custom\bin\build_one_time 4ed_graphics_api.cpp ..\build", .win = "custom\bin\build_one_time 4ed_graphics_api.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_api_parser = { .build_api_parser = {
.win = "custom\bin\build_one_time 4ed_api_parser_main.cpp ..\build & copy /B ..\build\one_time.exe ..\build\api_parser.exe", .win = "custom\bin\build_one_time 4ed_api_parser_main.cpp ..\build & copy /B ..\build\one_time.exe ..\build\api_parser.exe",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_api_checker = { .build_api_checker = {
.win = "custom\bin\build_one_time 4ed_api_check.cpp ..\build & copy /B ..\build\one_time.exe ..\build\api_checker.exe", .win = "custom\bin\build_one_time 4ed_api_check.cpp ..\build & copy /B ..\build\one_time.exe ..\build\api_checker.exe",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_keycode_generator = { .build_keycode_generator = {
.win = "custom\bin\build_one_time 4ed_generate_keycodes.cpp ..\build", .win = "custom\bin\build_one_time 4ed_generate_keycodes.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.build_site_render = { .build_site_render = {
.win = "custom\bin\build_one_time site/4ed_site_render_main.cpp ..\build", .win = "custom\bin\build_one_time site/4ed_site_render_main.cpp ..\build",
.out = "*compilation*", .out = "*compilation*",
.footer_panel = true, .footer_panel = true,
.save_dirty_files = true, .save_dirty_files = true,
.cursor_at_end = false, .cursor_at_end = false,
}, },
.generate_custom_api_master_list = { .generate_custom_api_master_list = {
.win = "..\build\api_parser 4ed_api_implementation.cpp", .win = "..\build\api_parser 4ed_api_implementation.cpp",
.out = "*run*", .out = "*run*",
.footer_panel = false, .footer_panel = false,
.save_dirty_files = false, .save_dirty_files = false,
.cursor_at_end = false, .cursor_at_end = false,
}, },
}; };
fkey_command = { fkey_command = {
.F1 = "build_x64", .F1 = "build_x64",
.F3 = "build_site_render", .F3 = "build_site_render",
.F4 = "run_one_time", .F4 = "run_one_time",
.F5 = "build_C___lexer_generator", .F5 = "build_C___lexer_generator",
.F6 = "build_token_tester", .F6 = "build_token_tester",
.F11 = "package", .F11 = "package",
}; };