Skip to content

Commit

Permalink
WIP: GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Feb 6, 2024
1 parent b69be33 commit 478e5aa
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 14 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Moonlight-Switch

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:

runs-on: ubuntu-latest

container:
image: docker://devkitpro/devkita64:20240120

steps:
- name: Check out repository
uses: actions/checkout@v1
with:
submodules: recursive

- name: Remove useless fonts
run: rm -rf ./resources/font

- name: Remove enet
run: dkp-pacman --noconfirm -R switch-enet

- name: Run cmake
continue-on-error: true
run: cmake -B build/switch -DPLATFORM_SWITCH=ON

- name: Dirty second cmake run
run: cmake -B build/switch -DPLATFORM_SWITCH=ON

- name: Run build
run: make -C build/switch Moonlight.nro -j8

- name: Upload Moonlight-Switch.nro
uses: actions/upload-artifact@master
with:
name: Moonlight-Switch
path: build/switch/Moonlight.nro

- name: Upload Moonlight-Switch.elf
uses: actions/upload-artifact@master
with:
name: Debug.elf
path: build/switch/Moonlight.elf
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ endif ()
# toolchain
include(${EXTERN_PATH}/cmake/toolchain.cmake)

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${EXTERN_PATH}/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EXTERN_PATH}/cmake")
#find_package(PkgConfig REQUIRED)

# project info
project(Moonlight)
set(VERSION_MAJOR "1")
Expand Down Expand Up @@ -59,6 +63,13 @@ if (USE_LIBROMFS)
add_libromfs(${PROJECT_NAME} ${PROJECT_RESOURCES})
endif ()

if (USE_MBEDTLS_CRYPTO)
find_package(MbedTLS REQUIRED)
else ()
find_package(OpenSSL REQUIRED)
endif ()

set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
add_subdirectory(extern)

# setting src and include
Expand Down Expand Up @@ -180,19 +191,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC
${APP_PLATFORM_INCLUDE})
target_compile_options(${PROJECT_NAME} PRIVATE -ffunction-sections -fdata-sections ${APP_PLATFORM_OPTION})

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${EXTERN_PATH}/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EXTERN_PATH}/cmake")
#find_package(PkgConfig REQUIRED)

if (USE_MBEDTLS_CRYPTO)
find_package(mbedTLS REQUIRED)
else ()
find_package(OpenSSL REQUIRED)
endif ()


find_package(CURL REQUIRED)
#find_package(mbedTLS REQUIRED)
#find_package(MbedTLS REQUIRED)
find_package(SDL2 REQUIRED)
find_package(Jansson REQUIRED)
find_package(EXPAT REQUIRED)
Expand Down
4 changes: 3 additions & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

add_subdirectory(borealis/library)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
Expand All @@ -10,6 +9,9 @@ if (USE_MBEDTLS_CRYPTO)
set(USE_MBEDTLS ON)
endif ()

# include_directories(AFTER SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/moonlight-common-c/enet/include)
list(APPEND CMAKE_SYSTEM_IGNORE_PATH ${DEVKITPRO}/portlibs/switch/include/enet)

add_subdirectory(moonlight-common-c)

#include(FindPkgConfig)
Expand Down
2 changes: 2 additions & 0 deletions extern/cmake/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ elseif (PLATFORM_SWITCH)
endif ()
set(DEVKITPRO $ENV{DEVKITPRO} CACHE BOOL "DEVKITPRO")
set(__SWITCH__ ON)
add_definitions(-D__SWITCH__)
add_compile_definitions("HAS_SOCKLEN_T=1")
set(CMAKE_C_FLAGS "-I${DEVKITPRO}/libnx/include -I${DEVKITPRO}/portlibs/switch/include")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
include(${DEVKITPRO}/cmake/Switch.cmake REQUIRED)
Expand Down
46 changes: 46 additions & 0 deletions extern/docker/switch.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM alpine:latest

RUN apk add pacman wget make cmake

ENV DEVKITPRO=/opt/devkitpro

RUN pacman-key --init && \
pacman-key --recv BC26F752D25B92CE272E0F44F7FD5492264BB9D0 --keyserver keyserver.ubuntu.com && \
pacman-key --lsign BC26F752D25B92CE272E0F44F7FD5492264BB9D0

RUN wget https://pkg.devkitpro.org/devkitpro-keyring.pkg.tar.xz && \
pacman --noconfirm -U devkitpro-keyring.pkg.tar.xz && \
rm devkitpro-keyring.pkg.tar.xz

RUN echo $'[dkp-libs] \n\
Server = https://pkg.devkitpro.org/packages \n\
\n\
[dkp-linux] \n\
Server = https://pkg.devkitpro.org/packages/linux/$arch/ \n\
' >> /etc/pacman.conf

RUN pacman --noconfirm -Suy
RUN pacman-key --populate
RUN pacman-key --refresh-keys

RUN pacman --noconfirm -Suy deko3d libnx switch-pkg-config
RUN pacman --noconfirm -Suy devkit-env devkitA64 devkitA64-gdb general-tools switch-tools uam

# RUN pacman --noconfirm -Suy switch-dev

RUN pacman --noconfirm -Suy switch-ffmpeg \
switch-mbedtls \
switch-sdl2 \
switch-curl \
switch-libexpat \
switch-jansson \
switch-glfw \
switch-glm \
switch-libvpx \
switch-glad \
switch-libopus


RUN pacman --noconfirm -Suy switch-dev

# CMD cmake -B build/switch -DPLATFORM_SWITCH=ON ..; make -C build/switch Moonlight.nro -j8
2 changes: 1 addition & 1 deletion extern/moonlight-common-c
Submodule moonlight-common-c updated 0 files

0 comments on commit 478e5aa

Please sign in to comment.