From ac53fdbbff4c5add639467a34af7cabaa1bbc995 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Thu, 9 Apr 2026 12:27:05 -0700 Subject: [PATCH] cmake cleanup --- .../randomizer/logic/entrance_shuffle.cpp | 2 +- src/dusk/randomizer/logic/generate.cpp | 2 -- src/dusk/randomizer/logic/world.cpp | 8 +++--- src/dusk/randomizer/randomizer.cmake | 27 +++++-------------- src/dusk/randomizer/seedgen/settings.cpp | 2 +- src/dusk/randomizer/test/test.cpp | 2 +- 6 files changed, 13 insertions(+), 30 deletions(-) diff --git a/src/dusk/randomizer/logic/entrance_shuffle.cpp b/src/dusk/randomizer/logic/entrance_shuffle.cpp index f54f5f33f9..86eb0e3245 100644 --- a/src/dusk/randomizer/logic/entrance_shuffle.cpp +++ b/src/dusk/randomizer/logic/entrance_shuffle.cpp @@ -37,7 +37,7 @@ namespace randomizer::logic::entrance_shuffle void SetAllEntrancesData(randomizer::logic::world::World* world) { - auto filepath = DATA_PATH "entrance_shuffle_data.yaml"; + auto filepath = RANDO_DATA_PATH "entrance_shuffle_data.yaml"; randomizer::utility::file::Verify(filepath); // Keep track of which double door entrances are together diff --git a/src/dusk/randomizer/logic/generate.cpp b/src/dusk/randomizer/logic/generate.cpp index 913731ee44..546da3a96e 100644 --- a/src/dusk/randomizer/logic/generate.cpp +++ b/src/dusk/randomizer/logic/generate.cpp @@ -17,9 +17,7 @@ namespace randomizer::logic::generate { randomizer::logic::world::WorldPool GenerateWorlds() { -#ifdef ENABLE_TIMING randomizer::utility::time::ScopedTimer<"Seed generation took ", std::chrono::milliseconds> timer; -#endif randomizer::seedgen::config::Config config; config.LoadFromFile(SETTINGS_PATH, PREFERENCES_PATH); diff --git a/src/dusk/randomizer/logic/world.cpp b/src/dusk/randomizer/logic/world.cpp index daef0db5c6..75be85a3ef 100644 --- a/src/dusk/randomizer/logic/world.cpp +++ b/src/dusk/randomizer/logic/world.cpp @@ -87,7 +87,7 @@ namespace randomizer::logic::world { LOG_TO_DEBUG("Building Item Table for World " + std::to_string(this->GetID())); // Check if we can open the file before parsing - auto filepath = DATA_PATH "items.yaml"; + auto filepath = RANDO_DATA_PATH "items.yaml"; randomizer::utility::file::Verify(filepath); auto itemDataTree = LoadYAML(filepath); @@ -155,7 +155,7 @@ namespace randomizer::logic::world { LOG_TO_DEBUG("Building Location Table for World " + std::to_string(this->GetID())); // check if we can open the file before parsing because exceptions won't work on console - auto filepath = DATA_PATH "locations.yaml"; + auto filepath = RANDO_DATA_PATH "locations.yaml"; randomizer::utility::file::Verify(filepath); auto locationDataTree = LoadYAML(filepath); @@ -217,7 +217,7 @@ namespace randomizer::logic::world { LOG_TO_DEBUG("Loading Macros for World " + std::to_string(this->GetID())); // check if we can open the file before parsing - auto filepath = DATA_PATH "macros.yaml"; + auto filepath = RANDO_DATA_PATH "macros.yaml"; randomizer::utility::file::Verify(filepath); auto macrosDataTree = LoadYAML(filepath); @@ -249,7 +249,7 @@ namespace randomizer::logic::world std::unordered_set definedAreas = {}; // I don't know if directory iterator works on console so all logic files are manually specified here for now - std::string folder = DATA_PATH "world/"; + std::string folder = RANDO_DATA_PATH "world/"; std::list files = { "Root.yaml", "overworld/Ordona Province.yaml", diff --git a/src/dusk/randomizer/randomizer.cmake b/src/dusk/randomizer/randomizer.cmake index 1beec3bdb0..b890dad145 100644 --- a/src/dusk/randomizer/randomizer.cmake +++ b/src/dusk/randomizer/randomizer.cmake @@ -1,29 +1,17 @@ cmake_minimum_required(VERSION 3.16) set(RANDOMIZER_ONLY "0" CACHE STRING "Runs only the randomizer generator") -set(RANDO_SAVE_PATH "${CMAKE_BINARY_DIR}/randomizer/") +set(RANDO_SAVE_PATH "${CMAKE_BINARY_DIR}/randomizer") set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} RANDO_SAVE_PATH="${RANDO_SAVE_PATH}" - LOGS_PATH="${RANDO_SAVE_PATH}logs/" - DATA_PATH="${RANDO_SAVE_PATH}data/") + LOGS_PATH="${RANDO_SAVE_PATH}/logs/" + RANDO_DATA_PATH="${CMAKE_SOURCE_DIR}/src/dusk/randomizer/data/") if(RANDO_ERROR_LOG) message("Error Log will be saved") set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} RANDO_ERROR_LOG) endif() -if(ENABLE_TIMING) - message("Some events will be timed") - - set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} ENABLE_TIMING) -endif() - -if(DRY_RUN) - message("Game patching will be skipped") - - set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} DRY_RUN) -endif() - if(RANDO_DEBUG) set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} RANDO_DEBUG) endif() @@ -37,9 +25,9 @@ if(LOGIC_TESTS) message("Test Count: " ${TEST_COUNT}) set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} TEST_COUNT=${TEST_COUNT}) endif() - set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} SETTINGS_PATH="${RANDO_SAVE_PATH}randomizer_settings.yaml.test" PREFERENCES_PATH="${RANDO_SAVE_PATH}randomizer_preferences.yaml.test") + set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} SETTINGS_PATH="${RANDO_SAVE_PATH}/randomizer_settings.yaml.test" PREFERENCES_PATH="${RANDO_SAVE_PATH}/randomizer_preferences.yaml.test") else() - set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} SETTINGS_PATH="${RANDO_SAVE_PATH}randomizer_settings.yaml" PREFERENCES_PATH="${RANDO_SAVE_PATH}randomizer_preferences.yaml") + set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} SETTINGS_PATH="${RANDO_SAVE_PATH}/randomizer_settings.yaml" PREFERENCES_PATH="${RANDO_SAVE_PATH}/randomizer_preferences.yaml") endif() message(STATUS "randomizer: Fetching yaml-cpp") @@ -66,12 +54,9 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(zlib-ng) - string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE) set(GAME_COMPILE_DEFS ${GAME_COMPILE_DEFS} SOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}) set(GAME_LIBS ${GAME_LIBS} yaml-cpp::yaml-cpp zlib base64pp) # Put data files together for easier manipulation -file(COPY "${CMAKE_SOURCE_DIR}/src/dusk/randomizer/data/" DESTINATION "${CMAKE_BINARY_DIR}/randomizer/data/" REGEX "^.*example.*$" EXCLUDE) # World, macros, and location info - - +# file(COPY "${CMAKE_SOURCE_DIR}/src/dusk/randomizer/data/" DESTINATION "${CMAKE_BINARY_DIR}/randomizer/data/" REGEX "^.*example.*$" EXCLUDE) # World, macros, and location info diff --git a/src/dusk/randomizer/seedgen/settings.cpp b/src/dusk/randomizer/seedgen/settings.cpp index 82c679a048..bbc5de3f4f 100644 --- a/src/dusk/randomizer/seedgen/settings.cpp +++ b/src/dusk/randomizer/seedgen/settings.cpp @@ -194,7 +194,7 @@ namespace randomizer::seedgen::settings std::unique_ptr LoadAllSettingsInfo() { std::unique_ptr settingInfoMap = std::make_unique(); - auto filepath = DATA_PATH "settings_list.yaml"; + auto filepath = RANDO_DATA_PATH "settings_list.yaml"; // check if we can open the file before parsing because exceptions won't work on console std::ifstream file(filepath); if (!file.is_open()) diff --git a/src/dusk/randomizer/test/test.cpp b/src/dusk/randomizer/test/test.cpp index 29eda4ac07..73eeddabe2 100644 --- a/src/dusk/randomizer/test/test.cpp +++ b/src/dusk/randomizer/test/test.cpp @@ -11,7 +11,7 @@ namespace randomizer::test::test { void RunTests() { - for (const auto& entry : std::filesystem::recursive_directory_iterator(DATA_PATH "tests/logic")) + for (const auto& entry : std::filesystem::recursive_directory_iterator(RANDO_DATA_PATH "tests/logic")) { if (entry.path().generic_string().ends_with("settings.yaml")) {