From bbba29ea61848ffb0b3013a48104789d8910d8d0 Mon Sep 17 00:00:00 2001 From: boykopovar Date: Thu, 1 Oct 2026 12:44:01 +0300 Subject: [PATCH] refactor(cmake): add local library configs and move test definitions --- core/libs/CMakeLists.txt | 74 ------------------- .../prx/libSceContentExport/CMakeLists.txt | 21 ++++++ core/libs/prx/libSceFiber/CMakeLists.txt | 20 +++++ core/libs/prx/libSceJson2/CMakeLists.txt | 20 +++++ core/libs/prx/libSceNet/CMakeLists.txt | 22 ++++++ core/libs/prx/libSceNetCtl/CMakeLists.txt | 3 + core/libs/prx/libSceRandom/CMakeLists.txt | 20 +++++ core/libs/prx/libSceRtc/CMakeLists.txt | 20 +++++ .../prx/libSceSystemService/CMakeLists.txt | 35 +++++++++ 9 files changed, 161 insertions(+), 74 deletions(-) create mode 100644 core/libs/prx/libSceContentExport/CMakeLists.txt create mode 100644 core/libs/prx/libSceFiber/CMakeLists.txt create mode 100644 core/libs/prx/libSceJson2/CMakeLists.txt create mode 100644 core/libs/prx/libSceNet/CMakeLists.txt create mode 100644 core/libs/prx/libSceNetCtl/CMakeLists.txt create mode 100644 core/libs/prx/libSceRandom/CMakeLists.txt create mode 100644 core/libs/prx/libSceRtc/CMakeLists.txt create mode 100644 core/libs/prx/libSceSystemService/CMakeLists.txt diff --git a/core/libs/CMakeLists.txt b/core/libs/CMakeLists.txt index fc638d839..5b886fafd 100644 --- a/core/libs/CMakeLists.txt +++ b/core/libs/CMakeLists.txt @@ -143,80 +143,6 @@ if(BUILD_TESTING) endif() add_test(NAME host_thread_local COMMAND host_thread_local_tests) set_tests_properties(host_thread_local PROPERTIES TIMEOUT 15) - add_test_executable(guest_system_exit_tests tests/GuestSystemExit.cpp) - target_include_directories(guest_system_exit_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_system_exit_tests PRIVATE libSceSystemService libc) - configure_windows_unwind(guest_system_exit_tests) - add_test(NAME guest_system_exit_parameters COMMAND guest_system_exit_tests) - add_test(NAME guest_system_exit COMMAND guest_system_exit_tests --exit) - add_test(NAME guest_immediate_exit COMMAND guest_system_exit_tests --immediate) - add_test(NAME guest_return_from_main COMMAND guest_system_exit_tests --return-from-main) - set_tests_properties(guest_system_exit PROPERTIES - PASS_REGULAR_EXPRESSION "Guest shutdown and atexit completed") - if(WIN32) - set_tests_properties(guest_system_exit guest_system_exit_parameters guest_immediate_exit guest_return_from_main PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_system_service_tests tests/GuestSystemService.cpp) - target_include_directories(guest_system_service_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_system_service_tests PRIVATE libSceSystemService libc) - configure_windows_unwind(guest_system_service_tests) - add_test(NAME guest_system_service COMMAND guest_system_service_tests) - if(WIN32) - set_tests_properties(guest_system_service PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_content_export_tests tests/GuestContentExport.cpp) - target_include_directories(guest_content_export_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_content_export_tests PRIVATE libSceContentExport libc) - configure_windows_unwind(guest_content_export_tests) - add_test(NAME guest_content_export COMMAND guest_content_export_tests) - if(WIN32) - set_tests_properties(guest_content_export PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_sce_net_tests tests/GuestSceNet.cpp) - target_include_directories(guest_sce_net_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_sce_net_tests PRIVATE libSceNet libSceNetCtl) - configure_windows_unwind(guest_sce_net_tests) - add_test(NAME guest_sce_net COMMAND guest_sce_net_tests) - set_tests_properties(guest_sce_net PROPERTIES TIMEOUT 20) - if(WIN32) - set_tests_properties(guest_sce_net PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_random_tests tests/GuestRandom.cpp) - target_include_directories(guest_random_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_random_tests PRIVATE libSceRandom) - add_test(NAME guest_random COMMAND guest_random_tests) - if(WIN32) - set_tests_properties(guest_random PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_rtc_tests tests/GuestRtc.cpp) - target_include_directories(guest_rtc_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_rtc_tests PRIVATE libSceRtc) - add_test(NAME guest_rtc COMMAND guest_rtc_tests) - if(WIN32) - set_tests_properties(guest_rtc PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(guest_json_tests tests/GuestJson.cpp) - target_include_directories(guest_json_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(guest_json_tests PRIVATE libSceJson2 libc) - add_test(NAME guest_json COMMAND guest_json_tests) - if(WIN32) - set_tests_properties(guest_json PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() - add_test_executable(fiber_tests tests/Fiber.cpp) - target_include_directories(fiber_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(fiber_tests PRIVATE libSceFiber libc) - add_test(NAME fiber COMMAND fiber_tests) - if(WIN32) - set_tests_properties(fiber PROPERTIES ENVIRONMENT_MODIFICATION - "PATH=path_list_prepend:$") - endif() endif() if(MINGW) diff --git a/core/libs/prx/libSceContentExport/CMakeLists.txt b/core/libs/prx/libSceContentExport/CMakeLists.txt new file mode 100644 index 000000000..9cdaa75dd --- /dev/null +++ b/core/libs/prx/libSceContentExport/CMakeLists.txt @@ -0,0 +1,21 @@ +add_library(libSceContentExport SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceContentExport PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceContentExport) + +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(guest_content_export_tests ${LIBS_INCLUDE_DIR}/tests/GuestContentExport.cpp) + target_include_directories(guest_content_export_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_content_export_tests PRIVATE libSceContentExport libc) + configure_windows_unwind(guest_content_export_tests) + add_test(NAME guest_content_export COMMAND guest_content_export_tests) + if(WIN32) + set_tests_properties(guest_content_export PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceFiber/CMakeLists.txt b/core/libs/prx/libSceFiber/CMakeLists.txt new file mode 100644 index 000000000..6fd2e2523 --- /dev/null +++ b/core/libs/prx/libSceFiber/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(libSceFiber SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceFiber PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceFiber) + +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(fiber_tests ${LIBS_INCLUDE_DIR}/tests/Fiber.cpp) + target_include_directories(fiber_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(fiber_tests PRIVATE libSceFiber libc) + add_test(NAME fiber COMMAND fiber_tests) + if(WIN32) + set_tests_properties(fiber PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceJson2/CMakeLists.txt b/core/libs/prx/libSceJson2/CMakeLists.txt new file mode 100644 index 000000000..d1cd90d94 --- /dev/null +++ b/core/libs/prx/libSceJson2/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(libSceJson2 SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceJson2 PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceJson2) + +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(guest_json_tests ${LIBS_INCLUDE_DIR}/tests/GuestJson.cpp) + target_include_directories(guest_json_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_json_tests PRIVATE libSceJson2 libc) + add_test(NAME guest_json COMMAND guest_json_tests) + if(WIN32) + set_tests_properties(guest_json PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceNet/CMakeLists.txt b/core/libs/prx/libSceNet/CMakeLists.txt new file mode 100644 index 000000000..d6a6254c7 --- /dev/null +++ b/core/libs/prx/libSceNet/CMakeLists.txt @@ -0,0 +1,22 @@ +add_library(libSceNet SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceNet PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceNet) + +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(guest_sce_net_tests ${LIBS_INCLUDE_DIR}/tests/GuestSceNet.cpp) + target_include_directories(guest_sce_net_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_sce_net_tests PRIVATE libSceNet libSceNetCtl) + configure_windows_unwind(guest_sce_net_tests) + add_test(NAME guest_sce_net COMMAND guest_sce_net_tests) + set_tests_properties(guest_sce_net PROPERTIES TIMEOUT 20) + if(WIN32) + set_tests_properties(guest_sce_net PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceNetCtl/CMakeLists.txt b/core/libs/prx/libSceNetCtl/CMakeLists.txt new file mode 100644 index 000000000..f221f2193 --- /dev/null +++ b/core/libs/prx/libSceNetCtl/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(libSceNetCtl SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceNetCtl PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceNetCtl) diff --git a/core/libs/prx/libSceRandom/CMakeLists.txt b/core/libs/prx/libSceRandom/CMakeLists.txt new file mode 100644 index 000000000..91ab41b62 --- /dev/null +++ b/core/libs/prx/libSceRandom/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(libSceRandom SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceRandom PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceRandom) + +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(guest_random_tests ${LIBS_INCLUDE_DIR}/tests/GuestRandom.cpp) + target_include_directories(guest_random_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_random_tests PRIVATE libSceRandom) + add_test(NAME guest_random COMMAND guest_random_tests) + if(WIN32) + set_tests_properties(guest_random PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceRtc/CMakeLists.txt b/core/libs/prx/libSceRtc/CMakeLists.txt new file mode 100644 index 000000000..a0e4a2444 --- /dev/null +++ b/core/libs/prx/libSceRtc/CMakeLists.txt @@ -0,0 +1,20 @@ +add_library(libSceRtc SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceRtc PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceRtc) + +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(guest_rtc_tests ${LIBS_INCLUDE_DIR}/tests/GuestRtc.cpp) + target_include_directories(guest_rtc_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_rtc_tests PRIVATE libSceRtc) + add_test(NAME guest_rtc COMMAND guest_rtc_tests) + if(WIN32) + set_tests_properties(guest_rtc PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif() diff --git a/core/libs/prx/libSceSystemService/CMakeLists.txt b/core/libs/prx/libSceSystemService/CMakeLists.txt new file mode 100644 index 000000000..ff18d4bad --- /dev/null +++ b/core/libs/prx/libSceSystemService/CMakeLists.txt @@ -0,0 +1,35 @@ +add_library(libSceSystemService SHARED EXCLUDE_FROM_ALL Export.cpp) +target_include_directories(libSceSystemService PRIVATE ${LIBS_INCLUDE_DIR}) +configure_windows_unwind(libSceSystemService) + +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(guest_system_exit_tests ${LIBS_INCLUDE_DIR}/tests/GuestSystemExit.cpp) + target_include_directories(guest_system_exit_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_system_exit_tests PRIVATE libSceSystemService libc) + configure_windows_unwind(guest_system_exit_tests) + add_test(NAME guest_system_exit_parameters COMMAND guest_system_exit_tests) + add_test(NAME guest_system_exit COMMAND guest_system_exit_tests --exit) + add_test(NAME guest_immediate_exit COMMAND guest_system_exit_tests --immediate) + add_test(NAME guest_return_from_main COMMAND guest_system_exit_tests --return-from-main) + set_tests_properties(guest_system_exit PROPERTIES + PASS_REGULAR_EXPRESSION "Guest shutdown and atexit completed") + if(WIN32) + set_tests_properties(guest_system_exit guest_system_exit_parameters guest_immediate_exit guest_return_from_main PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() + add_test_executable(guest_system_service_tests ${LIBS_INCLUDE_DIR}/tests/GuestSystemService.cpp) + target_include_directories(guest_system_service_tests PRIVATE ${LIBS_INCLUDE_DIR}) + target_link_libraries(guest_system_service_tests PRIVATE libSceSystemService libc) + configure_windows_unwind(guest_system_service_tests) + add_test(NAME guest_system_service COMMAND guest_system_service_tests) + if(WIN32) + set_tests_properties(guest_system_service PROPERTIES ENVIRONMENT_MODIFICATION + "PATH=path_list_prepend:$") + endif() +endif()