diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..15b06f88 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,23 @@ +name: pr +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + check: + runs-on: ubuntu-latest + container: + image: ghcr.io/open-ead/ubuntu-builder + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + submodules: false + - uses: actions/checkout@v7 + with: + persist-credentials: false + submodules: false + repository: open-ead/nnsdk + path: lib/nnsdk + - run: task pr diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e255a47..235874da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,12 @@ endfunction() function(find_nnsdk) if(NOT TARGET nnSdk) if(DEFINED NNSDK_DIR) - message(STATUS "Found NintendoSDK: ${NNSDK_DIR}") - add_subdirectory(${NNSDK_DIR} ${NNSDK_DIR}/build) + if(IS_DIRECTORY "${NNSDK_DIR}") + message(STATUS "Found NintendoSDK: ${NNSDK_DIR}") + add_subdirectory(${NNSDK_DIR} ${NNSDK_DIR}/build) + else() + message(FATAL_ERROR "NNSDK_DIR is provided, but NintendoSDK is not found at: ${NNSDK_DIR}") + endif() else() message(FATAL_ERROR "NintendoSDK cannot be found. Ensure your project adds open-ead/nnsdk as a dependency (submodule), and your CMakeLists.txt contains `add_subdirectory(path/to/nnsdk)`") endif() diff --git a/README.md b/README.md index 23fdd86d..fd44ec71 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,13 @@ Usage of the materials here outside of matching decompilation is not supported. # Credits - [Shadow](https://github.com/shadowninja108/) - For [Skyline](https://github.com/shadowninja108/Skyline), which was the primary inspiration and use case for this repo. - [Shibbo](https://github.com/shibbo) - For [OdysseyReversed](https://github.com/shibbo/OdysseyReversed/), which most of these headers came from. + +# Development +For running commands please install [task](https://taskfile.dev), CMake, Ninja and Clang/LLVM. +The Clang/LLVM toolchain version should match the [image used in the PR](https://github.com/open-ead/containers/blob/main/ubuntu-builder/Dockerfile) + +Before you begin, run `task clone-deps` to clone dependencies. + +Run `task pr` to run the same checks that the PR runs. Run `task fix` to fix the clang-format issues. + + diff --git a/Taskfile.yml b/Taskfile.yml index 4e65cb5c..27e6ea2f 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -5,14 +5,16 @@ version: '3' vars: # Modules to check with clang-format/clang-tidy; MODULES: atk,font,g3d,ui2d,vfx - _SOURCES1: ',{{.MODULES}}' - SOURCES: '{{._SOURCES1 | replace "," " lib/"}}' + _MODULES1: ',{{.MODULES}}' + _MODULES2: '^{{.MODULES}}$' + SOURCES: '{{._MODULES1 | replace "," " lib/"}}' CLANG_TIDY_LIBS: '{{.MODULES | replace " " "" | replace "," "|" }}' tasks: clone-deps: desc: Clone dependencies for development cmds: + - rm -rf lib/nnsdk - git clone https://github.com/open-ead/nnsdk lib/nnsdk pr: @@ -36,9 +38,11 @@ tasks: -DNNSDK_DIR=$(pwd)/lib/nnsdk build: desc: Check the project builds + vars: + VERIFY_TARGETS: '{{._MODULES2 | replace " " "" | replace "," "$ ^" | replace "^" "--target nn_" | replace "$" "_verify_interface_header_sets"}}' cmds: - cmake --build build - - cmake --build build --target all_verify_header_sets + - cmake --build build {{.VERIFY_TARGETS}} check: desc: Run clang-format and clang-tidy checks