Skip to content

Commit

Permalink
Merge pull request #156 from p2000t/develop
Browse files Browse the repository at this point in the history
Added Emscriptem build
  • Loading branch information
dionoid committed Apr 27, 2024
2 parents 709d314 + ddbb072 commit ed48b30
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ include:
- project: 'libretro-infrastructure/ci-templates'
file: '/tvos-arm64.yml'

# Emscripten
- project: 'libretro-infrastructure/ci-templates'
file: '/emscripten-static.yml'

# Stages for building
stages:
- build-prepare
Expand Down Expand Up @@ -135,3 +139,9 @@ libretro-build-tvos-arm64:
extends:
- .libretro-tvos-arm64-make-default
- .core-defs

# Emscripten
libretro-build-emscripten:
extends:
- .libretro-emscripten-static-retroarch-master
- .core-defs
26 changes: 8 additions & 18 deletions src/libretro/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
STATIC_LINKING := 0
AR ?= ar
CC ?= gcc
FPIC := -fPIC

ifeq ($(platform),)
platform = unix
Expand All @@ -15,25 +16,9 @@ else ifneq ($(findstring win,$(shell uname -a)),)
endif
endif

# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
arch = intel
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif

TARGET_NAME := m2000
LIBM = -lm

ifeq ($(STATIC_LINKING), 1)
EXT := a
endif

ifneq (,$(findstring unix,$(platform)))
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
Expand Down Expand Up @@ -77,6 +62,11 @@ else ifneq (,$(findstring android,$(platform)))
endif
CC = $(ANDROID_NDK_LLVM)/bin/$(TARGET_TRIPLE)21-clang
AR = $(ANDROID_NDK_LLVM)/bin/llvm-ar
else ifeq ($(platform), emscripten)
EXT ?= bc
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
STATIC_LINKING = 1
FPIC =
else
TARGET := $(TARGET_NAME)_libretro.dll
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
Expand All @@ -92,15 +82,15 @@ endif

VPATH = ../
OBJECTS := P2000.o Z80.o m2000_libretro.o
CFLAGS += -I./libretro-common/include -Wall -std=gnu99 -fPIC
CFLAGS += -I./libretro-common/include -Wall -std=gnu99 $(FPIC)

all: clean $(TARGET)

$(TARGET): $(OBJECTS)
ifeq ($(STATIC_LINKING), 1)
$(AR) rcs $@ $(OBJECTS)
else
$(CC) -fPIC $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
$(CC) $(FPIC) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
endif

%.o: %.c
Expand Down

0 comments on commit ed48b30

Please sign in to comment.