Merge pull request #139 from sm64pc/master
Add MXE/OSX stuff to nightly
This commit is contained in:
commit
bdc06d1709
50
Makefile
50
Makefile
@ -23,8 +23,9 @@ TARGET_N64 = 0
|
|||||||
|
|
||||||
# Build and optimize for Raspberry Pi(s)
|
# Build and optimize for Raspberry Pi(s)
|
||||||
TARGET_RPI ?= 0
|
TARGET_RPI ?= 0
|
||||||
# Compiler to use (ido or gcc)
|
|
||||||
# COMPILER ?= ido // Old Default
|
# Makeflag to enable OSX fixes
|
||||||
|
OSX_BUILD ?= 0
|
||||||
|
|
||||||
# Disable better camera by default
|
# Disable better camera by default
|
||||||
BETTERCAMERA ?= 0
|
BETTERCAMERA ?= 0
|
||||||
@ -39,6 +40,15 @@ EXT_OPTIONS_MENU ?= 1
|
|||||||
TARGET_WEB ?= 0
|
TARGET_WEB ?= 0
|
||||||
# Specify the target you are building for, 0 means native
|
# Specify the target you are building for, 0 means native
|
||||||
TARGET_ARCH ?= native
|
TARGET_ARCH ?= native
|
||||||
|
|
||||||
|
ifeq ($(CROSS),i686-w64-mingw32.static-)
|
||||||
|
TARGET_ARCH = i386pe
|
||||||
|
else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||||
|
TARGET_ARCH = i386pe
|
||||||
|
else
|
||||||
|
TARGET_ARCH = native
|
||||||
|
endif
|
||||||
|
|
||||||
TARGET_BITS ?= 0
|
TARGET_BITS ?= 0
|
||||||
|
|
||||||
ifneq ($(TARGET_BITS),0)
|
ifneq ($(TARGET_BITS),0)
|
||||||
@ -142,6 +152,10 @@ ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints
|
|||||||
VERSION_CFLAGS += -DUSE_GLES
|
VERSION_CFLAGS += -DUSE_GLES
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OSX_BUILD),1) # Modify GFX & SDL2 for OSX GL
|
||||||
|
VERSION_CFLAGS += -DOSX_BUILD
|
||||||
|
endif
|
||||||
|
|
||||||
VERSION_ASFLAGS := --defsym AVOID_UB=1
|
VERSION_ASFLAGS := --defsym AVOID_UB=1
|
||||||
COMPARE := 0
|
COMPARE := 0
|
||||||
|
|
||||||
@ -168,7 +182,7 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Make tools if out of date
|
# Make tools if out of date
|
||||||
DUMMY != make -s -C tools >&2 || echo FAIL
|
DUMMY != make -C tools >&2 || echo FAIL
|
||||||
ifeq ($(DUMMY),FAIL)
|
ifeq ($(DUMMY),FAIL)
|
||||||
$(error Failed to build tools)
|
$(error Failed to build tools)
|
||||||
endif
|
endif
|
||||||
@ -411,6 +425,10 @@ ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth
|
|||||||
|
|
||||||
AS := as
|
AS := as
|
||||||
|
|
||||||
|
ifeq ($(OSX_BUILD),1)
|
||||||
|
AS := i686-w64-mingw32-as
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(TARGET_WEB),1) # As in, not-web PC port
|
ifneq ($(TARGET_WEB),1) # As in, not-web PC port
|
||||||
CC := $(CROSS)gcc
|
CC := $(CROSS)gcc
|
||||||
CXX := $(CROSS)g++
|
CXX := $(CROSS)g++
|
||||||
@ -419,7 +437,13 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(WINDOWS_BUILD),1)
|
ifeq ($(WINDOWS_BUILD),1)
|
||||||
|
ifeq ($(CROSS),i686-w64-mingw32.static-) # fixes compilation in MXE on Linux and WSL
|
||||||
|
LD := $(CC)
|
||||||
|
else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||||
|
LD := $(CC)
|
||||||
|
else
|
||||||
LD := $(CXX)
|
LD := $(CXX)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
LD := $(CC)
|
LD := $(CC)
|
||||||
endif
|
endif
|
||||||
@ -427,11 +451,19 @@ endif
|
|||||||
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
|
ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL
|
||||||
CPP := cpp -P
|
CPP := cpp -P
|
||||||
OBJCOPY := objcopy
|
OBJCOPY := objcopy
|
||||||
|
OBJDUMP := $(CROSS)objdump
|
||||||
else
|
else
|
||||||
|
ifeq ($(OSX_BUILD),1)
|
||||||
|
CPP := cpp-9 -P
|
||||||
|
OBJDUMP := i686-w64-mingw32-objdump
|
||||||
|
OBJCOPY := i686-w64-mingw32-objcopy
|
||||||
|
else # Linux & other builds
|
||||||
CPP := $(CROSS)cpp -P
|
CPP := $(CROSS)cpp -P
|
||||||
OBJCOPY := $(CROSS)objcopy
|
OBJCOPY := $(CROSS)objcopy
|
||||||
|
OBJDUMP := $(CROSS)objdump
|
||||||
endif
|
endif
|
||||||
OBJDUMP := $(CROSS)objdump
|
endif
|
||||||
|
|
||||||
PYTHON := python3
|
PYTHON := python3
|
||||||
SDLCONFIG := $(CROSS)sdl2-config
|
SDLCONFIG := $(CROSS)sdl2-config
|
||||||
|
|
||||||
@ -483,9 +515,9 @@ LDFLAGS := -lm -lGL -lSDL2 -no-pie -s TOTAL_MEMORY=20MB -g4 --source-map-base ht
|
|||||||
else ifeq ($(WINDOWS_BUILD),1)
|
else ifeq ($(WINDOWS_BUILD),1)
|
||||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(SDLCONFIG) --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -static
|
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread -lglew32 `$(SDLCONFIG) --static-libs` -lm -lglu32 -lsetupapi -ldinput8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion -luuid -lopengl32 -static
|
||||||
ifneq ($(CROSS),i686-w64-mingw32.static-)
|
ifneq ($(CROSS),i686-w64-mingw32.static-)
|
||||||
ifneq ($(CROSS),x86_64-w64-mingw32.static-)
|
|
||||||
LDFLAGS += -no-pie
|
LDFLAGS += -no-pie
|
||||||
endif
|
else ifneq ($(CROSS),x86_64-w64-mingw32.static-)
|
||||||
|
LDFLAGS += -no-pie
|
||||||
endif
|
endif
|
||||||
ifeq ($(WINDOWS_CONSOLE),1)
|
ifeq ($(WINDOWS_CONSOLE),1)
|
||||||
LDFLAGS += -mconsole
|
LDFLAGS += -mconsole
|
||||||
@ -494,9 +526,12 @@ else ifeq ($(TARGET_RPI),1)
|
|||||||
# Linux / Other builds below
|
# Linux / Other builds below
|
||||||
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(SDLCONFIG) --libs` -no-pie
|
LDFLAGS := $(OPT_FLAGS) -lm -lGLESv2 `$(SDLCONFIG) --libs` -no-pie
|
||||||
else
|
else
|
||||||
|
ifeq ($(OSX_BUILD),1)
|
||||||
|
LDFLAGS := -lm -framework OpenGL `$(SDLCONFIG) --libs` -no-pie -lpthread `pkg-config --libs libusb-1.0 glfw3 glew`
|
||||||
|
else
|
||||||
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(SDLCONFIG) --libs` -no-pie -lpthread
|
LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm -lGL `$(SDLCONFIG) --libs` -no-pie -lpthread
|
||||||
endif
|
endif
|
||||||
|
endif # End of LDFLAGS
|
||||||
|
|
||||||
# Prevent a crash with -sopt
|
# Prevent a crash with -sopt
|
||||||
export LANG := C
|
export LANG := C
|
||||||
@ -749,7 +784,6 @@ $(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp
|
|||||||
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1
|
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Rebuild files with 'GLOBAL_ASM' if the NON_MATCHING flag changes.
|
# Rebuild files with 'GLOBAL_ASM' if the NON_MATCHING flag changes.
|
||||||
$(GLOBAL_ASM_O_FILES): $(GLOBAL_ASM_DEP).$(NON_MATCHING)
|
$(GLOBAL_ASM_O_FILES): $(GLOBAL_ASM_DEP).$(NON_MATCHING)
|
||||||
$(GLOBAL_ASM_DEP).$(NON_MATCHING):
|
$(GLOBAL_ASM_DEP).$(NON_MATCHING):
|
||||||
|
@ -3,8 +3,28 @@
|
|||||||
|
|
||||||
#include "ultratypes.h"
|
#include "ultratypes.h"
|
||||||
|
|
||||||
// Old deprecated functions from strings.h, replaced by memcpy/memset.
|
// old bstring functions that aren't present on some platforms
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
// macOS libc has them
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
|
||||||
|
|
||||||
|
// there's no way that shit's defined, use memcpy/memset
|
||||||
|
#include <string.h>
|
||||||
|
#undef bzero
|
||||||
|
#undef bcopy
|
||||||
|
#define bzero(buf, len) memset((buf), 0, (len))
|
||||||
|
#define bcopy(src, dst, len) memcpy((dst), (src), (len))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// hope for the best
|
||||||
extern void bcopy(const void *, void *, size_t);
|
extern void bcopy(const void *, void *, size_t);
|
||||||
extern void bzero(void *, size_t);
|
extern void bzero(void *, size_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !_OS_LIBC_H_ */
|
#endif /* !_OS_LIBC_H_ */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "libultra_internal.h"
|
#include "libultra_internal.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef OSX_BUILD
|
||||||
lldiv_t lldiv(long long num, long long denom) {
|
lldiv_t lldiv(long long num, long long denom) {
|
||||||
lldiv_t ret;
|
lldiv_t ret;
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ lldiv_t lldiv(long long num, long long denom) {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // OSX_BUILD cannot use this
|
||||||
|
|
||||||
ldiv_t ldiv(long num, long denom) {
|
ldiv_t ldiv(long num, long denom) {
|
||||||
ldiv_t ret;
|
ldiv_t ret;
|
||||||
|
@ -33,6 +33,7 @@ static const du pilo = {
|
|||||||
static const fu zero = {0.0};
|
static const fu zero = {0.0};
|
||||||
extern const fu NAN;
|
extern const fu NAN;
|
||||||
|
|
||||||
|
#ifndef OSX_BUILD
|
||||||
float cosf(float x)
|
float cosf(float x)
|
||||||
{
|
{
|
||||||
double dx; // double x
|
double dx; // double x
|
||||||
@ -92,3 +93,5 @@ float cosf(float x)
|
|||||||
|
|
||||||
return zero.f;
|
return zero.f;
|
||||||
}
|
}
|
||||||
|
#endif // OSX_BUILD cannot use this
|
||||||
|
|
||||||
|
@ -18,12 +18,19 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
#define GL_GLEXT_PROTOTYPES 1
|
||||||
#include <SDL2/SDL_opengl.h>
|
#include <SDL2/SDL_opengl.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
#define GL_GLEXT_PROTOTYPES 1
|
||||||
|
|
||||||
|
#ifdef OSX_BUILD
|
||||||
|
#include <SDL2/SDL_opengl.h>
|
||||||
|
#else
|
||||||
#include <SDL2/SDL_opengles2.h>
|
#include <SDL2/SDL_opengles2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gfx_cc.h"
|
#include "gfx_cc.h"
|
||||||
#include "gfx_rendering_api.h"
|
#include "gfx_rendering_api.h"
|
||||||
|
|
||||||
@ -187,7 +194,11 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad
|
|||||||
size_t num_floats = 4;
|
size_t num_floats = 4;
|
||||||
|
|
||||||
// Vertex shader
|
// Vertex shader
|
||||||
|
#ifdef OSX_BUILD
|
||||||
|
append_line(vs_buf, &vs_len, "");
|
||||||
|
#else
|
||||||
append_line(vs_buf, &vs_len, "#version 100");
|
append_line(vs_buf, &vs_len, "#version 100");
|
||||||
|
#endif
|
||||||
append_line(vs_buf, &vs_len, "attribute vec4 aVtxPos;");
|
append_line(vs_buf, &vs_len, "attribute vec4 aVtxPos;");
|
||||||
if (used_textures[0] || used_textures[1]) {
|
if (used_textures[0] || used_textures[1]) {
|
||||||
append_line(vs_buf, &vs_len, "attribute vec2 aTexCoord;");
|
append_line(vs_buf, &vs_len, "attribute vec2 aTexCoord;");
|
||||||
@ -218,8 +229,13 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad
|
|||||||
append_line(vs_buf, &vs_len, "}");
|
append_line(vs_buf, &vs_len, "}");
|
||||||
|
|
||||||
// Fragment shader
|
// Fragment shader
|
||||||
|
#ifdef OSX_BUILD
|
||||||
|
append_line(fs_buf, &fs_len, "");
|
||||||
|
#else
|
||||||
append_line(fs_buf, &fs_len, "#version 100");
|
append_line(fs_buf, &fs_len, "#version 100");
|
||||||
append_line(fs_buf, &fs_len, "precision mediump float;");
|
append_line(fs_buf, &fs_len, "precision mediump float;");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (used_textures[0] || used_textures[1]) {
|
if (used_textures[0] || used_textures[1]) {
|
||||||
append_line(fs_buf, &fs_len, "varying vec2 vTexCoord;");
|
append_line(fs_buf, &fs_len, "varying vec2 vTexCoord;");
|
||||||
}
|
}
|
||||||
@ -465,6 +481,10 @@ static void gfx_opengl_init(void) {
|
|||||||
glewInit();
|
glewInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OSX_BUILD
|
||||||
|
glewInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
glGenBuffers(1, &opengl_vbo);
|
glGenBuffers(1, &opengl_vbo);
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo);
|
||||||
|
@ -13,9 +13,15 @@
|
|||||||
#else
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#define GL_GLEXT_PROTOTYPES 1
|
#define GL_GLEXT_PROTOTYPES 1
|
||||||
|
|
||||||
|
#ifdef OSX_BUILD
|
||||||
|
#include <SDL2/SDL_opengl.h>
|
||||||
|
#else
|
||||||
#include <SDL2/SDL_opengles2.h>
|
#include <SDL2/SDL_opengles2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // End of OS-Specific GL defines
|
||||||
|
|
||||||
#include "gfx_window_manager_api.h"
|
#include "gfx_window_manager_api.h"
|
||||||
#include "gfx_screen_config.h"
|
#include "gfx_screen_config.h"
|
||||||
#include "../configfile.h"
|
#include "../configfile.h"
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
|
UNAME := $(shell uname)
|
||||||
|
ifeq ($(UNAME),Darwin)
|
||||||
|
OSX_BUILD := -DOSX_BUILD
|
||||||
|
endif
|
||||||
|
|
||||||
CC := gcc
|
CC := gcc
|
||||||
CFLAGS := -Llib -Iinclude -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O3 -s
|
CFLAGS := -Llib -Iinclude -I . -Wall -Wextra -Wno-unused-parameter $(OSX_BUILD) -pedantic -std=c99 -O3 -s
|
||||||
PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math iplfontutil aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
|
PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math iplfontutil aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
|
||||||
|
|
||||||
n64graphics_SOURCES := n64graphics.c utils.c
|
n64graphics_SOURCES := n64graphics.c utils.c
|
||||||
@ -43,7 +48,7 @@ clean:
|
|||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(1): $($1_SOURCES)
|
$(1): $($1_SOURCES)
|
||||||
$(CC) $(CFLAGS) $$^ -lm -o $$@ $($1_CFLAGS)
|
$(CC) $(CFLAGS) $(OSX_BUILD) $$^ -lm -o $$@ $($1_CFLAGS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
|
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
|
||||||
|
@ -23,7 +23,11 @@ SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "exoquant.h"
|
#include "exoquant.h"
|
||||||
|
|
||||||
|
#ifndef OSX_BUILD // OSX build cannot have malloc defined
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user