From e0db8d162716e2621ba266c8e9d544a699eca821 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Tue, 18 Jul 2017 15:53:12 -0400 Subject: [PATCH] creating merge conflicts just because I can --- meta/4ed_build.cpp | 50 ++++++++++++++++++-------------- platform_all/4ed_work_queues.cpp | 12 ++++++++ platform_linux/linux_4ed.cpp | 12 ++++---- platform_win32/win32_4ed.cpp | 12 -------- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/meta/4ed_build.cpp b/meta/4ed_build.cpp index c89c2d62..82ca5402 100644 --- a/meta/4ed_build.cpp +++ b/meta/4ed_build.cpp @@ -9,7 +9,7 @@ // TOP -//#define FM_PRINT_COMMANDS +#define FM_PRINT_COMMANDS #include "../4ed_defines.h" @@ -327,6 +327,22 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c # error gcc options not set for this platform #endif +internal i32 +get_freetype_include(char *out, u32 max){ + i32 size = 0; +#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); + freetype_include[size-1] = 0; + pclose(file); + } +#endif + return(size); +} + internal void build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, char *out_file, char **defines, char **exports, char **inc_folders){ Build_Line line; @@ -348,26 +364,6 @@ build(u32 flags, u32 arch, char *code_path, char **code_files, char *out_path, c fm_add_to_line(line, GCC_OPTS); } -#if 0 - if (flags & INCLUDES){ -#if defined(IS_LINUX) - i32 size = 0; - 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); - } - - fm_add_to_line(line, GCC_INCLUDES" %s", freetype_include); -#else - fm_add_to_line(line, GCC_INCLUDES); -#endif - } -#endif - fm_add_to_line(line, "-I%s", code_path); if (inc_folders != 0){ for (u32 i = 0; inc_folders[i] != 0; ++i){ @@ -518,8 +514,18 @@ build_main(char *cdir, b32 update_local_theme, u32 flags, u32 arch){ { char *file = fm_str("4ed_app_target.cpp"); char **exports = fm_list_one_item("app_get_functions"); + + 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; + build_includes = fm_list(build_includes, fm_list_one_item(ft_include)); + } + BEGIN_TIME_SECTION(); - build(OPTS | SHARED_CODE | flags, arch, cdir, file, dir, "4ed_app" DLL, get_defines_from_flags(flags), exports, includes); + build(OPTS | SHARED_CODE | flags, arch, cdir, file, dir, "4ed_app" DLL, get_defines_from_flags(flags), exports, build_includes); END_TIME_SECTION("build 4ed_app"); } diff --git a/platform_all/4ed_work_queues.cpp b/platform_all/4ed_work_queues.cpp index bc584011..b3316a82 100644 --- a/platform_all/4ed_work_queues.cpp +++ b/platform_all/4ed_work_queues.cpp @@ -9,6 +9,18 @@ // TOP +enum CV_ID{ + CANCEL_CV0, + CANCEL_CV1, + CANCEL_CV2, + CANCEL_CV3, + CANCEL_CV4, + CANCEL_CV5, + CANCEL_CV6, + CANCEL_CV7, + CV_COUNT +}; + struct Thread_Context{ u32 job_id; b32 running; diff --git a/platform_linux/linux_4ed.cpp b/platform_linux/linux_4ed.cpp index 98edba11..d9df8f1a 100644 --- a/platform_linux/linux_4ed.cpp +++ b/platform_linux/linux_4ed.cpp @@ -76,8 +76,6 @@ #include #include -#include "4ed_link_system_functions.cpp" - // // Linux macros // @@ -231,22 +229,22 @@ struct Condition_Variable{ internal void system_acquire_lock(Mutex *m){ - pthread_mutex_lock(m->crit); + pthread_mutex_lock(&m->crit); } internal void system_release_lock(Mutex *m){ - pthread_mutex_unlock(m->crit); + pthread_mutex_unlock(&m->crit); } internal void system_wait_cv(Condition_Variable *cv, Mutex *m){ - pthread_cond_wait(cv->cv, m->crit); + pthread_cond_wait(&cv->cv, &m->crit); } internal void system_signal_cv(Condition_Variable *cv, Mutex *m){ - pthread_cond_signal(cv->cv); + pthread_cond_signal(&cv->cv); } // HACK(allen): Reduce this down to just one layer of call. @@ -2055,7 +2053,7 @@ main(int argc, char **argv){ threadvars.thread_memory = thread_memory; sem_init(&linuxvars.thread_semaphore, 0, 0); - threadvars.queues[BACKGROUND_THREADS].semaphore = LinuxSemToHandle(&linuxvars.thread_semaphore); + threadvars.queues[BACKGROUND_THREADS].semaphore = handle_sem(&linuxvars.thread_semaphore); for(i32 i = 0; i < threadvars.groups[BACKGROUND_THREADS].count; ++i){ Thread_Context *thread = threadvars.groups[BACKGROUND_THREADS].threads + i; diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index bdf7eb34..a53a2a4b 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -123,18 +123,6 @@ struct Win32_Coroutine{ i32 done; }; -enum CV_ID{ - CANCEL_CV0, - CANCEL_CV1, - CANCEL_CV2, - CANCEL_CV3, - CANCEL_CV4, - CANCEL_CV5, - CANCEL_CV6, - CANCEL_CV7, - CV_COUNT -}; - struct Win32_Vars{ App_Functions app; Custom_API custom_api;