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"); END_TIME_SECTION("build custom");
} }
// TODO(allen): Remove this
internal i32 internal i32
get_freetype_include(char *out, u32 max){ get_freetype_include(char *out, u32 max){
i32 size = 0; i32 size = 0;
#if 0
#if defined(IS_LINUX) #if defined(IS_LINUX)
char freetype_include[512]; char freetype_include[512];
FILE *file = popen("pkg-config --cflags freetype2", "r"); FILE *file = popen("pkg-config --cflags freetype2", "r");
if (file != 0){ if (file != 0){
fgets(freetype_include, sizeof(freetype_include), file); fgets(freetype_include, sizeof(freetype_include), file);
size = strlen(freetype_include); size = strlen(freetype_include);
freetype_include[size-1] = 0; memcpy(out, freetype_include, size);
pclose(file); pclose(file);
} }
#elif defined(IS_MAC)
char *freetype_include = "/usr/local/include/freetype2";
size = strlen(freetype_include);
memcpy(out, freetype_include, size
);
#endif
#endif #endif
return(size); 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); i32 ft_size = get_freetype_include(ft_include, sizeof(ft_include) - 1);
if (ft_size > 0){ if (ft_size > 0){
ft_include[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)); build_includes = fm_list(build_includes, fm_list_one_item(ft_include));
} }

View File

@ -136,13 +136,13 @@ internal void fm__swap_ptr(char **A, char **B);
// Slashes // Slashes
#if defined(IS_WINDOWS) #if defined(IS_WINDOWS)
#define SLASH "\\" # define SLASH "\\"
static char platform_correct_slash = '\\'; static char platform_correct_slash = '\\';
#elif defined(IS_LINUX) || defined(IS_MAC) #elif defined(IS_LINUX) || defined(IS_MAC)
#define SLASH "/" # define SLASH "/"
static char platform_correct_slash = '/'; static char platform_correct_slash = '/';
#else #else
#error Slash not set for this platform. # error Slash not set for this platform.
#endif #endif
// File Extensions // File Extensions

View File

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

View File

@ -45,6 +45,14 @@
#include "unix_4ed_headers.h" #include "unix_4ed_headers.h"
#include <sys/syslimits.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 '/' #define SLASH '/'
@ -52,7 +60,7 @@
global System_Functions sysfunc; global System_Functions sysfunc;
#include "4ed_shared_library_constants.h" #include "4ed_shared_library_constants.h"
#include "mac_library_wrapper.h" #include "unix_library_wrapper.h"
#include "4ed_standard_libraries.cpp" #include "4ed_standard_libraries.cpp"
#include "4ed_coroutine.cpp" #include "4ed_coroutine.cpp"
@ -76,6 +84,14 @@ global Coroutine_System_Auto_Alloc coroutines;
#include "osx_objective_c_to_cpp_links.h" #include "osx_objective_c_to_cpp_links.h"
OSX_Vars osx; 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* external void*
osx_allocate(umem size){ osx_allocate(umem size){
void *result = system_memory_allocate(size); void *result = system_memory_allocate(size);
@ -111,6 +127,64 @@ osx_step(){
external void external void
osx_init(){ 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 // TODO
} }

View File

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

View File

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