n3ds: fix exported libraries of n3ds

This commit is contained in:
Anonymous Maarten 2023-01-15 15:57:56 +01:00 committed by Anonymous Maarten
parent b47b6e02fd
commit f51f7fbb94
3 changed files with 47 additions and 3 deletions

16
.github/cmake/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.0)
project(ci_utils C CXX)
set(txt "CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_C_STANDARD_LIBRARIES}
")
message("${txt}")
set(VAR_PATH "/tmp/env.txt" CACHE PATH "Where to write environment file")
message(STATUS "Writing CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS environment to ${VAR_PATH}")
file(WRITE "${VAR_PATH}" "${txt}")

View file

@ -38,5 +38,22 @@ jobs:
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose
# Not running test_pkgconfig.sh and test_sdlconfig.sh
# as invoking the compiler manually is not supported
- name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain
run: |
cmake -S .github/cmake -B /tmp/cmake_extract \
-DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DVAR_PATH=/tmp/n3ds_env.txt
cat /tmp/n3ds_env.txt >> $GITHUB_ENV
- name: Verify sdl2-config
run: |
export EXTRA_CFLAGS="$CFLAGS"
export EXTRA_LDFLAGS="$LDFLAGS"
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export EXTRA_CFLAGS="$CFLAGS"
export EXTRA_LDFLAGS="$LDFLAGS"
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh

View file

@ -2643,7 +2643,7 @@ elseif(PSP)
)
if(NOT SDL2_DISABLE_SDL2MAIN)
list(INSERT SDL_LIBS 0 "-lSDL2main")
endif(NOT SDL2_DISABLE_SDL2MAIN)
endif()
elseif(PS2)
list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include")
@ -2841,6 +2841,17 @@ elseif(N3DS)
else()
message_error("SDL_FILE must be enabled to build on N3DS")
endif()
if(NOT SDL2_DISABLE_SDL2MAIN)
list(INSERT SDL_LIBS 0 "-lSDL2main")
endif()
foreach(lib ${CMAKE_C_STANDARD_LIBRARIES})
if(lib MATCHES "^-l")
string(SUBSTRING "${lib}" 2 -1 lib)
endif()
list(APPEND EXTRA_LIBS ${lib})
endforeach()
endif()
if(HAVE_VULKAN AND NOT SDL_LOADSO)