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

Restore support for the Nokia N-Gage #12148

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
fbc8474
[Nokia N-Gage] Add CMake build configuration.
mupfdev Jan 31, 2025
d7fd145
[Nokia N-Gage] Add stub application: The purpose of this file is to v…
mupfdev Jan 31, 2025
d6cf0ee
[Nokia N-Gage] Add build configuration and platform-specific defines.
mupfdev Jan 31, 2025
33f00e8
[Nokia N-Gage] Add audio driver implementation.
mupfdev Jan 31, 2025
e3ec2d9
[Nokia N-Gage] Add rendering back-end.
mupfdev Jan 31, 2025
1916719
[Nokia N-Gage] Add video driver implementation.
mupfdev Jan 31, 2025
06d0de9
[Nokia N-Gage] Add SDL main application entry point.
mupfdev Jan 31, 2025
9602d85
[Nokia N-Gage] Add platform-specific core functions that are used for…
mupfdev Jan 31, 2025
1712938
[Nokia N-Gage] Add functions related to locales and time.
mupfdev Jan 31, 2025
a0f9476
[Nokia N-Gage] Add file system related functions.
mupfdev Jan 31, 2025
236809d
[Nokia N-Gage] Add timer/counter functions.
mupfdev Jan 31, 2025
6928d3b
[Nokia N-Gage] Handle platform-specific edge cases.
mupfdev Jan 31, 2025
06914b1
Add missing include guard
mupfdev Jan 31, 2025
d56d7c2
[Nokia N-Gage] Add logging support.
mupfdev Jan 31, 2025
3717b12
[Nokia N-Gage] Add platform to SDL.c
mupfdev Jan 31, 2025
f5eec31
[Nokia N-Gage] Add missing SDL_TriggerBreakpoint() implementation to …
mupfdev Feb 1, 2025
9edf435
[Nokia N-Gage] Move compile definitions to the SDK's toolchain file.
mupfdev Feb 1, 2025
40daf52
[Nokia N-Gage] Remove redundant nullptr definition.
mupfdev Feb 1, 2025
8c6b85a
[Nokia N-Gage] Update configuration after adding stdbool.h, stdint.h …
mupfdev Feb 1, 2025
58ae08a
[Nokia N-Gage] Update guard as suggested by @madebr, this should fix CI
mupfdev Feb 1, 2025
f482ff5
[Nokia N-Gage] Remove redundant guard after adding minimal stdbool.h …
mupfdev Feb 1, 2025
4b467d0
[Nokia N-Gage] Remove redundant guard after adding minimal inttypes.h…
mupfdev Feb 1, 2025
373f457
Remove redundant guard
mupfdev Feb 1, 2025
85db4ac
[Nokia N-Gage] Fix audio deinit which caused an error message on exit…
mupfdev Feb 1, 2025
3bea42e
[Nokia N-Gage] Simplify/Fix focus handling; it is now possible to put…
mupfdev Feb 3, 2025
07c5e11
[Nokia N-Gage] Set initial focus to ETrue; this is not required on re…
mupfdev Feb 3, 2025
3de2957
Fix platform name in comment.
mupfdev Feb 5, 2025
ab7c774
Fixed decoding 4-bit RLE encoded BMP files
slouken Feb 4, 2025
ee1fab1
bmp: Removed debug printf call.
icculus Feb 4, 2025
a137dcf
Fixed memory leak looking up pen tool names
slouken Feb 5, 2025
e5fe53b
Fixed potential double-free
slouken Feb 5, 2025
d88c459
[Nokia N-Gage] Add build configuration and platform-specific defines.
mupfdev Jan 31, 2025
3d12187
[Nokia N-Gage] Remove toolchain setting from CMakeLists.txt; this sho…
mupfdev Feb 5, 2025
1d74372
[Nokia N-Gage] Remove redundant guard.
mupfdev Feb 5, 2025
a6626c3
[Nokia N-Gage] As suggested by @ccawley2011, SDL_EnableScreenSaver() …
mupfdev Feb 5, 2025
b13ed6d
[Nokia N-Gage] Add external declaration to avoid compiler warning
mupfdev Feb 5, 2025
5835f07
[Nokia N-Gage] Remove unused NGAGE_QueueNoOp()
mupfdev Feb 5, 2025
ab8c2cb
[Nokia N-Gage] Move VideoBootStrap declaration where it belongs
mupfdev Feb 5, 2025
b4af6c4
[Nokia N-Gage] Update README-ngage.md
mupfdev Feb 5, 2025
3d6337c
Add missing return value to NGAGE_SuspendScreenSaver().
mupfdev Feb 6, 2025
f4e2ee6
[Nokia N-Gage] Remove redundant code after cleaning up the native Sym…
mupfdev Feb 6, 2025
9f5f214
[Nokia N-Gage] Update SDL_sysfilesystem.c as suggested by @ccawley2011
mupfdev Feb 8, 2025
ac9e1ac
[Nokia N-Gage] Update NGAGE_LockTexture as suggested in PR code review
mupfdev Feb 8, 2025
b88a3f1
[Nokia N-Gage] Use proper locals for HK and Taiwan
mupfdev Feb 8, 2025
86a96ee
[Nokia N-Gage] ELangEnglish -> en_GB
mupfdev Feb 8, 2025
551337c
[Nokia N-Gage] Remove redundant ssize_t definition. It now lives in s…
mupfdev Feb 9, 2025
3fe8eaf
[Nokia N-Gage] Remove redundant external declarations, these had been…
mupfdev Feb 9, 2025
0881747
[Nokia N-Gage] Fix SDL include in ngagetest.c
mupfdev Feb 9, 2025
042c12e
Add missing include
mupfdev Feb 9, 2025
1741765
[Nokia N-Gage] Remove redundant vsnprintf definition, add platform-sp…
mupfdev Feb 9, 2025
5224000
ci: add minimum N-Gage ci
madebr Feb 9, 2025
1d3b4b7
[Nokia N-Gage] Update source list in (temporary) platform-specific bu…
mupfdev Mar 2, 2025
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
102 changes: 102 additions & 0 deletions .github/actions/setup-ngage-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: 'Setup Nonka N-Gage SDK'
description: 'Download and setup Nokia N-Gage SDK'
inputs:
path:
description: 'Installation path'
default: 'default'
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: 'Verify platform'
id: calc
shell: sh
run: |
case "${{ runner.os }}-${{ runner.arch }}" in
"Windows-X86" | "Windows-X64")
echo "ok!"
echo "cache-key=ngage-sdk-windows" >> ${GITHUB_OUTPUT}
default_install_path="C:/ngagesdk"
;;
*)
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
exit 1;
;;
esac
install_path="${{ inputs.path }}"
if [ "x$install_path" = "xdefault" ]; then
install_path="$default_install_path"
fi
echo "install-path=$install_path" >> ${GITHUB_OUTPUT}

toolchain_repo="https://github.com/ngagesdk/ngage-toolchain"
toolchain_branch="main"
echo "toolchain-repo=${toolchain_repo}" >> ${GITHUB_OUTPUT}
echo "toolchain-branch=${toolchain_branch}" >> ${GITHUB_OUTPUT}

sdk_repo="https://github.com/ngagesdk/sdk"
sdk_branch="main"
echo "sdk-repo=${sdk_repo}" >> ${GITHUB_OUTPUT}
echo "sdk-branch=${sdk_branch}" >> ${GITHUB_OUTPUT}

tools_repo="https://github.com/ngagesdk/tools"
tools_branch="main"
echo "tools-repo=${tools_repo}" >> ${GITHUB_OUTPUT}
echo "tools-branch=${tools_branch}" >> ${GITHUB_OUTPUT}

extras_repo="https://github.com/ngagesdk/extras"
extras_branch="main"
echo "extras-repo=${extras_repo}" >> ${GITHUB_OUTPUT}
echo "extras-branch=${extras_branch}" >> ${GITHUB_OUTPUT}
# - name: 'Restore cached ${{ steps.calc.outputs.archive }}'
# id: cache-restore
# uses: actions/cache/restore@v4
# with:
# path: '${{ runner.temp }}'
# key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download N-Gage SDK'
# if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
shell: pwsh
run: |

Invoke-WebRequest "${{ steps.calc.outputs.toolchain-repo }}/archive/refs/heads/${{ steps.calc.outputs.toolchain-branch }}.zip" -OutFile "${{ runner.temp }}/ngage-toolchain.zip"
Invoke-WebRequest "${{ steps.calc.outputs.sdk-repo }}/archive/refs/heads/${{ steps.calc.outputs.sdk-branch }}.zip" -OutFile "${{ runner.temp }}/sdk.zip"
Invoke-WebRequest "${{ steps.calc.outputs.tools-repo }}/archive/refs/heads/${{ steps.calc.outputs.tools-branch }}.zip" -OutFile "${{ runner.temp }}/tools.zip"
Invoke-WebRequest "${{ steps.calc.outputs.extras-repo }}/archive/refs/heads/${{ steps.calc.outputs.extras-branch }}.zip" -OutFile "${{ runner.temp }}/extras.zip"

# - name: 'Cache ${{ steps.calc.outputs.archive }}'
# if: ${{ !steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false' }}
# uses: actions/cache/save@v4
# with:
# path: |
# ${{ runner.temp }}/apps.zip
# ${{ runner.temp }}/sdk.zip
# ${{ runner.temp }}/tools.zip
# key: ${{ steps.calc.outputs.cache-key }}
- name: 'Extract N-Gage SDK'
shell: pwsh
run: |
New-Item -ItemType Directory -Path "${{ steps.calc.outputs.install-path }}" -Force

New-Item -ItemType Directory -Path "${{ runner.temp }}/ngage-toolchain-temp" -Force
7z "-o${{ runner.temp }}/ngage-toolchain-temp" x "${{ runner.temp }}/ngage-toolchain.zip"
Move-Item -Path "${{ runner.temp }}/ngage-toolchain-temp/ngage-toolchain-${{ steps.calc.outputs.toolchain-branch }}/*" -Destination "${{ steps.calc.outputs.install-path }}"

7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/sdk.zip"
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/sdk-${{ steps.calc.outputs.sdk-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/sdk"

7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/tools.zip"
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/tools-${{ steps.calc.outputs.tools-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/tools"

7z "-o${{ steps.calc.outputs.install-path }}/sdk" x "${{ runner.temp }}/extras.zip"
Move-Item -Path "${{ steps.calc.outputs.install-path }}/sdk/extras-${{ steps.calc.outputs.extras-branch }}" -Destination "${{ steps.calc.outputs.install-path }}/sdk/extras"
- name: 'Set output variables'
id: final
shell: sh
run: |
echo "${{ steps.calc.outputs.install-path }}/sdk/sdk/6.1/Shared/EPOC32/gcc/bin" >> $GITHUB_PATH
echo "${{ steps.calc.outputs.install-path }}/sdk/sdk/6.1/Shared/EPOC32/ngagesdk/bin" >> $GITHUB_PATH
echo "NGAGESDK=${{ steps.calc.outputs.install-path }}" >> $GITHUB_ENV
echo "CMAKE_TOOLCHAIN_FILE=${{ steps.calc.outputs.install-path }}/cmake/ngage-toolchain.cmake" >> $GITHUB_ENV
20 changes: 20 additions & 0 deletions .github/workflows/create-test-plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class SdlPlatform(Enum):
Riscos = "riscos"
FreeBSD = "freebsd"
NetBSD = "netbsd"
NGage = "ngage"


class Msys2Platform(Enum):
Expand Down Expand Up @@ -138,6 +139,7 @@ class JobSpec:
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ),
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ),
"ngage": JobSpec(name="N-Gage", os=JobOs.WindowsLatest, platform=SdlPlatform.NGage, artifact="SDL-ngage", ),
}


Expand All @@ -163,6 +165,7 @@ class JobDetails:
artifact: str
no_cmake: bool
ccache: bool = False
continue_on_error: bool = False
build_tests: bool = True
container: str = ""
cmake_build_type: str = "RelWithDebInfo"
Expand Down Expand Up @@ -222,6 +225,7 @@ class JobDetails:
check_sources: bool = False
setup_python: bool = False
pypi_packages: list[str] = dataclasses.field(default_factory=list)
setup_gage_sdk_path: str = ""

def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
data = {
Expand All @@ -231,6 +235,7 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
"ccache": self.ccache,
"container": self.container if self.container else "",
"platform": self.platform,
"continue-on-error": self.continue_on_error,
"artifact": self.artifact,
"enable-artifacts": enable_artifacts,
"shell": self.shell,
Expand Down Expand Up @@ -289,6 +294,7 @@ def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
"check-sources": self.check_sources,
"setup-python": self.setup_python,
"pypi-packages": my_shlex_join(self.pypi_packages),
"setup-ngage-sdk-path": self.setup_gage_sdk_path,
}
return {k: v for k, v in data.items() if v != ""}

Expand Down Expand Up @@ -737,6 +743,20 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
case SdlPlatform.NGage:
job.cmake_arguments.extend([
"-DBUILD_FOR_NOKIA_NGAGE=ON", # FIXME: remove this
])
job.continue_on_error = True # FIXME: remove this
job.setup_ninja = True
job.static_lib = None # FIXME: should be StaticLibType.A
job.shared_lib = None
job.clang_tidy = False
job.werror = False # FIXME: enable SDL_WERROR
job.shared = False
job.run_tests = False
job.setup_gage_sdk_path = "C:/ngagesdk"
job.cmake_toolchain_file = "C:/ngagesdk/cmake/ngage-toolchain.cmake"
case _:
raise ValueError(f"Unsupported platform={spec.platform}")

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
container: ${{ matrix.platform.container }}
continue-on-error: ${{ matrix.platform.continue-on-error }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
Expand Down Expand Up @@ -93,6 +94,11 @@ jobs:
with:
arch: ${{ matrix.platform.msvc-vcvars-arch }}
sdk: ${{ matrix.platform.msvc-vcvars-sdk }}
- name: 'Set up Nokia N-Gage SDK'
uses: ./.github/actions/setup-ngage-sdk
if: ${{ matrix.platform.setup-ngage-sdk-path != '' }}
with:
path: '${{ matrix.platform.setup-ngage-sdk-path }}'
- name: 'Set up Windows GDK Desktop'
uses: ./.github/actions/setup-gdk-desktop
if: ${{ matrix.platform.setup-gdk-folder != '' }}
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
set(cmake_build_type_undefined 1)
endif()

# FIXME: remove this
option(BUILD_FOR_NOKIA_NGAGE "Build for Nokia N-Gage" OFF)

# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.3.0")

# FIXME: remove this
if (BUILD_FOR_NOKIA_NGAGE)
include(cmake/nokia_ngage.cmake)
return()
endif()

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON)
else()
Expand Down
125 changes: 125 additions & 0 deletions cmake/nokia_ngage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
cmake_minimum_required(VERSION 3.16)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be integrated into CMakeLists.txt, but once you get ci running for the currently supported SDL3 platforms, I'll try to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ngagesdk/ngage-toolchain#13

Apparently you tried this before. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


enable_language(CXX)

file(GLOB SDL3_sources
"${SDL3_SOURCE_DIR}/src/*.c"
"${SDL3_SOURCE_DIR}/src/atomic/*.c"
"${SDL3_SOURCE_DIR}/src/audio/*.c"
"${SDL3_SOURCE_DIR}/src/audio/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/audio/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/core/*.c"
"${SDL3_SOURCE_DIR}/src/core/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/core/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/cpuinfo/*.c"
"${SDL3_SOURCE_DIR}/src/dynapi/*.c"
"${SDL3_SOURCE_DIR}/src/events/*.c"
"${SDL3_SOURCE_DIR}/src/file/*.c"
"${SDL3_SOURCE_DIR}/src/file/generic/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/filesystem/posix/*.c"
"${SDL3_SOURCE_DIR}/src/hidapi/*.c"
"${SDL3_SOURCE_DIR}/src/io/*.c"
"${SDL3_SOURCE_DIR}/src/io/generic/*.c"
"${SDL3_SOURCE_DIR}/src/joystick/*.c"
"${SDL3_SOURCE_DIR}/src/joystick/dummy/*.c"
"${SDL3_SOURCE_DIR}/src/libm/s_isinff.c"
"${SDL3_SOURCE_DIR}/src/libm/s_isnanf.c"
"${SDL3_SOURCE_DIR}/src/locale/*.c"
"${SDL3_SOURCE_DIR}/src/locale/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/main/*.c"
"${SDL3_SOURCE_DIR}/src/main/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/main/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/misc/*.c"
"${SDL3_SOURCE_DIR}/src/misc/dummy/*.c"
"${SDL3_SOURCE_DIR}/src/power/*.c"
"${SDL3_SOURCE_DIR}/src/render/*.c"
"${SDL3_SOURCE_DIR}/src/render/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/render/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/sensor/*.c"
"${SDL3_SOURCE_DIR}/src/sensor/dummy/*.c"
"${SDL3_SOURCE_DIR}/src/stdlib/*.c"
"${SDL3_SOURCE_DIR}/src/storage/*.c"
"${SDL3_SOURCE_DIR}/src/storage/generic/*.c"
"${SDL3_SOURCE_DIR}/src/thread/*.c"
"${SDL3_SOURCE_DIR}/src/thread/generic/*.c"
"${SDL3_SOURCE_DIR}/src/time/*.c"
"${SDL3_SOURCE_DIR}/src/time/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/time/unix/*.c"
"${SDL3_SOURCE_DIR}/src/timer/*.c"
"${SDL3_SOURCE_DIR}/src/timer/ngage/*.cpp"
"${SDL3_SOURCE_DIR}/src/tray/*.c"
"${SDL3_SOURCE_DIR}/src/tray/dummy/*.c"
"${SDL3_SOURCE_DIR}/src/video/*.c"
"${SDL3_SOURCE_DIR}/src/video/ngage/*.c"
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/*.c")

add_library(${PROJECT_NAME} STATIC ${SDL3_sources})

target_include_directories(
${PROJECT_NAME}
PUBLIC
"${SDL3_SOURCE_DIR}/include"
PRIVATE
"${SDL3_SOURCE_DIR}/src"
"${SDL3_SOURCE_DIR}/include/build_config")

target_compile_definitions(
${PROJECT_NAME}
PUBLIC
SDL_STATIC_LIB)

set(test_static_libs
${CMAKE_CURRENT_BINARY_DIR}/libSDL3.a)

set(test_libs
${CMAKE_CURRENT_BINARY_DIR}/libSDL3.a
${EPOC_LIB}/NRenderer.lib
${EPOC_LIB}/3dtypes.a
${EPOC_LIB}/cone.lib
${EPOC_PLATFORM}/gcc/lib/gcc-lib/arm-epoc-pe/2.9-psion-98r2/libgcc.a
${EPOC_PLATFORM}/ngagesdk/lib/gcc/arm-epoc-pe/4.6.4/libgcc_ngage.a
${EPOC_PLATFORM}/ngagesdk/lib/gcc/arm-epoc-pe/4.6.4/libc_ngage.a
${EPOC_LIB}/mediaclientaudiostream.lib
${EPOC_LIB}/charconv.lib
${EPOC_LIB}/bitgdi.lib
${EPOC_LIB}/euser.lib
${EPOC_LIB}/estlib.lib
${EPOC_LIB}/ws32.lib
${EPOC_LIB}/hal.lib
${EPOC_LIB}/fbscli.lib
${EPOC_LIB}/efsrv.lib
${EPOC_LIB}/scdv.lib
${EPOC_LIB}/gdi.lib)

set(UID1 0x1000007a) # KExecutableImageUidValue, e32uid.h
set(UID2 0x100039ce) # KAppUidValue16, apadef.h
set(UID3 0x10005799) # ngage_test.exe UID

add_library(ngage_test STATIC "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test/ngagetest.c")

build_exe_static(ngage_test exe ${UID1} ${UID2} ${UID3} "${test_static_libs}" "${test_libs}")

add_dependencies(
ngage_test.exe
ngage_test)

add_dependencies(
ngage_test
${PROJECT_NAME})

target_compile_definitions(
ngage_test
PUBLIC
__EXE__
UID1=${UID1}
UID2=${UID2}
UID3=${UID3})

target_include_directories(
ngage_test
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/SDL3)
33 changes: 33 additions & 0 deletions cmake/test/ngagetest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// The purpose of this test is to validate that there are no undefined references
// when building with the N-Gage SDK since SDL can only be linked statically.

#define IMPORT_C
#include <SDL3/SDL.h>

int SDL_main(int argc, char* argv[])
{
for (int i = 0; i < argc; i++) { // C99 check.
/* Nothing to do here. */
}

return 0;
}

SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[])
{
return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
{
return SDL_APP_CONTINUE;
}

SDL_AppResult SDL_AppIterate(void* appstate)
{
return SDL_APP_CONTINUE;
}

void SDL_AppQuit(void* appstate, SDL_AppResult result)
{
}
Loading
Loading