diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0bf3bd99..564ef949e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -331,9 +331,8 @@ jobs: - name: Build run: | - cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_PYTHON=OFF .. - make -j$(nproc) + cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_PYTHON=OFF .. + cmake --build build --parallel - name: Deploy uses: actions/upload-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 03abac804..dde391755 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ message("VERSION_HASH: ${VERSION_HASH}") configure_file("${PROJECT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") -if(ANDROID OR EMSCRIPTEN OR N3DS OR BAREMETALPI) +if(ANDROID OR EMSCRIPTEN OR NINTENDO_3DS OR BAREMETALPI) set(BUILD_STATIC_DEFAULT ON) else() set(BUILD_STATIC_DEFAULT OFF) @@ -64,7 +64,7 @@ message("BUILD_SDLGPU: ${BUILD_SDLGPU}") message("BUILD_TOUCH_INPUT: ${BUILD_TOUCH_INPUT}") message("BUILD_WITH_ALL: ${BUILD_WITH_ALL}") -if (N3DS) +if (NINTENDO_3DS) set(BUILD_SDL OFF) endif() @@ -72,7 +72,7 @@ if (BAREMETALPI) set(BUILD_SDL OFF) endif() -if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID AND NOT N3DS) +if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID AND NOT NINTENDO_3DS) set(LINUX TRUE) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD") diff --git a/build/n3ds/README.md b/build/n3ds/README.md index 6180b0966..d8da0ff6f 100644 --- a/build/n3ds/README.md +++ b/build/n3ds/README.md @@ -2,19 +2,16 @@ ## Requirements -* devkitARM (tested on release 54, please use latest) + the 3ds-dev meta package +* devkitARM (tested on release 65, please use latest) + the 3ds-dev meta package * the following additional packages: - * devkitpro-pkgbuild-helpers * 3ds-libpng - * 3ds-pkg-config * 3ds-zlib ## Building instructions ``` -cd build -cmake .. -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -make +cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake +cmake --build build ``` You should now be able to find `tic80.3dsx` in build/bin. diff --git a/build/n3ds/elf_to_3dsx.sh b/build/n3ds/elf_to_3dsx.sh deleted file mode 100755 index 0ee748c62..000000000 --- a/build/n3ds/elf_to_3dsx.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -echo "[3DSX] Building metadata" -${DEVKITPRO}/tools/bin/smdhtool --create "TIC-80 tiny computer" "Fantasy computer for making, playing and sharing tiny games" "Nesbox" "n3ds/icon.png" tic80.smdh -echo "[3DSX] Building binary" -${DEVKITPRO}/tools/bin/3dsxtool bin/tic80_n3ds.elf bin/tic80.3dsx --smdh=tic80.smdh --romfs=n3ds/romfs/ diff --git a/cmake/lua.cmake b/cmake/lua.cmake index 4a441fbfe..c41bf7bfa 100644 --- a/cmake/lua.cmake +++ b/cmake/lua.cmake @@ -77,7 +77,7 @@ if(BUILD_WITH_LUA) ${CMAKE_SOURCE_DIR}/src ) - if(N3DS) + if(NINTENDO_3DS) target_compile_definitions(luaapi PUBLIC LUA_32BITS) endif() diff --git a/cmake/n3ds.cmake b/cmake/n3ds.cmake index 6b5bbf467..438f121ba 100644 --- a/cmake/n3ds.cmake +++ b/cmake/n3ds.cmake @@ -2,26 +2,34 @@ # TIC-80 app (N3DS) ################################ -if(N3DS) +if(NINTENDO_3DS) set(TIC80_SRC ${TIC80_SRC} ${CMAKE_SOURCE_DIR}/src/system/n3ds/utils.c ${CMAKE_SOURCE_DIR}/src/system/n3ds/keyboard.c ${CMAKE_SOURCE_DIR}/src/system/n3ds/main.c ) - add_executable(tic80_n3ds ${TIC80_SRC}) + add_executable(tic80 ${TIC80_SRC}) - target_include_directories(tic80_n3ds PRIVATE + target_include_directories(tic80 PRIVATE ${DEVKITPRO}/portlibs/3ds/include ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) - target_link_directories(tic80_n3ds PRIVATE ${DEVKITPRO}/libctru/lib ${DEVKITPRO}/portlibs/3ds/lib) - target_link_libraries(tic80_n3ds tic80studio png citro3d) + target_link_directories(tic80 PRIVATE ${DEVKITPRO}/libctru/lib ${DEVKITPRO}/portlibs/3ds/lib) + target_link_libraries(tic80 tic80studio png citro3d) - add_custom_command(TARGET tic80_n3ds - POST_BUILD - COMMAND ${CMAKE_SOURCE_DIR}/build/n3ds/elf_to_3dsx.sh - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/build + ctr_generate_smdh(tic80.smdh + NAME "TIC-80 tiny computer" + DESCRIPTION "Fantasy computer for making, playing and sharing tiny games" + AUTHOR "Nesbox" + ICON ${CMAKE_SOURCE_DIR}/build/n3ds/icon.png ) + + ctr_create_3dsx(tic80 + SMDH tic80.smdh + ROMFS ${CMAKE_SOURCE_DIR}/build/n3ds/romfs + OUTPUT ${CMAKE_SOURCE_DIR}/build/bin/tic80.3dsx + ) + endif() \ No newline at end of file diff --git a/cmake/naett.cmake b/cmake/naett.cmake index 3ddf2d96c..813b49886 100644 --- a/cmake/naett.cmake +++ b/cmake/naett.cmake @@ -2,7 +2,7 @@ # naett ################################ -if(NOT RPI AND NOT N3DS AND NOT EMSCRIPTEN AND NOT BAREMETALPI) +if(NOT RPI AND NOT NINTENDO_3DS AND NOT EMSCRIPTEN AND NOT BAREMETALPI) set(USE_NAETT TRUE) endif() diff --git a/cmake/quickjs.cmake b/cmake/quickjs.cmake index 2b018bdac..c8f5c99aa 100644 --- a/cmake/quickjs.cmake +++ b/cmake/quickjs.cmake @@ -25,7 +25,7 @@ if(BUILD_WITH_JS) target_compile_definitions(quickjs PRIVATE DUMP_LEAKS) endif() - if(BAREMETALPI OR N3DS) + if(BAREMETALPI OR NINTENDO_3DS) target_compile_definitions(quickjs PRIVATE POOR_CLIB) endif() diff --git a/cmake/scheme.cmake b/cmake/scheme.cmake index b3185875e..c95ceccd5 100644 --- a/cmake/scheme.cmake +++ b/cmake/scheme.cmake @@ -30,7 +30,7 @@ if(BUILD_WITH_SCHEME) ${CMAKE_SOURCE_DIR}/src ) - if (N3DS) + if (NINTENDO_3DS) target_compile_definitions(scheme PRIVATE S7_N3DS) endif() diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index db5367a42..bead503c9 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -2,7 +2,7 @@ # ZLIB ################################ -if (NOT N3DS) +if (NOT NINTENDO_3DS) set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib) set(ZLIB_SRC