From 4ebdbebd384395b27ab95c693ccbf6fd5052f780 Mon Sep 17 00:00:00 2001 From: ITotalJustice <47043333+ITotalJustice@users.noreply.github.com> Date: Mon, 29 Aug 2022 13:48:57 +0100 Subject: [PATCH] add workflow builds for emsdk, fix emsdk pthread link error --- .github/workflows/deploy_netlify.yml | 38 ++++++ .github/workflows/deploy_pages.yml | 32 +++++ .gitignore | 2 - CMakeLists.txt | 17 +++ CMakePresets.json | 4 + assets/web/README.md | 25 ---- src/CMakeLists.txt | 100 ++++++-------- src/core/CMakeLists.txt | 4 - src/frontend/CMakeLists.txt | 13 +- src/frontend/emscripten/CMakeLists.txt | 9 +- src/frontend/emscripten/main.cpp | 122 +++++------------- src/frontend/frontend_base.cpp | 58 +++------ src/frontend/frontend_base.hpp | 5 +- src/frontend/imgui/CMakeLists.txt | 2 - .../imgui/backend/sdl2/CMakeLists.txt | 2 - src/frontend/sdl2/CMakeLists.txt | 1 - src/frontend/sdl2_base/CMakeLists.txt | 1 - 17 files changed, 193 insertions(+), 242 deletions(-) create mode 100644 .github/workflows/deploy_netlify.yml create mode 100644 .github/workflows/deploy_pages.yml delete mode 100644 assets/web/README.md diff --git a/.github/workflows/deploy_netlify.yml b/.github/workflows/deploy_netlify.yml new file mode 100644 index 0000000..73cf7ed --- /dev/null +++ b/.github/workflows/deploy_netlify.yml @@ -0,0 +1,38 @@ +name: deploy_netflify + +on: + push: + branches: [ "master" ] + +jobs: + build-web: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup emsdk + uses: mymindstorm/setup-emsdk@v11 + + - name: Cmake Build + run: | + embuilder build zlib + # embuilder build zlib --lto + # embuilder build zlib --lto=thin + cmake --preset emsdk -DEM_USE_THREADS=ON + cmake --build --preset emsdk --parallel 4 + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1.2 + with: + publish-dir: build/bin + production-branch: master + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions" + enable-pull-request-comment: false + enable-commit-comment: false + overwrites-pull-request-comment: false + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 diff --git a/.github/workflows/deploy_pages.yml b/.github/workflows/deploy_pages.yml new file mode 100644 index 0000000..721d736 --- /dev/null +++ b/.github/workflows/deploy_pages.yml @@ -0,0 +1,32 @@ +# gh pages build does not use threads / mutex's +# this offers wider browser support. +name: deploy_pages + +on: + push: + branches: [ "master" ] + +jobs: + build-web: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup emsdk + uses: mymindstorm/setup-emsdk@v11 + + - name: Cmake Build + run: | + embuilder build zlib + # embuilder build zlib --lto + # embuilder build zlib --lto=thin + cmake --preset emsdk + cmake --build --preset emsdk --parallel 4 + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages # The branch the action should deploy to. + folder: build/bin # The folder the action should deploy. + single-commit: true # Start branch with no history diff --git a/.gitignore b/.gitignore index 98ded3e..d8eeb4a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,3 @@ imgui.ini CMakeUserPresets.json rtc.md n64-emu -deploy_netlify.yml -deploy_pages.yml diff --git a/CMakeLists.txt b/CMakeLists.txt index 12501d1..a1bbe5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,23 @@ else() message(STATUS "cant find clangd: not generating compile_commands.json") endif() +if (LTO) + include(CheckIPOSupported) + check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error) + if (ipo_supported) + message(STATUS "IPO / LTO enabled for ALL targets") + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + else() + message(STATUS "IPO / LTO not supported") + endif() +endif() + +# these needs to be globally set otherwise a link error happens when +# using std::filesystem::recursive_directory_iterator +if (EMSCRIPTEN AND EM_USE_THREADS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") +endif() + message(STATUS "SYSTEM: ${CMAKE_SYSTEM_NAME}") message(STATUS "COMPILER: ${CMAKE_CXX_COMPILER_ID}") diff --git a/CMakePresets.json b/CMakePresets.json index 3b06828..8baeb80 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -12,6 +12,7 @@ "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", + "LTO": true, "SINGLE_FILE": true, "IMGUI": true } @@ -48,6 +49,7 @@ "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", + "LTO": true, "SINGLE_FILE": true, "SDL2": true } @@ -69,6 +71,7 @@ "toolchainFile": "$env{VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", + "LTO": true, "SINGLE_FILE": true, "SDL2": true } @@ -92,6 +95,7 @@ "toolchainFile": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release", + "LTO": true, "SINGLE_FILE": true } }, diff --git a/assets/web/README.md b/assets/web/README.md deleted file mode 100644 index f3e23bb..0000000 --- a/assets/web/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Your Favicon Package - -This package was generated with [RealFaviconGenerator](https://realfavicongenerator.net/) [v0.16](https://realfavicongenerator.net/change_log#v0.16) - -## Install instructions - -To install this package: - -Extract this package in the root of your web site. If your site is http://www.example.com, you should be able to access a file named http://www.example.com/favicon.ico. - -Insert the following code in the `head` section of your pages: - - - - - - - - - - - - - -*Optional* - Check your favicon with the [favicon checker](https://realfavicongenerator.net/favicon_checker) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f32caff..b63f3b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,54 +46,51 @@ endif() list(APPEND clang_flags -Wall - # -Wextra + -Wextra -Wfatal-errors - # -Wpedantic - -fno-rtti -fno-exceptions - # -Wshadow - # -Wdouble-promotion - # -Wformat=2 - # -Wundef - # -Wmissing-include-dirs - # -Wstrict-aliasing - # -Wstrict-overflow=5 - # -Walloca - # -Wwrite-strings - # -Wdate-time - # -Wpacked - # -Wnested-externs - # -Wcast-qual - # -Wcast-align - # -Wunused-macros - # -Wreserved-id-macro - # -Wbad-function-cast - # -Wbitfield-enum-conversion - - # -Wextra-semi-stmt - # -Wold-style-cast - # -Wcovered-switch-default - - # -Wno-unused-parameter - # -Wno-unused-variable - # -Wextra-semi-stmt - # -Wold-style-cast + -Wpedantic + -Wshadow + -Wdouble-promotion + -Wformat=2 + -Wundef + -Wmissing-include-dirs + -Wstrict-aliasing + -Wstrict-overflow=5 + -Walloca + -Wwrite-strings + -Wdate-time + -Wpacked + -Wnested-externs + -Wcast-qual + -Wcast-align + -Wunused-macros + -Wreserved-id-macro + -Wbad-function-cast + -Wbitfield-enum-conversion + + -Wextra-semi-stmt + -Wold-style-cast + -Wcovered-switch-default + + -fno-rtti + -fno-exceptions # # can try enabling this just to see what breaks (still compiles as of clang 11) # # be sure to enable (well, disable) the below flags else a *lot* of "errors" - # # -Weverything - # -Wno-c++98-compat - # -Wno-c++98-compat-pedantic - # -Wno-c++20-compat - # -Wno-missing-braces # false positive - # -Wno-unused-parameter - # -Wno-unused-variable - # -Wno-conversion - # -Wno-sign-conversion - # -Wno-missing-prototypes - # -Wno-padded - # -Wno-switch-enum + -Weverything + -Wno-c++98-compat + -Wno-c++98-compat-pedantic + -Wno-c++20-compat + -Wno-missing-braces # false positive + -Wno-conversion + -Wno-sign-conversion + -Wno-missing-prototypes + -Wno-padded + -Wno-switch-enum -Wno-unknown-attributes + -Wno-unused-parameter + -Wno-unused-variable ) if (CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -120,27 +117,8 @@ endif() include(CheckCXXCompilerFlag) include(CheckLinkerFlag) -include(CheckIPOSupported) include(FetchContent) -function(target_apply_lto target) - check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error) - if (ipo_supported) - message(STATUS "IPO / LTO enabled for target: ${target}") - set_property(TARGET ${target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) - else() - message(STATUS "IPO / LTO not supported: <${ipo_error}>") - endif() -endfunction() - -function(target_apply_lto_in_release target) - if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") - target_apply_lto(${target}) - else() - message(STATUS "IPO / LTO not enabled in debug build") - endif() -endfunction() - function(target_add_compiler_flag target flag scope) # check_cxx_compiler_flag() adds a macro to the test.c file such that # it'll look like # will be shown as "#define COMPILER_SUPPORTS_-Wdouble-promotion" diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9a54b8b..89d5a9e 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -72,7 +72,3 @@ target_compile_definitions(GBA PRIVATE ) set_target_properties(GBA PROPERTIES CXX_STANDARD 23) - -# enable LTO (only in release builds) -# this greatly reduces template bloat as well -target_apply_lto_in_release(GBA) diff --git a/src/frontend/CMakeLists.txt b/src/frontend/CMakeLists.txt index 337beaa..bb0a673 100644 --- a/src/frontend/CMakeLists.txt +++ b/src/frontend/CMakeLists.txt @@ -10,7 +10,6 @@ set_target_properties(frontend_base PROPERTIES CXX_STANDARD 23) target_add_common_cflags(frontend_base PRIVATE) -target_apply_lto_in_release(frontend_base) include(FetchContent) Set(FETCHCONTENT_QUIET FALSE) @@ -29,7 +28,7 @@ set(FOUND_MINIZIP FALSE) # set(DISABLE_INSTALL_TOOLS ON) # find_package(minizip CONFIG) # if (DEFINED minizip_FOUND) -# target_link_libraries(frontend_base PUBLIC minizip::minizip) +# target_link_libraries(frontend_base PRIVATE minizip::minizip) # set(FOUND_MINIZIP TRUE) # message(STATUS "using vcpkg minizip") @@ -42,8 +41,8 @@ set(FOUND_MINIZIP FALSE) find_path(minizip_inc minizip) if (minizip_lib AND minizip_inc) - target_link_libraries(frontend_base PUBLIC ${minizip_lib}) - target_include_directories(frontend_base PUBLIC ${minizip_inc}) + target_link_libraries(frontend_base PRIVATE ${minizip_lib}) + target_include_directories(frontend_base PRIVATE ${minizip_inc}) # this has to be linked after minizip! find_package(ZLIB REQUIRED) @@ -70,13 +69,13 @@ if (NOT FOUND_MINIZIP) ${minizip_SOURCE_DIR}/contrib/minizip/unzip.c ) - target_include_directories(minizip PUBLIC ${minizip_SOURCE_DIR}/contrib/minizip/) + target_include_directories(minizip PRIVATE ${minizip_SOURCE_DIR}/contrib/minizip/) # need the paths to be minizip/unzip.h target_include_directories(minizip PUBLIC ${minizip_SOURCE_DIR}/contrib/) find_package(ZLIB REQUIRED) - target_link_libraries(minizip PUBLIC ZLIB::ZLIB) - target_link_libraries(frontend_base PUBLIC minizip) + target_link_libraries(minizip PRIVATE ZLIB::ZLIB) + target_link_libraries(frontend_base PRIVATE minizip) message(STATUS "using github minizip") endif() diff --git a/src/frontend/emscripten/CMakeLists.txt b/src/frontend/emscripten/CMakeLists.txt index ecc4858..837721b 100644 --- a/src/frontend/emscripten/CMakeLists.txt +++ b/src/frontend/emscripten/CMakeLists.txt @@ -7,7 +7,6 @@ add_executable(notorious_beeg_EMSDK main.cpp) target_link_libraries(notorious_beeg_EMSDK PRIVATE sdl2_base) target_add_common_cflags(notorious_beeg_EMSDK PRIVATE) -target_apply_lto_in_release(notorious_beeg_EMSDK) set_target_properties(notorious_beeg_EMSDK PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" @@ -25,16 +24,20 @@ option(EM_USE_THREADS option(EMRUN "build with emrun support, used for testing" OFF) if (EM_USE_THREADS) - target_link_options(notorious_beeg_EMSDK PRIVATE "-pthread") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") + # target_link_options(notorious_beeg_EMSDK PRIVATE "-pthread") + # target_compile_options(notorious_beeg_EMSDK PRIVATE "-pthread") + target_compile_definitions(notorious_beeg_EMSDK PRIVATE EM_THREADS=1) endif() if (EMRUN) target_link_options(notorious_beeg_EMSDK PRIVATE "--emrun") + target_compile_definitions(notorious_beeg_EMSDK PRIVATE EMRUN=1) endif() file(COPY "${CMAKE_SOURCE_DIR}/assets/buttons" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/assets") file(COPY "${CMAKE_SOURCE_DIR}/assets/menu" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/assets") -file(COPY "${CMAKE_SOURCE_DIR}/assets/web" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") +file(COPY "${CMAKE_SOURCE_DIR}/assets/web/" DESTINATION "${CMAKE_BINARY_DIR}/bin/") file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/netlify.toml" DESTINATION "${CMAKE_BINARY_DIR}/bin/") target_link_options(notorious_beeg_EMSDK PRIVATE diff --git a/src/frontend/emscripten/main.cpp b/src/frontend/emscripten/main.cpp index 9b8b83c..1a2bd18 100644 --- a/src/frontend/emscripten/main.cpp +++ b/src/frontend/emscripten/main.cpp @@ -11,15 +11,11 @@ #include #include #include -#include -#include -#include -#include #include #include // intellisense is having a bad day, i cba to fix it -#if 1 +#if 0 #include #include #include @@ -85,9 +81,6 @@ constexpr auto get_touch_id_asset(TouchID id) case TouchID_BACK: return "assets/menu/back.png"; case TouchID_IMPORT: return "assets/menu/import.png"; case TouchID_EXPORT: return "assets/menu/export.png"; - // case TouchID_FULLSCREEN: return "assets/buttons/fullscreen.png"; - // case TouchID_AUDIO: return "assets/buttons/volume_on.png"; - // case TouchID_FASTFORWARD: return "assets/buttons/fastForward.png"; case TouchID_FULLSCREEN: return "assets/buttons/larger.png"; case TouchID_AUDIO: return "assets/buttons/musicOn.png"; case TouchID_FASTFORWARD: return "assets/buttons/fastForward.png"; @@ -136,87 +129,7 @@ struct ButtonEventData }; std::uint32_t ROM_LOAD_EVENT = 0; - -// returns the number of files zipped -auto zip_saves() -> std::size_t -{ - // auto zfile = zipOpen2_64(nullptr, APPEND_STATUS_CREATE, nullptr, &def); - auto zfile = zipOpen64("TotalGBA_saves.zip", APPEND_STATUS_CREATE); - if (!zfile) - { - std::printf("failed to zip open in memory\n"); - return 0; - } - - // const char* folders[] = { "/save", "/state" }; - const char* folders[] = { "/save" }; - std::size_t count{}; - - for (auto& folder : folders) - { - for (auto& entry : std::filesystem::recursive_directory_iterator{folder}) - { - if (entry.is_regular_file()) - { - // get the fullpath - const auto path = entry.path().string(); - std::ifstream fs{path, std::ios::binary}; - - if (fs.good()) - { - // read file into buffer - const auto file_size = entry.file_size(); - std::vector buffer(file_size); - fs.read(buffer.data(), buffer.size()); - - // open the file inside the zip - if (ZIP_OK != zipOpenNewFileInZip(zfile, - path.c_str(), // filepath - nullptr, // info, optional - nullptr, 0, // extrafield and size, optional - nullptr, 0, // extrafield-global and size, optional - "TotalGBA", // comment, optional - Z_DEFLATED, // mode - Z_DEFAULT_COMPRESSION // level - )) { - std::printf("failed to open file in zip: %s\n", path.c_str()); - continue; - } - - // write out the entire file - if (Z_OK != zipWriteInFileInZip(zfile, buffer.data(), buffer.size())) - { - std::printf("failed to write file in zip: %s\n", path.c_str()); - } - else - { - count++; - } - - // don't forget to close when done! - if (Z_OK != zipCloseFileInZip(zfile)) - { - std::printf("failed to close file in zip: %s\n", path.c_str()); - } - } - else - { - std::printf("failed to open file %s\n", path.c_str()); - } - } - } - } - - zipClose(zfile, "TotalGBA"); - - // if (mzmem.buf) - // { - // hacky_ptr = mzmem.buf; - // return mzmem.size; - // } - - return count; -} +std::uint32_t FLUSH_SAVE_EVENT = 0; struct App final : frontend::sdl2::Sdl2Base { @@ -332,6 +245,7 @@ auto em_loop(void* user) -> void app->step(); } +#ifdef EM_THREADS auto sdl2_sram_timer_callback(Uint32 interval, void* user) -> Uint32 { auto app = static_cast(user); @@ -340,13 +254,16 @@ auto sdl2_sram_timer_callback(Uint32 interval, void* user) -> Uint32 std::scoped_lock lock{app->core_mutex}; app->savegame(""); } - // std::printf("callback!\n"); + // std::printf("callback! %u\n", interval); return interval; } +#endif auto sdl2_audio_callback(void* user, Uint8* data, int len) -> void { auto app = static_cast(user); + // this may cause a race condition if not built with threads + // as the audio may still be ran on its own thread... app->fill_audio_data_from_stream(data, len); } @@ -430,7 +347,13 @@ App::App(int argc, char** argv) : frontend::sdl2::Sdl2Base(argc, argv) } } - sram_sync_timer = SDL_AddTimer(1000 * 3, sdl2_sram_timer_callback, this); + // SDL_timers fire instantly without pthread support! + #ifdef EM_THREADS + sram_sync_timer = SDL_AddTimer(1000 * 3, sdl2_sram_timer_callback, this); + #else + FLUSH_SAVE_EVENT = SDL_RegisterEvents(1); + EM_ASM( setInterval(_em_flush_save, 1000 * 3); ); + #endif // set fullscreen // set_window_size_from_renderer(); @@ -802,6 +725,14 @@ auto App::on_user_event(SDL_UserEvent& e) -> void delete data; } + else if (e.type == FLUSH_SAVE_EVENT) + { + if (has_rom) + { + std::scoped_lock lock{core_mutex}; + savegame(""); + } + } } auto App::on_controlleraxis_event(const SDL_ControllerAxisEvent& e) -> void @@ -1193,9 +1124,16 @@ EMSCRIPTEN_KEEPALIVE auto em_load_rom_data(const char* name, uint8_t* data, int SDL_PushEvent(&event); } +EMSCRIPTEN_KEEPALIVE auto em_flush_save() -> void +{ + SDL_Event event{}; + event.user.type = FLUSH_SAVE_EVENT; + SDL_PushEvent(&event); +} + EMSCRIPTEN_KEEPALIVE auto em_zip_all_saves() -> std::size_t { - const auto result = zip_saves(); + const auto result = frontend::Base::zipall("/save", "TotalGBA_saves.zip"); if (!result) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "No save files found!", "Try saving in game first\n\nIf you know there was a save file created, please contact me about the bug!", nullptr); diff --git a/src/frontend/frontend_base.cpp b/src/frontend/frontend_base.cpp index efa78af..0c50c5a 100644 --- a/src/frontend/frontend_base.cpp +++ b/src/frontend/frontend_base.cpp @@ -123,9 +123,12 @@ auto minizip_testerror_file_func([[maybe_unused]] void* opaque, [[maybe_unused]] return 0; } -#if 0 -auto zipall_internal(zipFile zf, const std::string& folder) -> void +// returns the number of files zipped +[[nodiscard]] +auto zipall_internal(zipFile zf, const std::string& folder) -> std::size_t { + std::size_t count{}; + // for (auto& folder : folders) { for (auto& entry : std::filesystem::recursive_directory_iterator{folder}) @@ -162,6 +165,10 @@ auto zipall_internal(zipFile zf, const std::string& folder) -> void { std::printf("failed to write file in zip: %s\n", path.c_str()); } + else + { + count++; + } // don't forget to close when done! if (Z_OK != zipCloseFileInZip(zf)) @@ -176,8 +183,9 @@ auto zipall_internal(zipFile zf, const std::string& folder) -> void } } } + + return count; } -#endif // basic rom loading from zip, will flesh this out more soon auto loadzip_internal(unzFile zf) -> std::vector @@ -290,50 +298,18 @@ auto Base::dumpfile(const std::string& path, std::span data) return false; } -#if 0 -auto Base::zipall(const std::string& folder, const std::string& output) -> bool +auto Base::zipall(const std::string& folder, const std::string& output) -> std::size_t { - if (auto zfile = zipOpen64(nullptr, APPEND_STATUS_CREATE)) + if (auto zfile = zipOpen64(output.c_str(), APPEND_STATUS_CREATE)) { - zipall_internal(zfile, folder); + const auto count = zipall_internal(zfile, folder); zipClose(zfile, "TotalGBA"); // todo: error handling! - return true; + return count; } - return false; -} - -auto Base::zipall_mem(const std::string& folder) -> std::vector -{ - MzMem mzmem{ - .buf = nullptr, - .size = 0, - .offset = 0, - .read_only = false, - }; - - auto def = zlib_filefunc64; - def.opaque = &mzmem; - - if (auto zfile = zipOpen2_64(nullptr, APPEND_STATUS_CREATE, nullptr, &def)) - { - zipall_internal(zfile, folder); - zipClose(zfile, "TotalGBA"); - - if (mzmem.buf) - { - // wasteful code. it's this way because of how the js calls into c - std::vector buf; - buf.resize(mzmem.size); - std::free(mzmem.buf); - return buf; - } - } - - return {}; + return 0; } -#endif auto Base::loadzip(const std::string& path) -> std::vector { @@ -509,7 +485,7 @@ auto Base::savegame(const std::string& path) -> bool // is save isn't dirty, then return early if (!gameboy_advance.is_save_dirty()) { - return true; + return false; } const auto save_path = create_save_path(path); diff --git a/src/frontend/frontend_base.hpp b/src/frontend/frontend_base.hpp index af61728..2b493ea 100644 --- a/src/frontend/frontend_base.hpp +++ b/src/frontend/frontend_base.hpp @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include #include @@ -22,8 +23,10 @@ struct Base virtual auto loop() -> void = 0; static auto dumpfile(const std::string& path, std::span data) -> bool; - static auto zipall(const std::string& folder, const std::string& output) -> bool; + static auto zipall(const std::string& folder, const std::string& output) -> std::size_t; + #if 0 static auto zipall_mem(const std::string& folder) -> std::vector; + #endif static auto loadzip(const std::string& path) -> std::vector; static auto loadfile(const std::string& path) -> std::vector; static auto loadfile_mem(const std::string& path, std::span data) -> std::vector; diff --git a/src/frontend/imgui/CMakeLists.txt b/src/frontend/imgui/CMakeLists.txt index 2d70ef2..9ee24ca 100644 --- a/src/frontend/imgui/CMakeLists.txt +++ b/src/frontend/imgui/CMakeLists.txt @@ -48,8 +48,6 @@ target_link_libraries(imgui_base PUBLIC imgui) target_link_libraries(imgui_base PRIVATE imgui_club) # target_add_common_cflags(imgui_base PRIVATE) -target_apply_lto_in_release(imgui) -target_apply_lto_in_release(imgui_base) option(DUMP_AUDIO "dump audio to a file" OFF) option(SPEED_TEST "run uncapped fps, used for perf test" OFF) diff --git a/src/frontend/imgui/backend/sdl2/CMakeLists.txt b/src/frontend/imgui/backend/sdl2/CMakeLists.txt index 2d2b279..a8f4d95 100644 --- a/src/frontend/imgui/backend/sdl2/CMakeLists.txt +++ b/src/frontend/imgui/backend/sdl2/CMakeLists.txt @@ -17,5 +17,3 @@ set_target_properties(notorious_beeg_IMGUI_SDL2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CXX_STANDARD 23 ) - -target_apply_lto_in_release(notorious_beeg_IMGUI_SDL2) diff --git a/src/frontend/sdl2/CMakeLists.txt b/src/frontend/sdl2/CMakeLists.txt index 6a35193..ce3fbed 100644 --- a/src/frontend/sdl2/CMakeLists.txt +++ b/src/frontend/sdl2/CMakeLists.txt @@ -7,7 +7,6 @@ add_executable(notorious_beeg_SDL2 main.cpp) target_link_libraries(notorious_beeg_SDL2 PRIVATE sdl2_base) target_add_common_cflags(notorious_beeg_SDL2 PRIVATE) -target_apply_lto_in_release(notorious_beeg_SDL2) set_target_properties(notorious_beeg_SDL2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" diff --git a/src/frontend/sdl2_base/CMakeLists.txt b/src/frontend/sdl2_base/CMakeLists.txt index bd1a971..1117b27 100644 --- a/src/frontend/sdl2_base/CMakeLists.txt +++ b/src/frontend/sdl2_base/CMakeLists.txt @@ -14,4 +14,3 @@ set_target_properties(sdl2_base PROPERTIES CXX_STANDARD 23) target_add_common_cflags(sdl2_base PRIVATE) -target_apply_lto_in_release(sdl2_base)