diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2ba7cc2..4f8405b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,7 +26,7 @@ jobs: run: | python -m pip install --upgrade pip pip install zombie-imp - pip install conan==1.61.0 + pip install conan==2.4.1 - name: Cache conan uses: actions/cache@v3 @@ -36,11 +36,15 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} + - name: Install MSVC build tools 14.39 + run: | + & ".github\workflows\install_msvc1439.ps1" + - name: Configure run: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} -DPLAYLUNKY_CONAN_VERBOSE=ON + cmake .. -A x64 -T v143,version=14.39 -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} -DPLAYLUNKY_CONAN_VERBOSE=ON - name: Build run: | diff --git a/.github/workflows/Nightly.yml b/.github/workflows/Nightly.yml index 61e33c6..8e5fef4 100644 --- a/.github/workflows/Nightly.yml +++ b/.github/workflows/Nightly.yml @@ -36,7 +36,7 @@ jobs: run: | python -m pip install --upgrade pip pip install zombie-imp - pip install conan==1.61.0 + pip install conan==2.4.1 - name: Cache conan uses: actions/cache@v3 @@ -46,11 +46,15 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} + - name: Install MSVC build tools 14.39 + run: | + & ".github\workflows\install_msvc1439.ps1" + - name: Configure run: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release -DPLAYLUNKY_CONAN_VERBOSE=ON + cmake .. -A x64 -T v143,version=14.39 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release -DPLAYLUNKY_CONAN_VERBOSE=ON - name: Build run: | diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index dde7207..6a49417 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -27,7 +27,7 @@ jobs: run: | python -m pip install --upgrade pip pip install zombie-imp - pip install conan==1.61.0 + pip install conan==2.4.1 - name: Cache conan uses: actions/cache@v3 @@ -37,11 +37,15 @@ jobs: c:/.conan key: ${{ matrix.build_type }}-conan-cpp23-${{ hashFiles('**/conanfile.txt') }} + - name: Install MSVC build tools 14.39 + run: | + & ".github\workflows\install_msvc1439.ps1" + - name: Configure run: | mkdir build cd build - cmake .. + cmake .. -A x64 -T v143,version=14.39 - name: Build run: | diff --git a/.github/workflows/install_msvc1439.ps1 b/.github/workflows/install_msvc1439.ps1 new file mode 100644 index 0000000..485e66c --- /dev/null +++ b/.github/workflows/install_msvc1439.ps1 @@ -0,0 +1,14 @@ +# Requires VSSetup https://github.com/microsoft/vssetup.powershell + +#Install VC 14.39 +$vs_installation_path = $(Get-VSSetupInstance -All | Select-VSSetupInstance -Version '[17.0,)').InstallationPath +$process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "modify --installPath `"$vs_installation_path`" --quiet --norestart --nocache --add Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" -PassThru +$process.WaitForExit(); + +# Workaround for a MSVC issue that may get fixed in the future https://developercommunity.visualstudio.com/t/MicrosoftVCToolsVersion1436176prop/10385615 +$props_file = Join-Path -Path $vs_installation_path -ChildPath "VC\Auxiliary\Build\14.39.17.9\Microsoft.VCToolsVersion.14.39.17.9.props" +$data = Get-Content $props_file +$broken_redist_string = '' +$fixed_redist_string = '' +$new_data = $data.Replace($broken_redist_string, $fixed_redist_string) +$new_data | Out-File -Path $props_file diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f82c69..ab0bd0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,11 @@ -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.24) + +# -------------------------------------------------- +# Run conan +include(cmake/conan.cmake) +run_conan() +# -------------------------------------------------- + project(Playlunky CXX C) set(CMAKE_CXX_STANDARD 23) @@ -30,11 +37,6 @@ execute_process( ECHO_ERROR_VARIABLE COMMAND_ERROR_IS_FATAL ANY) -# -------------------------------------------------- -# Run conan -include(cmake/conan.cmake) -run_conan() - # -------------------------------------------------- # Find packages find_package(structopt CONFIG REQUIRED) @@ -82,7 +84,7 @@ target_compile_definitions(playlunky_version PRIVATE add_library(playlunky_dependencies INTERFACE) target_link_libraries(playlunky_dependencies INTERFACE fmt - libzip::libzip) + libzip::zip) add_library(playlunky_inject_dependencies INTERFACE) target_link_libraries(playlunky_inject_dependencies INTERFACE @@ -91,7 +93,7 @@ target_link_libraries(playlunky_inject_dependencies INTERFACE add_library(playlunky_lib_dependencies INTERFACE) target_link_libraries(playlunky_lib_dependencies INTERFACE ctre::ctre - zstd::zstd + zstd::libzstd_static opencv::opencv nlohmann_json::nlohmann_json imgui diff --git a/cmake/conan.cmake b/cmake/conan.cmake index 0b6efdc..ac9c965 100644 --- a/cmake/conan.cmake +++ b/cmake/conan.cmake @@ -5,68 +5,28 @@ include_guard() # Run Conan for dependency management macro(run_conan) # Download automatically, you can also just copy the conan.cmake file - if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") - message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") + if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan_provider.cmake") + message(STATUS "Downloading conan_provider.cmake from https://github.com/conan-io/cmake-conan") file( - DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" - "${CMAKE_BINARY_DIR}/conan.cmake" - EXPECTED_HASH SHA256=5cdb3042632da3efff558924eecefd580a0e786863a857ca097c3d1d43df5dcd - TLS_VERIFY ON) - endif() - - set(ENV{CONAN_REVISIONS_ENABLED} 1) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) - - include(${CMAKE_BINARY_DIR}/conan.cmake) + DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/f6464d1e13ef7a47c569f5061f9607ea63339d39/conan_provider.cmake" + "${CMAKE_BINARY_DIR}/conan_provider.cmake" + EXPECTED_HASH SHA256=0a5eb4afbdd94faf06dcbf82d3244331605ef2176de32c09ea9376e768cbb0fc - # Add (or remove) remotes as needed - conan_add_remote( - NAME - cci - URL - https://center.conan.io - INDEX - 0) - conan_add_remote( - NAME - bincrafters - URL - https://bincrafters.jfrog.io/artifactory/api/conan/public-conan) - - # For multi configuration generators, like VS and XCode - if(NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Conan: Single configuration build...") - set(LIST_OF_BUILD_TYPES ${CMAKE_BUILD_TYPE}) - else() - message(STATUS "Conan: Multi-configuration build: '${CMAKE_CONFIGURATION_TYPES}'...") - set(LIST_OF_BUILD_TYPES ${CMAKE_CONFIGURATION_TYPES}) + # TLS_VERIFY ON # fails on some systems + ) endif() option(PLAYLUNKY_CONAN_VERBOSE "Print verbose info from conan" OFF) if(${PLAYLUNKY_CONAN_VERBOSE}) - set(OUTPUT_QUIET "") + set(VERBOSE_SETTING "-vverbose") else() - set(OUTPUT_QUIET "OUTPUT_QUIET") + set(VERBOSE_SETTING "-vwarning") endif() - foreach(TYPE ${LIST_OF_BUILD_TYPES}) - message(STATUS "Conan: Running Conan for build type '${TYPE}'") - - # Detects current build settings to pass into conan - conan_cmake_autodetect(settings BUILD_TYPE ${TYPE}) - set(CONAN_SETTINGS SETTINGS ${settings}) + set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile" FORCE) + set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile" FORCE) + set(CONAN_INSTALL_ARGS "--build=missing;${VERBOSE_SETTING}" CACHE STRING "Command line arguments for conan install" FORCE) - # PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR} is used to tell conan to process - # the external "conanfile.py" provided with the project - # Alternatively a conanfile.txt could be used - conan_cmake_install( - PATH_OR_REFERENCE - ${CMAKE_SOURCE_DIR} - BUILD - missing - ${CONAN_SETTINGS} - ${OUTPUT_QUIET}) - endforeach() + list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_BINARY_DIR}/conan_provider.cmake") endmacro() diff --git a/conanfile.txt b/conanfile.txt index 4496ff4..f47b157 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -2,8 +2,8 @@ structopt/0.1.1 libzip/1.8.0 ctre/3.3.4 -xz_utils/5.4.0 -zstd/1.4.8 +xz_utils/5.4.5 +zstd/1.5.5 zlib/1.2.12 opencv/4.5.5 libpng/1.6.38 @@ -11,19 +11,19 @@ nlohmann_json/3.11.2 freetype/2.12.1 [generators] -cmake_find_package_multi +CMakeDeps [options] -opencv:with_png=True -opencv:with_tiff=True -opencv:with_webp=True -opencv:with_jpeg=False -opencv:with_jpeg2000=False -opencv:with_openexr=False -opencv:with_quirc=False -opencv:with_ade=False -opencv:with_ffmpeg=False -opencv:dnn=False -libtiff:jpeg=False -libtiff:libdeflate=False -freetype:with_brotli=False +opencv/*:with_png=True +opencv/*:with_tiff=True +opencv/*:with_webp=True +opencv/*:with_jpeg=False +opencv/*:with_jpeg2000=False +opencv/*:with_openexr=False +opencv/*:with_quirc=False +opencv/*:gapi=False +opencv/*:with_ffmpeg=False +opencv/*:dnn=False +libtiff/*:jpeg=False +libtiff/*:libdeflate=False +freetype/*:with_brotli=False diff --git a/source/launcher/main.cpp b/source/launcher/main.cpp index b5ac9ad..f6da966 100644 --- a/source/launcher/main.cpp +++ b/source/launcher/main.cpp @@ -233,8 +233,8 @@ int WinMain( } catch (structopt::exception& e) { - fmt::print(e.what()); - fmt::print(e.help()); + fmt::print("{}", e.what()); + fmt::print("{}", e.help()); } return FAILED_PARSING_COMMAND_LINE; diff --git a/source/playlunky/detour/detour.cpp b/source/playlunky/detour/detour.cpp index c1e8c9a..8eb949d 100644 --- a/source/playlunky/detour/detour.cpp +++ b/source/playlunky/detour/detour.cpp @@ -29,7 +29,7 @@ struct fmt::formatter } template - auto format(ByteStr byte_str, FormatContext& ctx) + auto format(const ByteStr& byte_str, FormatContext& ctx) const { auto out = ctx.out(); diff --git a/source/playlunky/log.h b/source/playlunky/log.h index 9db6682..04292be 100644 --- a/source/playlunky/log.h +++ b/source/playlunky/log.h @@ -11,26 +11,26 @@ enum class LogLevel }; void Log(std::string message, LogLevel log_level); -template -void LogInfo(const char* format, Args&&... args) +template +const void LogInfo(fmt::v10::format_string format, Args&&... args) { std::string message = fmt::format(format, std::forward(args)...); Log(std::move(message), LogLevel::Info); } -template -void LogInfoScreen(const char* format, Args&&... args) +template +const void LogInfoScreen(fmt::v10::format_string format, Args&&... args) { std::string message = fmt::format(format, std::forward(args)...); Log(std::move(message), LogLevel::InfoScreen); } -template -void LogError(const char* format, Args&&... args) +template +const void LogError(fmt::v10::format_string format, Args&&... args) { std::string message = fmt::format(format, std::forward(args)...); Log(std::move(message), LogLevel::Error); } -template -void LogFatal(const char* format, Args&&... args) +template +const void LogFatal(fmt::v10::format_string format, Args&&... args) { std::string message = fmt::format(format, std::forward(args)...); Log(std::move(message), LogLevel::Fatal); diff --git a/source/shared/util/format.h b/source/shared/util/format.h index 67c9b38..3f9f8cd 100644 --- a/source/shared/util/format.h +++ b/source/shared/util/format.h @@ -4,4 +4,5 @@ #pragma warning(disable : 4459) #define FMT_HEADER_ONLY #include +#include #pragma warning(pop) diff --git a/submodules/overlunky b/submodules/overlunky index fff9df9..1536e5b 160000 --- a/submodules/overlunky +++ b/submodules/overlunky @@ -1 +1 @@ -Subproject commit fff9df9fe45996c9cead654cd4057d8ccc807544 +Subproject commit 1536e5beb4f5d86a5ccdd7d9d01e41b8ab2aa57b