diff --git a/core/libs/prx/libSceNgs2.native/CMakeLists.txt b/core/libs/prx/libSceNgs2.native/CMakeLists.txt index a2d50f9b8..b9ed2af05 100644 --- a/core/libs/prx/libSceNgs2.native/CMakeLists.txt +++ b/core/libs/prx/libSceNgs2.native/CMakeLists.txt @@ -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) diff --git a/core/libs/prx/libSceNgs2.native/Ngs2Library.cmake b/core/libs/prx/libSceNgs2.native/Ngs2Library.cmake new file mode 100644 index 000000000..5f8a9df33 --- /dev/null +++ b/core/libs/prx/libSceNgs2.native/Ngs2Library.cmake @@ -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() diff --git a/core/libs/prx/libSceNgs2/CMakeLists.txt b/core/libs/prx/libSceNgs2/CMakeLists.txt new file mode 100644 index 000000000..8e57a8733 --- /dev/null +++ b/core/libs/prx/libSceNgs2/CMakeLists.txt @@ -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:$") + endif() +endif() diff --git a/core/libs/prx/libSceNgs2/Export.cpp b/core/libs/prx/libSceNgs2/Export.cpp deleted file mode 100644 index fb34206c2..000000000 --- a/core/libs/prx/libSceNgs2/Export.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include "SceTypes.hpp" -#include "prx/libc/include/General.hpp" - -extern "C" { - -APS5_DUMMY_FUN - -}