Skip to content

Commit

Permalink
Add install
Browse files Browse the repository at this point in the history
  • Loading branch information
kynex7510 committed Nov 3, 2024
1 parent 4bf9e56 commit 321f0ae
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ on:
pull_request:
branches: [ main ]

env:
BUILD_TYPE: Release

jobs:
Build-Release:
Build-PreRelease:
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -25,24 +22,27 @@ jobs:
persist-credentials: false

- name: Configure CMake
run: cmake -B ${{github.workspace}}/Build -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/Build -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build ${{github.workspace}}/Build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/Build --config Release

- name: Install
run: cmake --install ${{github.workspace}}/Build --prefix ${{github.workspace}}/Build/Release

- name: Make ZIP
run: |
mv ${{github.workspace}}/Build/_deps/ctrl-build/libCTRL.a ${{github.workspace}}/Build/libCTRL.a
cp Include/dlfcn.h ${{github.workspace}}/Build/dlfcn.h
zip -j CTRDL-${{github.sha}}.zip ${{github.workspace}}/Build/lib*.a ${{github.workspace}}/Build/dlfcn.h ${{github.workspace}}/Build/Tests/dl-test-*.3dsx
(cd ${{github.workspace}}/Build/Release && zip -r CTRDL-${{github.sha}}.zip .)
mv ${{github.workspace}}/Build/Release/CTRDL-${{github.sha}}.zip .
- name: Upload Assets
uses: softprops/action-gh-release@v2
with:
name: Release-${{github.sha}}
name: PreRelease-${{github.sha}}
files: CTRDL-${{github.sha}}.zip
fail_on_unmatched_files: true
tag_name: Release-${{github.run_id}}
tag_name: PreRelease-${{github.run_id}}
prerelease: true
make_latest: true
token: ${{secrets.GITHUB_TOKEN}}
generate_release_notes: true
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
project(dl)

CPMAddPackage("gh:kynex7510/CTRL#3a5514c")
CPMAddPackage("gh:kynex7510/CTRL#90a1878")

file(GLOB DL_SOURCES Source/*.c)
add_library(${PROJECT_NAME} STATIC ${DL_SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC Include)
target_compile_options(${PROJECT_NAME} PRIVATE -O3 -Wall -Wno-switch)
target_link_libraries(${PROJECT_NAME} CTRL)
add_library(dl STATIC ${DL_SOURCES})
target_include_directories(dl PUBLIC Include)
target_compile_options(dl PRIVATE -O2 -Wall -Wno-switch)
target_link_libraries(dl CTRL)

install(TARGETS dl)
install(FILES Include/dlfcn.h DESTINATION include)

add_subdirectory(Tests)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Download a [prebuilt](https://github.com/kynex7510/CTRDL/releases) version, use
```
cmake -B Build -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build Build --config Release
cmake --install Build --prefix Build/Release
```

## Limitations
Expand Down
8 changes: 5 additions & 3 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ project(dl-test)
# $DEVKITPRO/devkitARM/bin/arm-none-eabi-gcc -fPIC -shared Math.c -o Math.so
# add_library(math SHARED Math.c)

add_executable("${PROJECT_NAME}-path" Path.c)
target_link_libraries("${PROJECT_NAME}-path" PUBLIC dl)
ctr_create_3dsx("${PROJECT_NAME}-path")
add_executable(dl-test-path Path.c)
target_link_libraries(dl-test-path PUBLIC dl)
ctr_create_3dsx(dl-test-path)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dl-test-path.3dsx TYPE BIN)

0 comments on commit 321f0ae

Please sign in to comment.