setting up more mac build stuff

This commit is contained in:
Allen Webster 2017-09-10 14:24:26 -04:00
parent d02f9158d0
commit 67ab069e5b
7 changed files with 94 additions and 16 deletions

View File

@ -491,18 +491,26 @@ do_buildsuper(char *cdir, char *file, u32 arch){
END_TIME_SECTION("build custom");
}
// TODO(allen): Remove this
internal i32
get_freetype_include(char *out, u32 max){
i32 size = 0;
#if 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;
memcpy(out, freetype_include, size);
pclose(file);
}
#elif defined(IS_MAC)
char *freetype_include = "/usr/local/include/freetype2";
size = strlen(freetype_include);
memcpy(out, freetype_include, size
);
#endif
#endif
return(size);
}
@ -521,6 +529,7 @@ build_main(char *cdir, b32 update_local_theme, u32 flags, u32 arch){
i32 ft_size = get_freetype_include(ft_include, sizeof(ft_include) - 1);
if (ft_size > 0){
ft_include[ft_size] = 0;
fprintf(stdout, "FREETYPE: %s\n", ft_include);
build_includes = fm_list(build_includes, fm_list_one_item(ft_include));
}

View File

@ -35,7 +35,7 @@ static i32 prev_error = 0;
#endif
#define systemf(...) do{ \
i32 n = snprintf(SF_CMD, sizeof(SF_CMD), __VA_ARGS__); \
i32 n = snprintf(SF_CMD, sizeof(SF_CMD), __VA_ARGS__); \
AllowLocal(n); \
Assert(n < sizeof(SF_CMD)); \
SYSTEMF_PRINTF("%s\n", SF_CMD); \
@ -136,13 +136,13 @@ internal void fm__swap_ptr(char **A, char **B);
// Slashes
#if defined(IS_WINDOWS)
#define SLASH "\\"
# define SLASH "\\"
static char platform_correct_slash = '\\';
#elif defined(IS_LINUX) || defined(IS_MAC)
#define SLASH "/"
# define SLASH "/"
static char platform_correct_slash = '/';
#else
#error Slash not set for this platform.
# error Slash not set for this platform.
#endif
// File Extensions

View File

@ -50,7 +50,6 @@
#include <stdlib.h>
#include <locale.h>
#include <dlfcn.h>
#include <xmmintrin.h>
#include <ucontext.h>
@ -76,7 +75,7 @@
#include <linux/input.h>
#include "4ed_shared_thread_constants.h"
#include "linux_threading_wrapper.h"
#include "unix_threading_wrapper.h"
//
// Linux macros
@ -118,7 +117,7 @@ internal void LinuxStringDup(String*, void*, size_t);
global System_Functions sysfunc;
#include "4ed_shared_library_constants.h"
#include "linux_library_wrapper.h"
#include "unix_library_wrapper.h"
#include "4ed_standard_libraries.cpp"
#include "4ed_coroutine.cpp"
@ -484,10 +483,6 @@ Sys_CLI_End_Update_Sig(system_cli_end_update){
return(close_me);
}
//
// Linux rendering/font system functions
//
#include "4ed_font_data.h"
#include "4ed_system_shared.cpp"

View File

@ -45,6 +45,14 @@
#include "unix_4ed_headers.h"
#include <sys/syslimits.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
////////////////////////////////
#include "4ed_shared_thread_constants.h"
#include "unix_threading_wrapper.h"
////////////////////////////////
#define SLASH '/'
@ -52,7 +60,7 @@
global System_Functions sysfunc;
#include "4ed_shared_library_constants.h"
#include "mac_library_wrapper.h"
#include "unix_library_wrapper.h"
#include "4ed_standard_libraries.cpp"
#include "4ed_coroutine.cpp"
@ -76,6 +84,14 @@ global Coroutine_System_Auto_Alloc coroutines;
#include "osx_objective_c_to_cpp_links.h"
OSX_Vars osx;
#include <stdlib.h>
#include "4ed_font_data.h"
#include "4ed_system_shared.cpp"
#include "4ed_link_system_functions.cpp"
#include "4ed_shared_init_logic.cpp"
external void*
osx_allocate(umem size){
void *result = system_memory_allocate(size);
@ -111,6 +127,64 @@ osx_step(){
external void
osx_init(){
//
// System Linkage
//
link_system_code();
//
// Memory init
//
memset(&linuxvars, 0, sizeof(linuxvars));
memset(&target, 0, sizeof(target));
memset(&memory_vars, 0, sizeof(memory_vars));
memset(&plat_settings, 0, sizeof(plat_settings));
memset(&libraries, 0, sizeof(libraries));
memset(&app, 0, sizeof(app));
memset(&custom_api, 0, sizeof(custom_api));
memory_init();
//
// HACK(allen):
// Previously zipped stuff is here, it should be zipped in the new pattern now.
//
init_shared_vars();
//
// Dynamic Linkage
//
load_app_code();
link_rendering();
#if defined(FRED_SUPER)
load_custom_code();
#else
custom_api.get_bindings = get_bindings;
#endif
//
// Read command line
//
read_command_line(argc, argv);
//
// Threads
//
work_system_init();
//
// Coroutines
//
coroutines_init();
// TODO
}

View File

@ -13,6 +13,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>

View File

@ -9,8 +9,8 @@
// TOP
#if !defined(LINUX_THREADING_WRAPPER)
#define LINUX_THREADING_WRAPPER
#if !defined(MAC_THREADING_WRAPPER)
#define MAC_THREADING_WRAPPER
#define PLAT_THREAD_SIG(n) void* n(void *ptr)
typedef PLAT_THREAD_SIG(Thread_Function);
@ -35,7 +35,6 @@ union Semaphore{
FixSize(SEMAPHORE_TYPE_SIZE);
};
internal void
system_init_and_launch_thread(Thread *t, Thread_Function *proc, void *ptr){
pthread_create(&t->t, 0, proc, ptr);