Skip to content

Commit 85ea0e8

Browse files
committed
first commit
0 parents  commit 85ea0e8

File tree

7 files changed

+256
-0
lines changed

7 files changed

+256
-0
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI-Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-binary:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: build binary
14+
run: |
15+
docker build . -t builder
16+
docker run --rm -v ${PWD}:/project builder make
17+
- uses: actions/upload-artifact@master
18+
with:
19+
name: binary
20+
path: "*.wms"
21+
deploy-binary:
22+
needs: build-binary
23+
runs-on: ubuntu-18.04
24+
steps:
25+
- name: Get environment variables
26+
id: get_repository_name
27+
run: |
28+
echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV
29+
echo DATETIME=$(echo $(date '+%Y%m%d-%H%M%S')) >> $GITHUB_ENV
30+
- uses: actions/download-artifact@master
31+
with:
32+
name: binary
33+
path: wiiu/modules
34+
- name: zip artifact
35+
run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip wiiu
36+
- name: Create Release
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
43+
release_name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }}
44+
draft: false
45+
prerelease: true
46+
body: |
47+
Not a stable release:
48+
${{ github.event.head_commit.message }}
49+
- name: Upload Release Asset
50+
id: upload-release-asset
51+
uses: actions/upload-release-asset@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
56+
asset_path: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
57+
asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip
58+
asset_content_type: application/unknown

.github/workflows/pr.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI-PR
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build-binary:
7+
runs-on: ubuntu-18.04
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: build binary
11+
run: |
12+
docker build . -t builder
13+
docker run --rm -v ${PWD}:/project builder make
14+
- uses: actions/upload-artifact@master
15+
with:
16+
name: binary
17+
path: "*.wms"

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.cbp
2+
*.elf
3+
*.layout
4+
*.rpx
5+
build/
6+
*.save-failed
7+
.idea/
8+
cmake-build-debug/
9+
CMakeLists.txt
10+
*.wms

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM wiiuenv/devkitppc:20210920
2+
3+
COPY --from=wiiuenv/wiiumodulesystem:20211031 /artifacts $DEVKITPRO
4+
5+
WORKDIR project

Makefile

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#-------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#-------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(DEVKITPRO)),)
6+
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
7+
endif
8+
9+
TOPDIR ?= $(CURDIR)
10+
11+
include $(DEVKITPRO)/wums/share/wums_rules
12+
13+
WUMS_ROOT := $(DEVKITPRO)/wums
14+
WUT_ROOT := $(DEVKITPRO)/wut
15+
#-------------------------------------------------------------------------------
16+
# TARGET is the name of the output
17+
# BUILD is the directory where object files & intermediate files will be placed
18+
# SOURCES is a list of directories containing source code
19+
# DATA is a list of directories containing data files
20+
# INCLUDES is a list of directories containing header files
21+
#-------------------------------------------------------------------------------
22+
TARGET := LoggingModule
23+
BUILD := build
24+
SOURCES := source
25+
DATA := data
26+
INCLUDES := source
27+
28+
#-------------------------------------------------------------------------------
29+
# options for code generation
30+
#-------------------------------------------------------------------------------
31+
CFLAGS := -g -Wall -Wextra -O3 -ffunction-sections\
32+
$(MACHDEP)
33+
34+
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
35+
36+
CXXFLAGS := $(CFLAGS) -std=c++17
37+
38+
ASFLAGS := -g $(ARCH)
39+
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) $(WUMSSPECS)
40+
41+
LIBS := -lwums -lwut
42+
43+
#-------------------------------------------------------------------------------
44+
# list of directories containing libraries, this must be the top level
45+
# containing include and lib
46+
#-------------------------------------------------------------------------------
47+
LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUMS_ROOT)
48+
49+
#-------------------------------------------------------------------------------
50+
# no real need to edit anything past this point unless you need to add additional
51+
# rules for different file extensions
52+
#-------------------------------------------------------------------------------
53+
ifneq ($(BUILD),$(notdir $(CURDIR)))
54+
#-------------------------------------------------------------------------------
55+
56+
export OUTPUT := $(CURDIR)/$(TARGET)
57+
export TOPDIR := $(CURDIR)
58+
59+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
60+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
61+
62+
export DEPSDIR := $(CURDIR)/$(BUILD)
63+
64+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
65+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
66+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
67+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
68+
69+
#-------------------------------------------------------------------------------
70+
# use CXX for linking C++ projects, CC for standard C
71+
#-------------------------------------------------------------------------------
72+
ifeq ($(strip $(CPPFILES)),)
73+
#-------------------------------------------------------------------------------
74+
export LD := $(CC)
75+
#-------------------------------------------------------------------------------
76+
else
77+
#-------------------------------------------------------------------------------
78+
export LD := $(CXX)
79+
#-------------------------------------------------------------------------------
80+
endif
81+
#-------------------------------------------------------------------------------
82+
83+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
84+
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
85+
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
86+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
87+
88+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
89+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
90+
-I$(CURDIR)/$(BUILD)
91+
92+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
93+
94+
.PHONY: $(BUILD) clean all
95+
96+
#-------------------------------------------------------------------------------
97+
all: $(BUILD)
98+
99+
$(BUILD):
100+
@[ -d $@ ] || mkdir -p $@
101+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
102+
103+
#-------------------------------------------------------------------------------
104+
clean:
105+
@echo clean ...
106+
@rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf
107+
108+
#-------------------------------------------------------------------------------
109+
else
110+
.PHONY: all
111+
112+
DEPENDS := $(OFILES:.o=.d)
113+
114+
#-------------------------------------------------------------------------------
115+
# main targets
116+
#-------------------------------------------------------------------------------
117+
all : $(OUTPUT).wms
118+
119+
$(OUTPUT).wms : $(OUTPUT).elf
120+
$(OUTPUT).elf : $(OFILES)
121+
122+
$(OFILES_SRC) : $(HFILES_BIN)
123+
124+
#-------------------------------------------------------------------------------
125+
# you need a rule like this for each extension you use as binary data
126+
#-------------------------------------------------------------------------------
127+
%.bin.o %_bin.h : %.bin
128+
#-------------------------------------------------------------------------------
129+
@echo $(notdir $<)
130+
@$(bin2o)
131+
132+
#---------------------------------------------------------------------------------
133+
%.o: %.s
134+
@echo $(notdir $<)
135+
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
136+
137+
-include $(DEPENDS)
138+
139+
#-------------------------------------------------------------------------------
140+
endif
141+
#-------------------------------------------------------------------------------

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Building using the Dockerfile
2+
3+
It's possible to use a docker image for building. This way you don't need anything installed on your host system.
4+
5+
```
6+
# Build docker image (only needed once)
7+
docker build . -t loggingmodule-builder
8+
9+
# make
10+
docker run -it --rm -v ${PWD}:/project loggingmodule-builder make
11+
12+
# make clean
13+
docker run -it --rm -v ${PWD}:/project loggingmodule-builder make clean
14+
```

source/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <wums.h>
2+
#include <coreinit/debug.h>
3+
4+
WUMS_MODULE_EXPORT_NAME("homebrew_logging");
5+
6+
bool WUMSLogWrite(const char *str, size_t size) {
7+
OSConsoleWrite(str, size);
8+
return true;
9+
}
10+
11+
WUMS_EXPORT_FUNCTION(WUMSLogWrite);

0 commit comments

Comments
 (0)