From 321f0ae847d3f4bcbb0c7174ea4f2684291a2094 Mon Sep 17 00:00:00 2001 From: kynex7510 Date: Sun, 3 Nov 2024 10:08:40 +0100 Subject: [PATCH] Add install --- ...ild-Release.yaml => Build-PreRelease.yaml} | 22 +++++++++---------- CMakeLists.txt | 13 ++++++----- README.md | 1 + Tests/CMakeLists.txt | 8 ++++--- 4 files changed, 25 insertions(+), 19 deletions(-) rename .github/workflows/{Build-Release.yaml => Build-PreRelease.yaml} (64%) diff --git a/.github/workflows/Build-Release.yaml b/.github/workflows/Build-PreRelease.yaml similarity index 64% rename from .github/workflows/Build-Release.yaml rename to .github/workflows/Build-PreRelease.yaml index 86fc2e3..9430fd7 100644 --- a/.github/workflows/Build-Release.yaml +++ b/.github/workflows/Build-PreRelease.yaml @@ -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 @@ -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 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 780ca5e..a9a87cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/README.md b/README.md index 3d9e9e6..8653a30 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f204aa7..63cda1d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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") \ No newline at end of file +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) \ No newline at end of file