Skip to content

Commit

Permalink
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 de74338
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 17 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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: Rename artifact
run: mv build/switch/Moonlight.nro build/switch/Moonlight-Switch.nro

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

- name: Upload Moonlight-Switch.elf
uses: actions/upload-artifact@master
with:
name: Debug.elf
path: build/switch/Moonlight.elf
36 changes: 20 additions & 16 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 All @@ -213,12 +213,18 @@ message("avutil: ${AVUTIL_LIBRARY}")
find_library(SWRESAMPLE_LIBRARY swresample)
message("swresample: ${SWRESAMPLE_LIBRARY}")

# Recompiled CURL with Mbedtls support for Switch
if(PLATFORM_SWITCH)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/libcurl.a)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl)
endif ()

target_link_libraries(${PROJECT_NAME} PRIVATE
borealis
moonlight-common-c
Jansson::Jansson
EXPAT::EXPAT
CURL::libcurl
${AVCODEC_LIBRARY}
${AVUTIL_LIBRARY}
${AVFORMAT_LIBRARY}
Expand All @@ -242,8 +248,6 @@ endif ()
if (APPLE)
set(XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC OFF)
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework CoreMedia" "-framework VideoToolbox")
endif ()

if (PLATFORM_PSV)
elseif (PLATFORM_PSV)
target_link_libraries(${PROJECT_NAME} PRIVATE mp3lame libGLESv2_stub)
endif ()
1 change: 0 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 Down
1 change: 1 addition & 0 deletions extern/cmake/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ elseif (PLATFORM_SWITCH)
endif ()
set(DEVKITPRO $ENV{DEVKITPRO} CACHE BOOL "DEVKITPRO")
set(__SWITCH__ ON)
add_compile_definitions("HAS_SOCKLEN_T=1") # Requires by GitHub Workflow for Enet
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

0 comments on commit de74338

Please sign in to comment.