Skip to content

Commit

Permalink
Move EASTL building support out of EASTL submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
runer112 committed Sep 17, 2023
1 parent d77701e commit d758321
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
path = examples/standalone_examples/template
url = https://github.com/CE-Programming/template.git
[submodule "src/EASTL"]
path = src/EASTL
path = src/ea/EASTL
url = https://github.com/electronicarts/EASTL.git
[submodule "src/EABase"]
path = src/EABase
path = src/ea/EABase
url = https://github.com/electronicarts/EABase.git
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
include $(CURDIR)/src/common.mk

LIBS := libload graphx fontlibc keypadc fileioc usbdrvce srldrvce msddrvce fatdrvce
SRCS := ce crt libc libcxx EASTL
SRCS := ce crt ea libc libcxx
TOOLS := fasmg convbin convimg convfont cedev-config

ifeq ($(OS),Windows_NT)
Expand Down
1 change: 0 additions & 1 deletion src/EASTL
Submodule EASTL deleted from de7664
1 change: 1 addition & 0 deletions src/ea/EASTL
Submodule EASTL added at ce460c
57 changes: 57 additions & 0 deletions src/ea/include/__EASTL_user_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#ifndef _EASTL_USER_CONFIG_H
#define _EASTL_USER_CONFIG_H


#define EASTL_THREAD_SUPPORT_AVAILABLE 0


#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED) && !defined(SSIZE_T_DEFINED)
#define _SSIZE_T_
#define _SSIZE_T_DEFINED
#define SSIZE_T_DEFINED

#include <cstddef>

typedef ptrdiff_t ssize_t;
#define SSIZE_MAX INT_MAX
#endif


#include <__config>
#include <cstdint>

_EZCXX_INLINE void* operator new[](size_t size,
const char* name,
int flags,
unsigned debugFlags,
const char* file,
int line)
{
(void)name;
(void)flags;
(void)debugFlags;
(void)file;
(void)line;
return new uint8_t[size];
}

_EZCXX_INLINE void* operator new[](size_t size,
size_t alignment,
size_t alignmentOffset,
const char* name,
int flags,
unsigned debugFlags,
const char* file,
int line)
{
(void)alignment;
(void)alignmentOffset;
(void)name;
(void)flags;
(void)debugFlags;
(void)file;
(void)line;
return new uint8_t[size];
}

#endif // _EASTL_USER_CONFIG_H
70 changes: 70 additions & 0 deletions src/ea/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright (C) 2015-2023 CE Programming
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

include $(CURDIR)/../common.mk

BUILD := $(call NATIVEPATH,EASTL/build)
# TODO: atomic
BUILD_SRC := $(filter-out EASTL/build/atomic.cpp.src,$(patsubst EASTL/source/%,EASTL/build/%.src,$(wildcard EASTL/source/*.c EASTL/source/*.cpp)))

EZCFLAGS := -S -ffreestanding -Wall -Wextra -Oz
EZCFLAGS += -D_EZ80 -isystem ../ce/include -isystem ../libc/include -mllvm -profile-guided-section-prefix=false
EZCFLAGS += -DEASTL_USER_CONFIG_HEADER="<__EASTL_user_config.h>"
EZCXXFLAGS := $(EZCFLAGS) -fno-exceptions -fno-rtti -fno-use-cxa-atexit
EZCXXFLAGS += -isystem ../libcxx/include -isystem EABase/include/Common -isystem EASTL/include -isystem include

CONFIG_H = include/__EASTL_user_config.h

WILDCARD_SRC = $(wildcard *.src) $(BUILD_SRC)
WILDCARD_EASTL_H := $(wildcard EASTL/include/EASTL/*.h)
WILDCARD_EASTL_BONUS_H := $(wildcard EASTL/include/EASTL/bonus/*.h)
WILDCARD_EASTL_INTERNAL_H := $(wildcard EASTL/include/EASTL/internal/*.h)
# WILDCARD_EASTL_INTERNAL_ATOMIC_H := $(wildcard EASTL/include/EASTL/internal/atomic/*.h)
WILDCARD_EABASE_H := $(wildcard EABase/include/Common/EABase/*.h)
WILDCARD_EABASE_CONFIG_H := $(wildcard EABase/include/Common/EABase/config/*.h)

all: $(BUILD_SRC)

EASTL/build/%.c.src: EASTL/source/%.c
$(Q)$(call MKDIR,$(BUILD))
$(Q)$(EZCC) $(EZCFLAGS) $< -o $@

EASTL/build/%.cpp.src: EASTL/source/%.cpp
$(Q)$(call MKDIR,$(BUILD))
$(Q)$(EZCC) $(EZCXXFLAGS) $< -o $@

clean:
$(Q)$(call RMDIR,$(BUILD))

install: all
$(Q)$(call MKDIR,$(INSTALL_H))
$(Q)$(call MKDIR,$(INSTALL_EABASE_H))
$(Q)$(call MKDIR,$(INSTALL_EABASE_CONFIG_H))
$(Q)$(call MKDIR,$(INSTALL_EASTL_H))
$(Q)$(call MKDIR,$(INSTALL_EASTL_BONUS_H))
$(Q)$(call MKDIR,$(INSTALL_EASTL_INTERNAL_H))
# $(Q)$(call MKDIR,$(INSTALL_EASTL_INTERNAL_ATOMIC_H))
$(Q)$(call MKDIR,$(INSTALL_EASTL))
$(Q)$(call COPY,$(call NATIVEPATH,$(WILDCARD_SRC)),$(INSTALL_EASTL))
# $(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EASTL_INTERNAL_ATOMIC_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EASTL_INTERNAL_ATOMIC_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EASTL_INTERNAL_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EASTL_INTERNAL_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EASTL_BONUS_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EASTL_BONUS_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EASTL_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EASTL_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EABASE_CONFIG_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EABASE_CONFIG_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(WILDCARD_EABASE_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_EABASE_H))
$(Q)$(call COPY,$(foreach file,$(call NATIVEPATH,$(CONFIG_H)),$(call QUOTE_ARG,$(file))),$(INSTALL_H))

.PHONY: all clean

0 comments on commit d758321

Please sign in to comment.