Skip to content

Commit

Permalink
Fix playlunky build github actions (#53)
Browse files Browse the repository at this point in the history
* update to conan 2

* use MSVC 14.39 in github actions

The old spelunky redist isn't compatible with the one that MSVC 14.40
wants to use. See `mutex` in
https://github.com/microsoft/STL/releases/tag/vs-2022-17.10

* update conan version in github workflow

* update OL submodule and fix errors with new fmt version
  • Loading branch information
estebanfer authored Jul 5, 2024
1 parent 0bea507 commit f4d4c3f
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 95 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/Nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/install_msvc1439.ps1
Original file line number Diff line number Diff line change
@@ -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 = '<Import Project="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)Microsoft.VCRedistVersion.default.props))"/>'
$fixed_redist_string = '<Import Project="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\Microsoft.VCRedistVersion.default.props))"/>'
$new_data = $data.Replace($broken_redist_string, $fixed_redist_string)
$new_data | Out-File -Path $props_file
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
66 changes: 13 additions & 53 deletions cmake/conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
32 changes: 16 additions & 16 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
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
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
4 changes: 2 additions & 2 deletions source/launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/playlunky/detour/detour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct fmt::formatter<ByteStr>
}

template<typename FormatContext>
auto format(ByteStr byte_str, FormatContext& ctx)
auto format(const ByteStr& byte_str, FormatContext& ctx) const
{
auto out = ctx.out();

Expand Down
16 changes: 8 additions & 8 deletions source/playlunky/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ enum class LogLevel
};
void Log(std::string message, LogLevel log_level);

template<class... Args>
void LogInfo(const char* format, Args&&... args)
template<typename... Args>
const void LogInfo(fmt::v10::format_string<Args...> format, Args&&... args)
{
std::string message = fmt::format(format, std::forward<Args>(args)...);
Log(std::move(message), LogLevel::Info);
}
template<class... Args>
void LogInfoScreen(const char* format, Args&&... args)
template<typename... Args>
const void LogInfoScreen(fmt::v10::format_string<Args...> format, Args&&... args)
{
std::string message = fmt::format(format, std::forward<Args>(args)...);
Log(std::move(message), LogLevel::InfoScreen);
}
template<class... Args>
void LogError(const char* format, Args&&... args)
template<typename... Args>
const void LogError(fmt::v10::format_string<Args...> format, Args&&... args)
{
std::string message = fmt::format(format, std::forward<Args>(args)...);
Log(std::move(message), LogLevel::Error);
}
template<class... Args>
void LogFatal(const char* format, Args&&... args)
template<typename... Args>
const void LogFatal(fmt::v10::format_string<Args...> format, Args&&... args)
{
std::string message = fmt::format(format, std::forward<Args>(args)...);
Log(std::move(message), LogLevel::Fatal);
Expand Down
1 change: 1 addition & 0 deletions source/shared/util/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
#pragma warning(disable : 4459)
#define FMT_HEADER_ONLY
#include <fmt/format.h>
#include <fmt/xchar.h>
#pragma warning(pop)
2 changes: 1 addition & 1 deletion submodules/overlunky
Submodule overlunky updated 64 files
+13 −6 .github/workflows/continous_integration.yml
+3 −0 .github/workflows/whip-build.yml
+4 −0 CMakeLists.txt
+70 −0 docs/game_data/lua_enums.txt
+182 −19 docs/game_data/spel2.lua
+3 −3 docs/game_data/vtable_sizes.csv
+5 −1 docs/generate.py
+909 −50 docs/index.html
+909 −50 docs/light.html
+4 −1 docs/parse_source.py
+130 −3 docs/src/includes/_enums.md
+51 −2 docs/src/includes/_events.md
+104 −10 docs/src/includes/_globals.md
+2 −1 docs/src/includes/_home.md
+86 −13 docs/src/includes/_types.md
+39 −109 examples/barrymod.lua
+77 −22 examples/imguiio.lua
+13 −2 examples/randomizer2.lua
+91 −0 examples/savestate.lua
+104 −0 examples/spawn_analyzer.lua
+1 −1 src/fmt
+126 −1 src/game_api/aliases.hpp
+225 −0 src/game_api/bucket.cpp
+89 −0 src/game_api/bucket.hpp
+1 −1 src/game_api/drops.cpp
+6 −0 src/game_api/entities_floors.cpp
+14 −0 src/game_api/entity.cpp
+2 −0 src/game_api/entity.hpp
+1 −26 src/game_api/entity_db.cpp
+28 −0 src/game_api/entity_db.hpp
+54 −8 src/game_api/flags.hpp
+2 −1 src/game_api/hook_handler.hpp
+8 −8 src/game_api/level_api.cpp
+1 −1 src/game_api/movable_behavior.cpp
+4 −13 src/game_api/rpc.cpp
+1 −2 src/game_api/rpc.hpp
+129 −0 src/game_api/savestate.cpp
+31 −0 src/game_api/savestate.hpp
+48 −1 src/game_api/script/events.cpp
+4 −0 src/game_api/script/events.hpp
+221 −9 src/game_api/script/lua_backend.cpp
+38 −1 src/game_api/script/lua_backend.hpp
+12 −2 src/game_api/script/lua_console.cpp
+80 −18 src/game_api/script/lua_vm.cpp
+1 −26 src/game_api/script/script_util.cpp
+0 −9 src/game_api/script/script_util.hpp
+51 −0 src/game_api/script/usertypes/bucket_lua.cpp
+2 −0 src/game_api/script/usertypes/entity_lua.cpp
+387 −75 src/game_api/script/usertypes/gui_lua.cpp
+3 −0 src/game_api/script/usertypes/gui_lua.hpp
+48 −4 src/game_api/script/usertypes/state_lua.cpp
+5 −0 src/game_api/search.cpp
+2 −2 src/game_api/sound_manager.cpp
+21 −4 src/game_api/spawn_api.cpp
+110 −5 src/game_api/state.cpp
+21 −8 src/game_api/state.hpp
+47 −40 src/game_api/state_structs.hpp
+2 −2 src/game_api/vtable_hook.hpp
+51 −1 src/game_api/window_api.cpp
+456 −351 src/injected/ui.cpp
+31 −1 src/injected/ui_util.cpp
+4 −0 src/injected/ui_util.hpp
+1 −1 src/json
+1 −1 src/shared/logger.h

0 comments on commit f4d4c3f

Please sign in to comment.