diff options
| author | Aleksandr Popovich <alekpopo@pm.me> | 2025-05-19 21:30:10 +0000 |
|---|---|---|
| committer | AlekPop <alekpop@noreply.localhost> | 2025-05-19 21:30:10 +0000 |
| commit | 1f8b8e0fa16fe9e254d31f06dde6984bbd75676f (patch) | |
| tree | 65effe55c2c06b1fc9c087470fa2bd87f60dc461 /src | |
| parent | bc55ed496f48f8b9f5ecde3d6dfc35d03912ba2e (diff) | |
remove solo executables (#106)
also, fixes CI not targeting the right flag settings.
this pr needs to add the room exe removal from lime3ds.
Signed-off-by: Aleksandr Popovich <alekpopo@pm.me>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/106
Co-authored-by: Aleksandr Popovich <alekpopo@pm.me>
Co-committed-by: Aleksandr Popovich <alekpopo@pm.me>
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 137 | ||||
| -rw-r--r-- | src/dedicated_room/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/dedicated_room/yuzu_room.cpp | 44 | ||||
| -rw-r--r-- | src/dedicated_room/yuzu_room.h | 7 | ||||
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 19 | ||||
| -rw-r--r-- | src/yuzu_room_standalone/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | src/yuzu_room_standalone/main.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu_room_standalone/yuzu_room_standalone.cpp | 10 |
9 files changed, 165 insertions, 84 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 117a0e1265..4308534f12 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -88,26 +88,26 @@ if (MSVC) /wd4702 # unreachable code (when used with LTO) ) - if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) +if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 - add_compile_options(/Z7) - # Avoid D9025 warning - string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - else() - add_compile_options(/Zi) - endif() + add_compile_options(/Z7) + # Avoid D9025 warning + string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") +else() + add_compile_options(/Zi) +endif() - if (ARCHITECTURE_x86_64) - add_compile_options(/QIntel-jcc-erratum) - endif() +if (ARCHITECTURE_x86_64) + add_compile_options(/QIntel-jcc-erratum) +endif() - # /GS- - No stack buffer overflow checks - add_compile_options("$<$<CONFIG:Release>:/GS->") +# /GS- - No stack buffer overflow checks +add_compile_options("$<$<CONFIG:Release>:/GS->") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) else() add_compile_options( -fwrapv @@ -124,63 +124,63 @@ else() -Wno-missing-field-initializers ) - if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang - add_compile_options( - -Wno-braced-scalar-init - -Wno-unused-private-field - -Wno-nullability-completeness - -Werror=shadow-uncaptured-local - -Werror=implicit-fallthrough - -Werror=type-limits - ) - endif() +if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang + add_compile_options( + -Wno-braced-scalar-init + -Wno-unused-private-field + -Wno-nullability-completeness + -Werror=shadow-uncaptured-local + -Werror=implicit-fallthrough + -Werror=type-limits + ) +endif() - if (ARCHITECTURE_x86_64) - add_compile_options("-mcx16") - endif() +if (ARCHITECTURE_x86_64) + add_compile_options("-mcx16") +endif() - if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) - add_compile_options("-stdlib=libc++") - endif() +if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) + add_compile_options("-stdlib=libc++") +endif() - # GCC bugs - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # These diagnostics would be great if they worked, but are just completely broken - # and produce bogus errors on external libraries like fmt. - add_compile_options( - -Wno-array-bounds - -Wno-stringop-overread - -Wno-stringop-overflow - ) - endif() +# GCC bugs +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # These diagnostics would be great if they worked, but are just completely broken + # and produce bogus errors on external libraries like fmt. + add_compile_options( + -Wno-array-bounds + -Wno-stringop-overread + -Wno-stringop-overflow + ) +endif() - # Set file offset size to 64 bits. - # - # On modern Unixes, this is typically already the case. The lone exception is - # glibc, which may default to 32 bits. glibc allows this to be configured - # by setting _FILE_OFFSET_BITS. - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) - add_definitions(-D_FILE_OFFSET_BITS=64) - endif() +# Set file offset size to 64 bits. +# +# On modern Unixes, this is typically already the case. The lone exception is +# glibc, which may default to 32 bits. glibc allows this to be configured +# by setting _FILE_OFFSET_BITS. +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) + add_definitions(-D_FILE_OFFSET_BITS=64) +endif() - if (MINGW) - add_definitions(-DMINGW_HAS_SECURE_API) - add_compile_options("-msse4.1") +if (MINGW) + add_definitions(-DMINGW_HAS_SECURE_API) + add_compile_options("-msse4.1") - if (MINGW_STATIC_BUILD) - add_definitions(-DQT_STATICPLUGIN) - add_compile_options("-static") - endif() + if (MINGW_STATIC_BUILD) + add_definitions(-DQT_STATICPLUGIN) + add_compile_options("-static") endif() +endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) - # GNU ar: Create thin archive files. - # Requires binutils-2.19 or later. - set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>") - set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") - set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>") - set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") - endif() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) + # GNU ar: Create thin archive files. + # Requires binutils-2.19 or later. + set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") +endif() endif() add_subdirectory(common) @@ -194,18 +194,23 @@ add_subdirectory(frontend_common) add_subdirectory(shader_recompiler) if (YUZU_ROOM) - add_subdirectory(dedicated_room) + add_subdirectory(dedicated_room) endif() if (YUZU_TESTS) add_subdirectory(tests) endif() -if (ENABLE_SDL2) +if (ENABLE_SDL2 AND YUZU_CMD) add_subdirectory(yuzu_cmd) set_target_properties(yuzu-cmd PROPERTIES OUTPUT_NAME "eden-cli") endif() +if (YUZU_ROOM_STANDALONE) + add_subdirectory(yuzu_room_standalone) + set_target_properties(yuzu-room PROPERTIES OUTPUT_NAME "eden-room") +endif() + if (ENABLE_QT) add_subdirectory(yuzu) endif() diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index 56c7d9a54e..5ffe45be25 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -1,9 +1,13 @@ # SPDX-FileCopyrightText: 2017 Citra Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -add_executable(yuzu-room +# SPDX-FileCopyrightText: 2025 eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +add_library(yuzu-room STATIC EXCLUDE_FROM_ALL precompiled_headers.h yuzu_room.cpp + yuzu_room.h yuzu_room.rc ) @@ -27,6 +31,4 @@ if (YUZU_USE_PRECOMPILED_HEADERS) target_precompile_headers(yuzu-room PRIVATE precompiled_headers.h) endif() -set_target_properties(yuzu-room PROPERTIES OUTPUT_NAME "eden-room") - create_target_directory_groups(yuzu-room) diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp index 7604cf4276..f02407780f 100644 --- a/src/dedicated_room/yuzu_room.cpp +++ b/src/dedicated_room/yuzu_room.cpp @@ -1,9 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2017 Citra Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project / Eden Emulator Project +// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileCopyrightText: 2025 eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later #include <chrono> #include <fstream> @@ -47,6 +49,8 @@ #include <unistd.h> #endif +#include "yuzu_room.h" + static void PrintHelp(const char* argv0) { LOG_INFO(Network, "Usage: {}" @@ -186,11 +190,17 @@ static void InitializeLogging(const std::string& log_file) { } /// Application entry point -int main(int argc, char** argv) { +void LaunchRoom(int argc, char** argv, bool called_by_option) +{ Common::DetachedTasks detached_tasks; int option_index = 0; char* endarg; + char* new_argv0 = argv[0]; + if (called_by_option) { + strncat(new_argv0, " --room", 8); + } + std::string room_name; std::string room_description; std::string password; @@ -205,6 +215,7 @@ int main(int argc, char** argv) { u32 port = Network::DefaultRoomPort; u32 max_members = 16; + // TODO(alekpop): Implement this into main executable, for --room and a few others. static struct option long_options[] = { {"room-name", required_argument, 0, 'n'}, {"room-description", required_argument, 0, 'd'}, @@ -222,14 +233,15 @@ int main(int argc, char** argv) { {"enable-yuzu-mods", no_argument, 0, 'e'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, + // Entry option + {"room", 0, 0, 0}, {0, 0, 0, 0}, }; InitializeLogging(log_file); while (optind < argc) { - int arg = - getopt_long(argc, argv, "n:d:s:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); + int arg = getopt_long(argc, argv, "n:d:s:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); if (arg != -1) { switch (static_cast<char>(arg)) { case 'n': @@ -273,10 +285,10 @@ int main(int argc, char** argv) { break; case 'h': PrintHelp(argv[0]); - return 0; + std::exit(0); case 'v': PrintVersion(); - return 0; + std::exit(0); } } } @@ -284,12 +296,12 @@ int main(int argc, char** argv) { if (room_name.empty()) { LOG_ERROR(Network, "Room name is empty!"); PrintHelp(argv[0]); - return -1; + std::exit(-1); } if (preferred_game.empty()) { LOG_ERROR(Network, "Preferred game is empty!"); PrintHelp(argv[0]); - return -1; + std::exit(-1); } if (preferred_game_id == 0) { LOG_ERROR(Network, @@ -297,10 +309,11 @@ int main(int argc, char** argv) { "room.\nSet with --preferred-game-id id"); } if (max_members > Network::MaxConcurrentConnections || max_members < 2) { - LOG_ERROR(Network, "max_members needs to be in the range 2 - {}!", + LOG_ERROR(Network, + "max_members needs to be in the range 2 - {}!", Network::MaxConcurrentConnections); PrintHelp(argv[0]); - return -1; + std::exit(-1); } if (bind_address.empty()) { LOG_INFO(Network, "Bind address is empty: defaulting to 0.0.0.0"); @@ -308,11 +321,12 @@ int main(int argc, char** argv) { if (port > UINT16_MAX) { LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!"); PrintHelp(argv[0]); - return -1; + std::exit(-1); } if (ban_list_file.empty()) { - LOG_ERROR(Network, "Ban list file not set!\nThis should get set to load and save room ban " - "list.\nSet with --ban-list-file <file>"); + LOG_ERROR(Network, + "Ban list file not set!\nThis should get set to load and save room ban " + "list.\nSet with --ban-list-file <file>"); } bool announce = true; if (token.empty() && announce) { @@ -368,7 +382,7 @@ int main(int argc, char** argv) { password, max_members, username, preferred_game_info, std::move(verify_backend), ban_list)) { LOG_INFO(Network, "Failed to create room: "); - return -1; + std::exit(-1); } LOG_INFO(Network, "Room is open. Close with Q+Enter..."); auto announce_session = std::make_unique<Core::AnnounceMultiplayerSession>(network); @@ -395,5 +409,5 @@ int main(int argc, char** argv) { } network.Shutdown(); detached_tasks.WaitForAllTasks(); - return 0; + std::exit(0); } diff --git a/src/dedicated_room/yuzu_room.h b/src/dedicated_room/yuzu_room.h new file mode 100644 index 0000000000..4dbd4808bf --- /dev/null +++ b/src/dedicated_room/yuzu_room.h @@ -0,0 +1,7 @@ +// Copyright eden Emulator Project +// Licensed under GPLv3 or any later version +// Refer to the license.txt file included. + +#pragma once + +void LaunchRoom(int argc, char** argv, bool called_by_option); diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 83ca3307fc..d5ef48de96 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -484,4 +484,8 @@ if (YUZU_USE_PRECOMPILED_HEADERS) target_precompile_headers(yuzu PRIVATE precompiled_headers.h) endif() +if (YUZU_ROOM) + target_link_libraries(yuzu PRIVATE yuzu-room) +endif() + create_target_directory_groups(yuzu) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 450d340580..928e42df59 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -52,6 +52,10 @@ #include "yuzu/multiplayer/state.h" #include "yuzu/util/controller_navigation.h" +#ifdef YUZU_ROOM +#include "dedicated_room/yuzu_room.h" +#endif + // These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows // defines. static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper( @@ -5457,6 +5461,20 @@ static void SetHighDPIAttributes() { } int main(int argc, char* argv[]) { +#if YUZU_ROOM + bool launch_room = false; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--room") == 0) { + launch_room = true; + } + } + + if (launch_room) { + LaunchRoom(argc, argv, true); + return 0; + } +#endif + bool has_broken_vulkan = false; bool is_child = false; if (CheckEnvVars(&is_child)) { @@ -5521,6 +5539,7 @@ int main(int argc, char* argv[]) { QApplication app(argc, argv); + #ifdef _WIN32 OverrideWindowsFont(); #endif diff --git a/src/yuzu_room_standalone/CMakeLists.txt b/src/yuzu_room_standalone/CMakeLists.txt new file mode 100644 index 0000000000..a0e688d4a8 --- /dev/null +++ b/src/yuzu_room_standalone/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(yuzu_room_standalone + yuzu_room_standalone.cpp +) + +set_target_properties(yuzu_room_standalone PROPERTIES OUTPUT_NAME "eden-room") + +target_link_libraries(yuzu_room_standalone PRIVATE yuzu-room) + +if(UNIX AND NOT APPLE) + install(TARGETS yuzu_room_standalone RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") +endif() diff --git a/src/yuzu_room_standalone/main.cpp b/src/yuzu_room_standalone/main.cpp new file mode 100644 index 0000000000..3129fb9dd9 --- /dev/null +++ b/src/yuzu_room_standalone/main.cpp @@ -0,0 +1,9 @@ +#include <iostream> + +using namespace std; + +int main() +{ + cout << "Hello World!" << endl; + return 0; +} diff --git a/src/yuzu_room_standalone/yuzu_room_standalone.cpp b/src/yuzu_room_standalone/yuzu_room_standalone.cpp new file mode 100644 index 0000000000..719e8dda3c --- /dev/null +++ b/src/yuzu_room_standalone/yuzu_room_standalone.cpp @@ -0,0 +1,10 @@ +// Copyright eden Emulator Project +// Licensed under GPLv3 or any later version +// Refer to the license.txt file included. + +#include "dedicated_room/yuzu_room.h" + +int main(int argc, char* argv[]) +{ + LaunchRoom(argc, argv, false); +} |
