Created separate build files for macOS.
This commit is contained in:
parent
65774dec46
commit
921a68e765
|
@ -90,7 +90,7 @@ char *includes[] = { "custom", FOREIGN "/freetype2", 0, };
|
||||||
|
|
||||||
char *windows_platform_layer[] = { "platform_win32/win32_4ed.cpp", 0 };
|
char *windows_platform_layer[] = { "platform_win32/win32_4ed.cpp", 0 };
|
||||||
char *linux_platform_layer[] = { "platform_linux/linux_4ed.cpp", 0 };
|
char *linux_platform_layer[] = { "platform_linux/linux_4ed.cpp", 0 };
|
||||||
char *mac_platform_layer[] = { "platform_mac/mac_4ed.m", "platform_mac/mac_4ed.cpp", 0 };
|
char *mac_platform_layer[] = { "platform_mac/mac_4ed_old.m", 0 };
|
||||||
|
|
||||||
char **platform_layers[Platform_COUNT] = {
|
char **platform_layers[Platform_COUNT] = {
|
||||||
windows_platform_layer,
|
windows_platform_layer,
|
||||||
|
@ -387,6 +387,7 @@ build(Arena *arena, u32 flags, u32 arch, char *code_path, char **code_files, cha
|
||||||
fm_finish_build_line(&line);
|
fm_finish_build_line(&line);
|
||||||
|
|
||||||
Temp_Dir temp = fm_pushdir(out_path);
|
Temp_Dir temp = fm_pushdir(out_path);
|
||||||
|
printf("Build: g++ %s -o %s\n", line.build_options, out_file);
|
||||||
systemf("g++ %s -o %s", line.build_options, out_file);
|
systemf("g++ %s -o %s", line.build_options, out_file);
|
||||||
fm_popdir(temp);
|
fm_popdir(temp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If any command errors, stop the script
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Set up directories (mirrors build.bat)
|
||||||
|
# NOTE(yuval): Replaced readlink with realpath which works for both macOS and Linux
|
||||||
|
ME="$(realpath "$0")"
|
||||||
|
LOCATION="$(dirname "$ME")"
|
||||||
|
SRC_ROOT="$(dirname "$LOCATION")"
|
||||||
|
PROJECT_ROOT="$(dirname "$SRC_ROOT")"
|
||||||
|
if [ ! -d "$PROJECT_ROOT/build" ]; then
|
||||||
|
mkdir "$PROJECT_ROOT/build"
|
||||||
|
fi
|
||||||
|
BUILD_ROOT="$PROJECT_ROOT/build"
|
||||||
|
BIN_ROOT="$SRC_ROOT/bin"
|
||||||
|
CUSTOM_ROOT="$SRC_ROOT/custom"
|
||||||
|
CUSTOM_BIN="$CUSTOM_ROOT/bin"
|
||||||
|
|
||||||
|
# Get the build mode
|
||||||
|
BUILD_MODE="$1"
|
||||||
|
if [ -z "$BUILD_MODE" ]; then
|
||||||
|
BUILD_MODE="-DDEV_BUILD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the OS specific flags
|
||||||
|
chmod +rx "$BIN_ROOT/detect_os.sh"
|
||||||
|
os=$("$BIN_ROOT/detect_os.sh")
|
||||||
|
|
||||||
|
if [[ "$os" == "linux" ]]; then
|
||||||
|
WARNINGS="-Wno-write-strings -Wno-comment"
|
||||||
|
elif [[ "$os" == "mac" ]]; then
|
||||||
|
WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-switch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
||||||
|
INCLUDES="-I$SRC_ROOT -I$CUSTOM_ROOT"
|
||||||
|
|
||||||
|
# Execute
|
||||||
|
clang++ $WARNINGS $FLAGS $INCLUDES "$BIN_ROOT/4ed_build.cpp" -g -o "$BUILD_ROOT/build"
|
||||||
|
pushd "$SRC_ROOT"
|
||||||
|
"$BUILD_ROOT/build"
|
||||||
|
popd
|
|
@ -4,8 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Set up directories (mirrors build.bat)
|
# Set up directories (mirrors build.bat)
|
||||||
# NOTE(yuval): Replaced readlink with realpath which works for both macOS and Linux
|
ME="$(readlink -f "$0")"
|
||||||
ME="$(realpath "$0")"
|
|
||||||
LOCATION="$(dirname "$ME")"
|
LOCATION="$(dirname "$ME")"
|
||||||
SRC_ROOT="$(dirname "$LOCATION")"
|
SRC_ROOT="$(dirname "$LOCATION")"
|
||||||
PROJECT_ROOT="$(dirname "$SRC_ROOT")"
|
PROJECT_ROOT="$(dirname "$SRC_ROOT")"
|
||||||
|
@ -30,7 +29,7 @@ os=$("$BIN_ROOT/detect_os.sh")
|
||||||
if [[ "$os" == "linux" ]]; then
|
if [[ "$os" == "linux" ]]; then
|
||||||
WARNINGS="-Wno-write-strings -Wno-comment"
|
WARNINGS="-Wno-write-strings -Wno-comment"
|
||||||
elif [[ "$os" == "mac" ]]; then
|
elif [[ "$os" == "mac" ]]; then
|
||||||
WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-switch"
|
WARNINGS="-Wno-write-strings -Wno-comment -Wno-logical-op-parentheses -Wno-null-dereference -Wno-switch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
./build.sh -DDEV_BUILD_X86
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If any command errors, stop the script
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Store the real CWD
|
||||||
|
ME="$(realpath "$0")"
|
||||||
|
LOCATION="$(dirname "$ME")"
|
||||||
|
CODE_HOME="$(dirname "$LOCATION")"
|
||||||
|
|
||||||
|
# Find the most reasonable candidate build file
|
||||||
|
SOURCE="$1"
|
||||||
|
if [ -z "$SOURCE" ]; then
|
||||||
|
SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings
|
||||||
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -g"
|
||||||
|
arch=-m64
|
||||||
|
|
||||||
|
preproc_file=4coder_command_metadata.i
|
||||||
|
meta_macros="-DMETA_PASS"
|
||||||
|
g++ -I"$CODE_HOME" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file
|
||||||
|
g++ -I"$CODE_HOME" $opts $debug -std=gnu++0x "$CODE_HOME/4coder_metadata_generator.cpp" -o "$CODE_HOME/metadata_generator"
|
||||||
|
"$CODE_HOME/metadata_generator" -R "$CODE_HOME" "$PWD/$preproc_file"
|
||||||
|
|
||||||
|
g++ -I"$CODE_HOME" $arch $opts $debug -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
||||||
|
|
||||||
|
rm "$CODE_HOME/metadata_generator"
|
||||||
|
rm $preproc_file
|
|
@ -4,7 +4,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Store the real CWD
|
# Store the real CWD
|
||||||
ME="$(realpath "$0")"
|
ME="$(readlink -f "$0")"
|
||||||
LOCATION="$(dirname "$ME")"
|
LOCATION="$(dirname "$ME")"
|
||||||
CODE_HOME="$(dirname "$LOCATION")"
|
CODE_HOME="$(dirname "$LOCATION")"
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ if [ -z "$SOURCE" ]; then
|
||||||
SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")"
|
SOURCE="$(readlink -f "$CODE_HOME/4coder_default_bindings.cpp")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g"
|
||||||
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -g"
|
|
||||||
arch=-m64
|
arch=-m64
|
||||||
|
|
||||||
preproc_file=4coder_command_metadata.i
|
preproc_file=4coder_command_metadata.i
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Store the real CWD
|
||||||
|
REAL_PWD="$PWD"
|
||||||
|
|
||||||
|
# Find the code home folder
|
||||||
|
TARGET_FILE="$0"
|
||||||
|
cd `dirname $TARGET_FILE`
|
||||||
|
TARGET_FILE=`basename $TARGET_FILE`
|
||||||
|
while [ -L "$TARGET_FILE" ]
|
||||||
|
do
|
||||||
|
TARGET_FILE=`readlink $TARGET_FILE`
|
||||||
|
cd `dirname $TARGET_FILE`
|
||||||
|
TARGET_FILE=`basename $TARGET_FILE`
|
||||||
|
done
|
||||||
|
PHYS_DIR=`pwd -P`
|
||||||
|
SCRIPT_FILE=$PHYS_DIR/$TARGET_FILE
|
||||||
|
code_home=$(dirname "$SCRIPT_FILE")
|
||||||
|
|
||||||
|
# Find the most reasonable candidate build file
|
||||||
|
SOURCE="$1"
|
||||||
|
if [ -z "$SOURCE" ]; then
|
||||||
|
SOURCE="$code_home/4coder_default_bindings.cpp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET_FILE="$SOURCE"
|
||||||
|
cd `dirname $TARGET_FILE`
|
||||||
|
TARGET_FILE=`basename $TARGET_FILE`
|
||||||
|
while [ -L "$TARGET_FILE" ]
|
||||||
|
do
|
||||||
|
TARGET_FILE=`readlink $TARGET_FILE`
|
||||||
|
cd `dirname $TARGET_FILE`
|
||||||
|
TARGET_FILE=`basename $TARGET_FILE`
|
||||||
|
done
|
||||||
|
PHYS_DIR=`pwd -P`
|
||||||
|
SOURCE=$PHYS_DIR/$TARGET_FILE
|
||||||
|
|
||||||
|
# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings
|
||||||
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -g"
|
||||||
|
arch=-m32
|
||||||
|
|
||||||
|
cd "$REAL_PWD"
|
||||||
|
preproc_file=4coder_command_metadata.i
|
||||||
|
meta_macros="-DMETA_PASS"
|
||||||
|
g++ -I"$code_home" $meta_macros $arch $opts $debug -std=gnu++0x "$SOURCE" -E -o $preproc_file
|
||||||
|
g++ -I"$code_home" $opts $debug -std=gnu++0x "$code_home/4coder_metadata_generator.cpp" -o metadata_generator
|
||||||
|
./metadata_generator -R "$code_home" "$PWD/$preproc_file"
|
||||||
|
|
||||||
|
g++ -I"$code_home" $arch $opts $debug -std=gnu++0x "$SOURCE" -shared -o custom_4coder.so -fPIC
|
||||||
|
|
||||||
|
rm metadata_generator
|
||||||
|
rm $preproc_file
|
||||||
|
|
|
@ -35,8 +35,7 @@ done
|
||||||
PHYS_DIR=`pwd -P`
|
PHYS_DIR=`pwd -P`
|
||||||
SOURCE=$PHYS_DIR/$TARGET_FILE
|
SOURCE=$PHYS_DIR/$TARGET_FILE
|
||||||
|
|
||||||
# NOTE(yuval): Removed -Wno-writable-strings as it is the same as -Wno-write-strings
|
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g"
|
||||||
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -g"
|
|
||||||
arch=-m32
|
arch=-m32
|
||||||
|
|
||||||
cd "$REAL_PWD"
|
cd "$REAL_PWD"
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
|
// #include <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int arg_count, char **args){
|
main(int arg_count, char **args){
|
||||||
|
@autoreleasepool{
|
||||||
|
// NOTE(yuval): NSApplication & Delegate Creation
|
||||||
|
NSApplication* app = [NSApplication sharedApplication];
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
|
|
||||||
|
App_Delegate* app_delegate = [[App_Delegate alloc] init];
|
||||||
|
[app setDelegate:app_delegate];
|
||||||
|
|
||||||
|
[NSApp finishLaunching];
|
||||||
|
|
||||||
|
#if 0
|
||||||
Thread_Context _tctx = {};
|
Thread_Context _tctx = {};
|
||||||
thread_ctx_init(&_tctx, ThreadKind_Main,
|
thread_ctx_init(&_tctx, ThreadKind_Main,
|
||||||
get_base_allocator_system(),
|
get_base_allocator_system(),
|
||||||
|
@ -13,4 +26,6 @@ main(int arg_count, char **args){
|
||||||
if (app.step != 0){
|
if (app.step != 0){
|
||||||
result = app.step(mac_vars.tctx, &target, base_ptr, &input);
|
result = app.step(mac_vars.tctx, &target, base_ptr, &input);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
|
#if 0
|
||||||
#define IS_OBJC_LAYER
|
#define IS_OBJC_LAYER
|
||||||
|
|
||||||
#include "4coder_base_types.h"
|
#include "4coder_base_types.h"
|
||||||
|
@ -23,6 +24,8 @@
|
||||||
#define external
|
#define external
|
||||||
|
|
||||||
#include "osx_objective_c_to_cpp_links.h"
|
#include "osx_objective_c_to_cpp_links.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
@ -30,7 +33,7 @@
|
||||||
#import <IOKit/hid/IOHIDLib.h>
|
#import <IOKit/hid/IOHIDLib.h>
|
||||||
#import <OpenGL/OpenGL.h>
|
#import <OpenGL/OpenGL.h>
|
||||||
#import <OpenGL/gl.h>
|
#import <OpenGL/gl.h>
|
||||||
|
#if 0
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/event.h>
|
#include <sys/event.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -840,9 +843,10 @@ OSX_Keyboard_Modifiers
|
||||||
osx_get_modifiers(void){
|
osx_get_modifiers(void){
|
||||||
return(osx_mods_nsevent_to_struct([NSEvent modifierFlags]));
|
return(osx_mods_nsevent_to_struct([NSEvent modifierFlags]));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
int
|
int
|
||||||
main(int argc, char **argv){
|
main(int argc, char **argv){
|
||||||
|
#if 0
|
||||||
memset(&osx_objc, 0, sizeof(osx_objc));
|
memset(&osx_objc, 0, sizeof(osx_objc));
|
||||||
|
|
||||||
u32 clipboard_size = KB(16);
|
u32 clipboard_size = KB(16);
|
||||||
|
@ -887,7 +891,7 @@ main(int argc, char **argv){
|
||||||
|
|
||||||
[NSApp run];
|
[NSApp run];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue