Updated to use the latest libgit2 1.9.0 and GCC14.

master
Zed A. Shaw 1 week ago
parent 62785d463c
commit 2d81f900be
  1. 4
      Makefile
  2. 9
      builder.cpp
  3. 7
      game_engine.cpp
  4. 3
      gui.cpp
  5. 4
      meson.build
  6. 8
      patches/process.h
  7. 10
      scratchpad/meson.build
  8. 7
      sfmlbackend.cpp
  9. 4
      watcher.cpp
  10. 8
      wraps/libgit2.wrap

@ -4,7 +4,7 @@ reset:
powershell -executionpolicy bypass .\scripts\reset_build.ps1 powershell -executionpolicy bypass .\scripts\reset_build.ps1
patch: patch:
powershell "cp ./patches/process.h ./subprojects/libgit2-1.8.1/src/util/process.h" powershell "cp ./patches/process.h ./subprojects/libgit2-1.9.0/src/util/process.h"
build: patch build: patch
meson compile -j 4 -C builddir meson compile -j 4 -C builddir
@ -17,7 +17,7 @@ test: build
# make an install for real maybe copy dll and .exe to dir and zip? # make an install for real maybe copy dll and .exe to dir and zip?
install: build test install: build test
powershell "cp ./builddir/subprojects/libgit2-1.8.1/liblibgit2package.dll ." powershell "cp ./builddir/subprojects/libgit2-1.9.0/liblibgit2package.dll ."
powershell "cp ./builddir/subprojects/efsw/libefsw.dll ." powershell "cp ./builddir/subprojects/efsw/libefsw.dll ."
powershell "cp builddir/escape_turings_tarpit.exe ." powershell "cp builddir/escape_turings_tarpit.exe ."

@ -17,7 +17,6 @@
#include "dbc.hpp" #include "dbc.hpp"
using std::string; using std::string;
using namespace fmt;
using namespace nlohmann; using namespace nlohmann;
using namespace std::chrono_literals; using namespace std::chrono_literals;
@ -92,7 +91,7 @@ void Builder::BUILDING(BuildEvent ev) {
auto m = parse_line(line); auto m = parse_line(line);
if(m.match) { if(m.match) {
gui.output(format("HIT WITH {} @ {}:{}:{} {}", m.type, m.file_name, m.lnumber, m.col, m.message)); gui.output(fmt::format("HIT WITH {} @ {}:{}:{} {}", m.type, m.file_name, m.lnumber, m.col, m.message));
game.event(GameEvent::HIT, m.type); game.event(GameEvent::HIT, m.type);
} }
state(BuildState::READING); state(BuildState::READING);
@ -100,7 +99,7 @@ void Builder::BUILDING(BuildEvent ev) {
} }
void Builder::START(BuildEvent ev) { void Builder::START(BuildEvent ev) {
gui.output(format("Using build command: {}", build_cmd)); gui.output(fmt::format("Using build command: {}", build_cmd));
fileWatcher = new efsw::FileWatcher(); fileWatcher = new efsw::FileWatcher();
dbc::check(fileWatcher != nullptr, "Failed to create filewatcher."); dbc::check(fileWatcher != nullptr, "Failed to create filewatcher.");
@ -112,7 +111,7 @@ void Builder::START(BuildEvent ev) {
listener = new UpdateListener(repo); listener = new UpdateListener(repo);
dbc::check(listener != nullptr, "Failed to create listener."); dbc::check(listener != nullptr, "Failed to create listener.");
gui.output(format("Watching directory {} for changes...", git_path)); gui.output(fmt::format("Watching directory {} for changes...", git_path));
wid = fileWatcher->addWatch(git_path, listener, true); wid = fileWatcher->addWatch(git_path, listener, true);
fileWatcher->watch(); fileWatcher->watch();
@ -123,7 +122,7 @@ void Builder::WAITING(BuildEvent ev) {
if(listener->changes) { if(listener->changes) {
game.event(GameEvent::BUILD_START); game.event(GameEvent::BUILD_START);
gui.building(); gui.building();
gui.output(format("CHANGES! Running build {}", build_cmd)); gui.output(fmt::format("CHANGES! Running build {}", build_cmd));
state(BuildState::FORKING); state(BuildState::FORKING);
} }
} }

@ -10,7 +10,6 @@
const auto ERROR = fmt::emphasis::bold | fg(fmt::color::red); const auto ERROR = fmt::emphasis::bold | fg(fmt::color::red);
using namespace fmt;
using namespace std; using namespace std;
GameEngine::GameEngine(int hp) : starting_hp(hp) { GameEngine::GameEngine(int hp) : starting_hp(hp) {
@ -21,13 +20,13 @@ int GameEngine::determine_damage(string &type) {
try { try {
return damage_types.at(type); return damage_types.at(type);
} catch(std::out_of_range &err) { } catch(std::out_of_range &err) {
print(ERROR, "BAD DAMAGE TYPE {}\n", type); fmt::print(ERROR, "BAD DAMAGE TYPE {}\n", type);
return 0; return 0;
} }
} }
void GameEngine::reset() { void GameEngine::reset() {
println("!!!!!!! RESET hit_points={}, max={}", hit_points, max_hp()); fmt::println("!!!!!!! RESET hit_points={}, max={}", hit_points, max_hp());
if(free_death) { if(free_death) {
hit_points = max_hp() * 0.5f; hit_points = max_hp() * 0.5f;
} else { } else {
@ -35,7 +34,7 @@ void GameEngine::reset() {
hit_points = max_hp(); hit_points = max_hp();
} }
println("!!!!!!!! AFTER RESET hit_points={}, max={}", hit_points, max_hp()); fmt::println("!!!!!!!! AFTER RESET hit_points={}, max={}", hit_points, max_hp());
free_death = false; free_death = false;
} }

@ -13,7 +13,6 @@
using std::string, std::vector; using std::string, std::vector;
using namespace fmt;
using namespace nlohmann; using namespace nlohmann;
namespace fs = std::filesystem; namespace fs = std::filesystem;
@ -54,7 +53,7 @@ void GUI::build_failed(bool play_sound, const string &command) {
build_failed_sound.play(); build_failed_sound.play();
} }
output(format("!!! BUILD FAILED. Your command correct? '{}'", command)); output(fmt::format("!!! BUILD FAILED. Your command correct? '{}'", command));
} }
void GUI::you_died() { void GUI::you_died() {

@ -5,7 +5,7 @@ cmake = import('cmake')
opts = cmake.subproject_options() opts = cmake.subproject_options()
opts.add_cmake_defines({ opts.add_cmake_defines({
'USE_ICONV': false, 'USE_ICONV': false,
'USE_SSH': false, #'USE_SSH': false,
'USE_NTLMCLIENT': false, 'USE_NTLMCLIENT': false,
'BUILD_SHARED_LIBS': true, 'BUILD_SHARED_LIBS': true,
'BUILD_TESTS': false, 'BUILD_TESTS': false,
@ -14,7 +14,7 @@ libgit2_proj = cmake.subproject('libgit2', options: opts)
libgit2package = libgit2_proj.dependency('libgit2package') libgit2package = libgit2_proj.dependency('libgit2package')
efsw = dependency('efsw') efsw = dependency('efsw')
fmt = dependency('fmt') fmt = subproject('fmt').get_variable('fmt_dep')
catch2 = dependency('catch2-with-main') catch2 = dependency('catch2-with-main')
sfml = dependency('sfml') sfml = dependency('sfml')
json = dependency('nlohmann_json') json = dependency('nlohmann_json')

@ -8,7 +8,6 @@
#ifndef INCLUDE_process_h__ #ifndef INCLUDE_process_h__
#define INCLUDE_process_h__ #define INCLUDE_process_h__
typedef struct git_str git_str;
typedef struct git_process git_process; typedef struct git_process git_process;
typedef struct { typedef struct {
@ -113,10 +112,7 @@ extern int git_process__cmdline(
* cmdline arguments to ensure that they are not erroneously treated * cmdline arguments to ensure that they are not erroneously treated
* as an option. For example, arguments to `ssh`. * as an option. For example, arguments to `ssh`.
*/ */
static __inline__ bool git_process__is_cmdline_option(const char *str) #define git_process__is_cmdline_option(S) ((S) && (S)[0] == '-')
{
return (str && str[0] == '-');
}
/** /**
* Start the process. * Start the process.
@ -211,7 +207,7 @@ extern int git_process_close(git_process *process);
* @param msg the buffer to store the message * @param msg the buffer to store the message
* @param result the process result that produced an error * @param result the process result that produced an error
*/ */
extern int git_process_result_msg(git_str *msg, git_process_result *result); extern int git_process_result_msg(struct git_str *msg, git_process_result *result);
/** /**
* Free a process structure * Free a process structure

@ -13,8 +13,8 @@ executable('threadtest', 'threadtest.cpp',
executable('badref', 'badref.cpp', executable('badref', 'badref.cpp',
dependencies: dependencies) dependencies: dependencies)
executable('corotest', [ #executable('corotest', [
'corotest.cpp' # 'corotest.cpp'
], # ],
dependencies: dependencies, # dependencies: dependencies,
cpp_args: '-fcoroutines') # cpp_args: '-fcoroutines')

@ -14,7 +14,6 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
using namespace fmt;
using namespace nlohmann; using namespace nlohmann;
using std::string; using std::string;
@ -36,7 +35,7 @@ void SoundQuip::load(json &data, const char *file_key, bool loop) {
json::string_t file_name = audio[file_key].template get<string>(); json::string_t file_name = audio[file_key].template get<string>();
if(!buffer.loadFromFile(file_name)) { if(!buffer.loadFromFile(file_name)) {
println("Failed to load sound: {} with file {}", file_key, file_name); fmt::println("Failed to load sound: {} with file {}", file_key, file_name);
} }
sound.setBuffer(buffer); sound.setBuffer(buffer);
@ -157,7 +156,7 @@ void SFMLBackend::update_entities() {
auto elapsed_time = std::chrono::system_clock::now() - clock_start; auto elapsed_time = std::chrono::system_clock::now() - clock_start;
string time = format("{:%H:%M:%OS}", elapsed_time); string time = fmt::format("{:%H:%M:%OS}", elapsed_time);
write_text(7, 14, time, 2.0f); write_text(7, 14, time, 2.0f);
@ -215,7 +214,7 @@ void SFMLBackend::startup() {
fmt::println("Cannot load font."); fmt::println("Cannot load font.");
} }
window.setPosition({.x=0,.y=0}); window.setPosition({0,0});
window.setFramerateLimit(FPS); window.setFramerateLimit(FPS);
window.setVerticalSyncEnabled(true); window.setVerticalSyncEnabled(true);

@ -1,5 +1,7 @@
#include "watcher.hpp" #include "watcher.hpp"
#include <filesystem> #include <filesystem>
#include <algorithm>
#include <cassert>
using std::string; using std::string;
namespace fs = std::filesystem; namespace fs = std::filesystem;
@ -10,7 +12,6 @@ void UpdateListener::handleFileAction(efsw::WatchID watchid,
efsw::Action action, efsw::Action action,
string oldFilename) string oldFilename)
{ {
// this is some gnarly BS here, probably tons // this is some gnarly BS here, probably tons
// of memory leaks for now but it's working // of memory leaks for now but it's working
int ignored = 1; int ignored = 1;
@ -21,6 +22,7 @@ void UpdateListener::handleFileAction(efsw::WatchID watchid,
full_path.end(), '\\', '/'); full_path.end(), '\\', '/');
int rc = git_ignore_path_is_ignored(&ignored, repo, full_path.c_str()); int rc = git_ignore_path_is_ignored(&ignored, repo, full_path.c_str());
assert(rc == 0 && "libgit2 says it can't check the ignored file");
if(!ignored) { if(!ignored) {
changes = changes || !ignored; changes = changes || !ignored;

@ -1,8 +1,8 @@
[wrap-file] [wrap-file]
directory = libgit2-1.8.1 directory = libgit2-1.9.0
source_url = https://github.com/libgit2/libgit2/archive/refs/tags/v1.8.1.tar.gz source_url = https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.0.tar.gz
source_filename = v1.8.1.tar.gz source_filename = v1.9.0.tar.gz
source_hash = 8c1eaf0cf07cba0e9021920bfba9502140220786ed5d8a8ec6c7ad9174522f8e source_hash = 75b27d4d6df44bd34e2f70663cfd998f5ec41e680e1e593238bbe517a84c7ed2
wrapdb_version = 2.4.1-3 wrapdb_version = 2.4.1-3
# patch_filename = # patch_filename =
# patch_hash = # patch_hash =

Loading…
Cancel
Save