Add RMODERN build option, main function

This commit is contained in:
giraffeics 2020-08-10 03:03:58 -04:00
parent c9fe88e193
commit e2aeb125dc
4 changed files with 56 additions and 0 deletions

View File

@ -65,6 +65,9 @@ AUDIO_API ?= SDL2
# Controller backends (can have multiple, space separated): SDL2
CONTROLLER_API ?= SDL2
# Modern rendering system (will eventually replace other backends)
RMODERN ?= 0
# Misc settings for EXTERNAL_DATA
BASEDIR ?= res
@ -255,6 +258,14 @@ else
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)_debug
endif
ifeq ($(RMODERN),1)
BUILD_DIR := $(BUILD_DIR)_rmodern
endif
LIBULTRA := $(BUILD_DIR)/libultra.a
ifeq ($(TARGET_WEB),1)
@ -286,6 +297,10 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes
ASM_DIRS :=
ifeq ($(RMODERN),1)
SRC_DIRS += src/pc/rmodern
endif
ifeq ($(DISCORDRPC),1)
SRC_DIRS += src/pc/discord
endif
@ -478,6 +493,12 @@ SDLCONFIG := $(CROSS)sdl2-config
# configure backend flags
BACKEND_CFLAGS := -DRAPI_$(RENDER_API)=1 -DWAPI_$(WINDOW_API)=1 -DAAPI_$(AUDIO_API)=1
# rmodern
ifeq ($(RMODERN),1)
BACKEND_CFLAGS += -DRMODERN
endif
# can have multiple controller APIs
BACKEND_CFLAGS += $(foreach capi,$(CONTROLLER_API),-DCAPI_$(capi)=1)
BACKEND_LDFLAGS :=

View File

@ -171,6 +171,14 @@ static void on_anim_frame(double time) {
}
#endif
#ifdef RMODERN
#include "rmodern/rmodern.h"
void main_func(void)
{
rmodern_init();
}
#else
void main_func(void) {
static u64 pool[0x165000/8 / 4 * sizeof(void *)];
main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
@ -261,6 +269,7 @@ void main_func(void) {
}
#endif
}
#endif
int main(int argc, char *argv[]) {
parse_cli_opts(argc, argv);

18
src/pc/rmodern/rmodern.h Normal file
View File

@ -0,0 +1,18 @@
/**
* This header file provides the interface between modern rendering functionality,
* written in C++, and the rest of the codebase.
*/
#ifndef RMODERN_H
#define RMODERN_H
#ifdef __cplusplus
extern "C"
{
#endif
void rmodern_init();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,8 @@
#include "rmodern.h"
#include <iostream>
void rmodern_init()
{
std::cout << "Hello, world!! ^-^" << std::endl;
}