Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3ds docker toolchain #2701

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
29a5933
update 3ds docker
Miguel-hrvs Oct 7, 2024
1aec950
try to fix 3ds lua error
Miguel-hrvs Oct 7, 2024
e79bd65
revert and try to fix wren error
Miguel-hrvs Oct 7, 2024
3f57f81
disable lua and scheme for 3ds
Miguel-hrvs Oct 7, 2024
9e6f48a
try to fix lua
Miguel-hrvs Oct 7, 2024
d35c48a
try to fix lua
Miguel-hrvs Oct 7, 2024
9bcd480
try to fix lua
Miguel-hrvs Oct 7, 2024
218eef0
test
Miguel-hrvs Oct 7, 2024
c5169ff
revert
Miguel-hrvs Oct 7, 2024
35136d4
try to fix lua
Miguel-hrvs Oct 7, 2024
2ed74c3
test
Miguel-hrvs Oct 7, 2024
5638e43
test
Miguel-hrvs Oct 7, 2024
32ddf85
continue
Miguel-hrvs Oct 7, 2024
a629776
possible last lua fix
Miguel-hrvs Oct 7, 2024
218b866
disable javascript in 3ds
Miguel-hrvs Oct 7, 2024
b0e6274
disable js correctly
Miguel-hrvs Oct 7, 2024
ffa001f
disable python for 3ds
Miguel-hrvs Oct 7, 2024
617ba06
try to fix script.c
Miguel-hrvs Oct 7, 2024
216d468
try to fix another error
Miguel-hrvs Oct 7, 2024
8371209
test
Miguel-hrvs Oct 7, 2024
3cd6832
try to fix miniaudio
Miguel-hrvs Oct 7, 2024
33c107e
test
Miguel-hrvs Oct 7, 2024
bcdea08
test
Miguel-hrvs Oct 7, 2024
77a3569
test
Miguel-hrvs Oct 7, 2024
2fd5ffa
test
Miguel-hrvs Oct 7, 2024
c57616e
test
Miguel-hrvs Oct 7, 2024
f176d22
test
Miguel-hrvs Oct 7, 2024
894119c
try to fix gif errors
Miguel-hrvs Oct 7, 2024
6df8151
test
Miguel-hrvs Oct 7, 2024
410f912
test
Miguel-hrvs Oct 7, 2024
123ce09
test
Miguel-hrvs Oct 7, 2024
119c3e7
continue
Miguel-hrvs Oct 8, 2024
0f0a4e8
try with official devkitarm docker image
Miguel-hrvs Oct 8, 2024
c009e35
test
Miguel-hrvs Oct 9, 2024
2fbca52
clean
Miguel-hrvs Oct 10, 2024
631b86c
proper miniaudio fix
Miguel-hrvs Oct 11, 2024
b7de596
mianiaudio version used before
Miguel-hrvs Oct 11, 2024
7bfe333
use cmake to build 3dsx
WinterMute Oct 13, 2024
afc6ae9
use explicit name
WinterMute Oct 13, 2024
1820dea
fix 3ds build instructions
WinterMute Oct 13, 2024
a2c344f
use NINTENDO_3DS from devkitPro cmakery
WinterMute Oct 13, 2024
2b4edd1
fixup build commands
WinterMute Oct 13, 2024
9936566
output to build/bin
WinterMute Oct 13, 2024
058859f
update tested version
WinterMute Oct 13, 2024
34529dd
Merge pull request #1 from WinterMute/3ds-cmake-fix
Miguel-hrvs Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ jobs:
# === Nintendo 3DS build ===
nintendo-3ds:
runs-on: ubuntu-latest
container: nesbox/devkitpro-tic80:latest
container: devkitpro/devkitarm:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
Expand All @@ -331,12 +331,11 @@ jobs:

- name: Build
run: |
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON ..
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@v3
uses: actions/upload-artifact@v4
with:
name: "tic80-nintendo-3ds"
path: build/bin/tic80.3dsx
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -64,15 +64,15 @@ 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()

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")
Expand Down
9 changes: 3 additions & 6 deletions build/n3ds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 0 additions & 5 deletions build/n3ds/elf_to_3dsx.sh

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/lua.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
26 changes: 17 additions & 9 deletions cmake/n3ds.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion cmake/naett.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/quickjs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/scheme.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion cmake/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ZLIB
################################

if (NOT N3DS)
if (NOT NINTENDO_3DS)

set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib)
set(ZLIB_SRC
Expand Down
10 changes: 5 additions & 5 deletions src/api/luaapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,14 +1595,14 @@ static s32 lua_ffts(lua_State* lua)
return 0;
}

static s32 lua_dofile(lua_State *lua)
static int lua_dofile(lua_State *lua)
{
luaL_error(lua, "unknown method: \"dofile\"\n");

return 0;
}

static s32 lua_loadfile(lua_State *lua)
static int lua_loadfile(lua_State *lua)
{
luaL_error(lua, "unknown method: \"loadfile\"\n");

Expand Down Expand Up @@ -1634,12 +1634,12 @@ void luaapi_init(tic_core* core)
{
static const struct{lua_CFunction func; const char* name;} ApiItems[] =
{
#define API_FUNC_DEF(name, ...) {lua_ ## name, #name},
#define API_FUNC_DEF(name, ...) {(lua_CFunction)(lua_ ## name), #name},
TIC_API_LIST(API_FUNC_DEF)
#undef API_FUNC_DEF

#if defined(BUILD_DEPRECATED)
{lua_textri, "textri"},
{(lua_CFunction)lua_textri, "textri"},
#endif
};

Expand All @@ -1665,7 +1665,7 @@ void luaapi_close(tic_mem* tic)
** Message handler which appends stract trace to exceptions.
** This function was extractred from lua.c.
*/
static s32 msghandler (lua_State *lua)
static int msghandler (lua_State *lua)
{
const char *msg = lua_tostring(lua, 1);
if (msg == NULL) /* is error object not a string? */
Expand Down
2 changes: 1 addition & 1 deletion src/api/wren.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ static void initAPI(tic_core* core)
}
}

static void reportError(WrenVM* vm, WrenErrorType type, const char* module, s32 line, const char* message)
static void reportError(WrenVM* vm, WrenErrorType type, const char* module, int line, const char* message)
{
tic_core* core = getWrenCore(vm);

Expand Down
9 changes: 5 additions & 4 deletions src/ext/gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static gif_image* readGif(GifFileType *gif)
{
gif_image* image = NULL;

s32 error = 0;
int error = 0;

if(gif)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ static gif_image* readGif(GifFileType *gif)

case EXTENSION_RECORD_TYPE:
{
s32 extCode = 0;
int extCode = 0;
GifByteType* extension = NULL;

if (DGifGetExtension(gif, &extCode, &extension) == GIF_ERROR)
Expand Down Expand Up @@ -167,7 +167,7 @@ typedef struct
s32 pos;
} GifBuffer;

static s32 readBuffer(GifFileType* gif, GifByteType* data, s32 size)
static int readBuffer(GifFileType* gif, GifByteType* data, int size)
{
GifBuffer* buffer = (GifBuffer*)gif->UserData;

Expand All @@ -177,14 +177,15 @@ static s32 readBuffer(GifFileType* gif, GifByteType* data, s32 size)
return size;
}

gif_image* gif_read_data(const void* data, s32 size)
gif_image* gif_read_data(const void* data, int size)
{
GifBuffer buffer = {data, 0};
GifFileType *gif = DGifOpen(&buffer, readBuffer, NULL);

return readGif(gif);
}


void gif_close(gif_image* image)
{
if(image)
Expand Down
2 changes: 1 addition & 1 deletion src/ext/gif.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ typedef struct
s32 colors;
} gif_image;

gif_image* gif_read_data(const void* buffer, s32 size);
gif_image* gif_read_data(const void* buffer, int size);
void gif_close(gif_image* image);
6 changes: 3 additions & 3 deletions src/ext/miniaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -16137,7 +16137,7 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
int result;
pthread_attr_t* pAttr = NULL;

#if !defined(__EMSCRIPTEN__)
#if !defined(__EMSCRIPTEN__) && !defined(__3DS__)
/* Try setting the thread priority. It's not critical if anything fails here. */
pthread_attr_t attr;
if (pthread_attr_init(&attr) == 0) {
Expand Down Expand Up @@ -17864,7 +17864,7 @@ Dynamic Linking
#ifdef MA_POSIX
/* No need for dlfcn.h if we're not using runtime linking. */
#ifndef MA_NO_RUNTIME_LINKING
#include <dlfcn.h>
#include "../../vendor/dlfcn/src/dlfcn.h"
#endif
#endif

Expand Down Expand Up @@ -17995,7 +17995,7 @@ DEVICE I/O

/* No need for dlfcn.h if we're not using runtime linking. */
#ifndef MA_NO_RUNTIME_LINKING
#include <dlfcn.h>
#include "../../vendor/dlfcn/src/dlfcn.h"
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void tic_add_script(const tic_script* script)
if(index < MAX_SUPPORTED_LANGS)
{
Scripts[index] = script;
qsort(Scripts, index + 1, sizeof Scripts[0], compareScripts);
qsort(Scripts, index + 1, sizeof Scripts[0], (int (*)(const void *, const void *))compareScripts);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/studio/editors/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ static void setGotoMode(Code* code)
code->jump.line = -1;
}

static s32 funcCompare(const void* a, const void* b)
static int funcCompare(const void* a, const void* b)
{
const tic_outline_item* item1 = (const tic_outline_item*)a;
const tic_outline_item* item2 = (const tic_outline_item*)b;
Expand Down
6 changes: 3 additions & 3 deletions src/studio/screens/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ static s32 casecmp(const char *str1, const char *str2)
return (s32) ((u8) tolower(*str1) - (u8) tolower(*str2));
}

static inline s32 itemcmp(const void* a, const void* b)
static inline int itemcmp(const void* a, const void* b)
{
const FileItem* item1 = a;
const FileItem* item2 = b;
Expand Down Expand Up @@ -4489,12 +4489,12 @@ void forceAutoSave(Console* console, const char* cart_name)
commandDone(console);
}

static s32 cmdcmp(const void* a, const void* b)
static int cmdcmp(const void* a, const void* b)
{
return strcmp(((const Command*)a)->name, ((const Command*)b)->name);
}

static s32 apicmp(const void* a, const void* b)
static int apicmp(const void* a, const void* b)
{
return strcmp(((const ApiItem*)a)->name, ((const ApiItem*)b)->name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/studio/screens/surf.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static bool addMenuItem(const char* name, const char* title, const char* hash, s
return true;
}

static s32 itemcmp(const void* a, const void* b)
static int itemcmp(const void* a, const void* b)
{
const SurfItem* item1 = a;
const SurfItem* item2 = b;
Expand Down
Loading