cmake cleanup

This commit is contained in:
gymnast86
2026-04-09 12:27:05 -07:00
parent 0b78547ba1
commit ac53fdbbff
6 changed files with 13 additions and 30 deletions
@@ -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
-2
View File
@@ -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);
+4 -4
View File
@@ -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<std::string> 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<std::string> files = {
"Root.yaml",
"overworld/Ordona Province.yaml",
+6 -21
View File
@@ -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
+1 -1
View File
@@ -194,7 +194,7 @@ namespace randomizer::seedgen::settings
std::unique_ptr<SettingInfoMap_t> LoadAllSettingsInfo()
{
std::unique_ptr<SettingInfoMap_t> settingInfoMap = std::make_unique<SettingInfoMap_t>();
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())
+1 -1
View File
@@ -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"))
{