Merge pull request #962 from JAB-dev/feat/ngs2-plain-module

feat(libSceNgs2): build libSceNgs2 from the libSceNgs2.native implementation
This commit is contained in:
Dean
2026-10-07 15:13:07 +13:00
committed by GitHub
4 changed files with 45 additions and 30 deletions
+2 -20
View File
@@ -1,23 +1,5 @@
add_library(libSceNgs2.native SHARED EXCLUDE_FROM_ALL
${CMAKE_CURRENT_SOURCE_DIR}/src/Atrac9.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Custom.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Rack.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Render.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/System.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Unimplemented.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Voice.cpp
)
target_include_directories(libSceNgs2.native PRIVATE ${LIBS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty/LibAtrac9/C/src)
target_link_libraries(libSceNgs2.native PRIVATE atrac9)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(libSceNgs2.native PRIVATE LINKER:--exclude-libs,ALL)
endif()
set_target_properties(libSceNgs2.native PROPERTIES
CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
configure_windows_unwind(libSceNgs2.native)
include(${CMAKE_CURRENT_SOURCE_DIR}/Ngs2Library.cmake)
add_sce_ngs2_library(libSceNgs2.native)
if(MINGW)
foreach(runtimeLinkFlag IN ITEMS -static-libgcc -static-libstdc++ -static)
@@ -0,0 +1,23 @@
function(add_sce_ngs2_library target)
set(ngs2Dir ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
add_library(${target} SHARED EXCLUDE_FROM_ALL
${ngs2Dir}/src/Atrac9.cpp
${ngs2Dir}/src/Custom.cpp
${ngs2Dir}/src/Rack.cpp
${ngs2Dir}/src/Render.cpp
${ngs2Dir}/src/System.cpp
${ngs2Dir}/src/Unimplemented.cpp
${ngs2Dir}/src/Voice.cpp
)
target_include_directories(${target} PRIVATE ${LIBS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty/LibAtrac9/C/src)
target_link_libraries(${target} PRIVATE atrac9)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_options(${target} PRIVATE LINKER:--exclude-libs,ALL)
endif()
set_target_properties(${target} PROPERTIES
CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)
configure_windows_unwind(${target})
endfunction()
+20
View File
@@ -0,0 +1,20 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/../libSceNgs2.native/Ngs2Library.cmake)
add_sce_ngs2_library(libSceNgs2)
if(MINGW)
foreach(runtimeLinkFlag IN ITEMS -static-libgcc -static-libstdc++ -static)
string(REPLACE "${runtimeLinkFlag}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endforeach()
endif()
if(BUILD_TESTING)
add_test_executable(ngs2_core_render_tests ${CMAKE_CURRENT_SOURCE_DIR}/../libSceNgs2.native/tests/Ngs2Render.cpp)
target_include_directories(ngs2_core_render_tests PRIVATE ${LIBS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty/LibAtrac9/C/src)
target_link_libraries(ngs2_core_render_tests PRIVATE libSceNgs2 atrac9 libkernel libc)
configure_windows_unwind(ngs2_core_render_tests)
add_test(NAME ngs2_core_render COMMAND ngs2_core_render_tests)
if(WIN32)
set_tests_properties(ngs2_core_render PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceNgs2>")
endif()
endif()
-10
View File
@@ -1,10 +0,0 @@
#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
extern "C" {
APS5_DUMMY_FUN
}