add more makefile changes

This commit is contained in:
Jeffrey Crowell 2022-05-15 15:24:32 -04:00
commit f3496a0e11
10 changed files with 41 additions and 25 deletions

View file

@ -1,6 +1,6 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX := g++
CXX := g++-mp-devel
AR := ar
FORMAT := clang-format-11
@ -30,7 +30,7 @@ ifneq ($(LTO),0)
CXXFLAGS += -flto
endif
SRC_DIRS := $(shell find -type d -not -path "*build*")
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CXX_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
@ -67,4 +67,4 @@ build/%.o: %.cpp
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
-include $(D_FILES)
-include $(D_FILES)

View file

@ -15,6 +15,8 @@ else
CXX := g++
endif
CXX := g++-mp-devel
INC := -I ZAPD -I lib/elfio -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils
CXXFLAGS := -fpic -std=c++17 -Wall -Wextra -fno-omit-frame-pointer
OPTFLAGS :=
@ -45,7 +47,7 @@ endif
# CXXFLAGS += -DTEXTURE_DEBUG
LDFLAGS := -lm -ldl -lpng \
-L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11
-L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 $(shell pkg-config --libs glew) -lX11
# Use LLD if available. Set LLD=0 to not use it
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
@ -64,12 +66,8 @@ ifneq ($(UNAME), Darwin)
else
EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a
ifeq ($(UNAMEM),arm64)
ifeq ($(shell brew list libpng > /dev/null 2>&1; echo $$?),0)
LDFLAGS += -L $(shell brew --prefix)/lib
INC += -I $(shell brew --prefix)/include
else
$(error Please install libpng via Homebrew)
endif
LDFLAGS += $(shell pkg-config --libs libpng)
INC += $(shell pkg-config --cflags libpng)
endif
endif

View file

@ -5,8 +5,10 @@
#include "yaz0/yaz0.h"
#ifndef _MSC_VER
#ifndef __APPLE__
#include <byteswap.h>
#endif
#endif
#include <Globals.h>
namespace fs = std::filesystem;
@ -17,6 +19,10 @@ namespace fs = std::filesystem;
#define __bswap_32 _byteswap_ulong
#define bswap_32 _byteswap_ulong
#endif
#if defined __APPLE__
#define __bswap32 __builtin_bswap32
#define bswap32 __builtin_bswap32
#endif
// ROM DMA Table Start
#define OOT_OFF_NTSC_10_RC 0x7430

View file

@ -1,7 +1,8 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX := g++-mp-devel
CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17
SRC_DIRS := $(shell find -type d -not -path "*build*")
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))

View file

@ -1,3 +1,4 @@
CC := gcc-mp-devel
CFLAGS = -Wall -O2 -g
UC_OBJ = uc_f3d.o uc_f3db.o uc_f3dex.o uc_f3dexb.o uc_f3dex2.o
OBJ = gfxd.o $(UC_OBJ)

View file

@ -1,7 +1,7 @@
# Only used for standalone compilation, usually inherits these from the main makefile
CXX := g++
CC := gcc
CXX := g++-mp-devel
CC := gcc-mp-devel
AR := ar
FORMAT := clang-format-11
@ -18,9 +18,9 @@ WARN := -Wall -Wextra -Werror \
-Wno-narrowing \
-Wno-missing-field-initializers
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32
CPPFLAGS := -MMD
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew)
ifneq ($(DEBUG),0)
CXXFLAGS += -g -D_DEBUG
@ -37,7 +37,7 @@ ifneq ($(LTO),0)
CFLAGS += -flto
endif
SRC_DIRS := $(shell find -type d -not -path "*build*")
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CXX_FILES := \
$(shell find libultraship/Factories -name *.cpp) \
@ -93,4 +93,4 @@ build/%.o: %.c
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
-include $(D_FILES)
-include $(D_FILES)

View file

@ -27,6 +27,9 @@
#include "SDL.h"
#define GL_GLEXT_PROTOTYPES 1
#include "SDL_opengl.h"
#elif __APPLE__
#include <SDL.h>
#include <GL/glew.h>
#else
#include <SDL2/SDL.h>
#include <GL/glew.h>
@ -496,7 +499,7 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
}
for (int i = 0; i < cc_features.num_inputs; i++) {
char name[16];
char name[32];
sprintf(name, "aInput%d", i + 1);
prg->attrib_locations[cnt] = glGetAttribLocation(shader_program, name);
prg->attrib_sizes[cnt] = cc_features.opt_alpha ? 4 : 3;

View file

@ -2,6 +2,7 @@
#define GFX_PC_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <unordered_map>
#include <list>

View file

@ -13,6 +13,8 @@
#include "SDL.h"
#define GL_GLEXT_PROTOTYPES 1
#include "SDL_opengl.h"
#elif __APPLE__
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#define GL_GLEXT_PROTOTYPES 1
@ -120,8 +122,10 @@ static void set_fullscreen(bool on, bool call_callback) {
static uint64_t previous_time;
#ifndef __linux__
#ifndef __APPLE__
static HANDLE timer;
#endif
#endif
static int frameDivisor = 1;
@ -136,7 +140,9 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifndef __linux
#ifndef __APPLE__
timer = CreateWaitableTimer(nullptr, false, nullptr);
#endif
#endif
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
@ -271,7 +277,7 @@ static inline void sync_framerate_with_timer(void) {
const int64_t next = qpc_to_100ns(previous_time) + 10 * FRAME_INTERVAL_US_NUMERATOR / FRAME_INTERVAL_US_DENOMINATOR;
const int64_t left = next - qpc_to_100ns(t);
if (left > 0) {
#ifdef __linux__
#if defined __linux__ || defined __APPLE__
const timespec spec = { 0, left * 100 };
nanosleep(&spec, nullptr);
#else

View file

@ -1,5 +1,5 @@
CXX := g++
CC := gcc
CXX := g++-mp-devel
CC := gcc-mp-devel
LD := lld
AR := ar
FORMAT := clang-format-11
@ -16,11 +16,11 @@ LTO ?= 0
WARN := \
-Wno-return-type \
-funsigned-char \
-m32 -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
-mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386
LDFLAGS := -m32
LDFLAGS :=
CPPFLAGS := -MMD
ifneq ($(DEBUG),0)
@ -155,4 +155,4 @@ $(TARGET): $(LIBULTRASHIP)
$(TARGET): $(O_FILES)
$(CXX) $^ -o $@ $(LDFLAGS) -fuse-ld=$(LD) $(LDDIRS) $(LDLIBS)
-include $(D_FILES)
-include $(D_FILES)