Cleaned up cmake

This commit is contained in:
KiritoDv
2025-01-03 14:14:57 -06:00
committed by Lywx
parent b5435b199a
commit 2716c7d56c
4 changed files with 43 additions and 82 deletions
+42 -79
View File
@@ -52,9 +52,12 @@ set(SRC_DIR ${CXX_FILES} ${C_FILES} ${LGFXD_FILES})
option(USE_STANDALONE "Build as a standalone executable" ON)
option(BUILD_STORMLIB "Build with StormLib support" ON)
option(BUILD_ASAN "Build with AddressSanitizer" OFF)
#add_compile_options(-fsanitize=address)
#add_link_options(-fsanitize=address)
if (BUILD_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
# Build
if (USE_STANDALONE)
@@ -69,86 +72,46 @@ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS "-Wno-narrowing")
else()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/w;
/Od;
/MDd
>
$<$<CONFIG:Release>:
/Oi;
/Gy;
/W3;
/MD
>
/bigobj
/STACK:16777216
/permissive-;
/MP;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:/ZI;>)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/MDd
>
$<$<CONFIG:Release>:
/O2;
/Oi;
/Gy;
/MD
>
/STACK:16777216
/permissive-;
/bigobj
/MP;
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/w;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/INCREMENTAL
>
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF;
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/bigobj
/STACK:16777216
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:CONSOLE
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF;
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/bigobj
/STACK:16777216
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:CONSOLE
)
endif()
/Od;
/ZI;
/MDd
>
$<$<CONFIG:Release>:
/Oi;
/Gy;
/W3;
/MD
>
/bigobj
/permissive-;
/MP;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
target_link_options(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:
/INCREMENTAL
>
$<$<CONFIG:Release>:
/OPT:REF;
/OPT:ICF;
/INCREMENTAL:NO;
/FORCE:MULTIPLE
>
/bigobj
/MANIFEST:NO;
/DEBUG;
/SUBSYSTEM:CONSOLE
)
endif()
# Fetch Dependencies
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:16777216")
endif()
if(NOT USE_STANDALONE AND EXISTS "/mnt/c/WINDOWS/system32/wsl.exe")
@@ -226,8 +189,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
endif()
if(NOT USE_STANDALONE)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lib)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_include_directories(${PROJECT_NAME} PUBLIC ${yaml-cpp_SOURCE_DIR}/include)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lib)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_include_directories(${PROJECT_NAME} PUBLIC ${yaml-cpp_SOURCE_DIR}/include)
endif()
-1
View File
@@ -1255,7 +1255,6 @@ std::optional<std::tuple<std::string, YAML::Node>> Companion::RegisterAsset(cons
auto entry = std::make_tuple(output, node);
this->gAddrMap[this->gCurrentFile][node["offset"].as<uint32_t>()] = entry;
this->gAssetDependencies[this->gCurrentFile][name] = std::make_pair(node, true);
auto dResult = this->ParseNode(node, output);
if(dResult.has_value()) {
this->gParseResults[this->gCurrentFile].push_back(dResult.value());
-1
View File
@@ -198,7 +198,6 @@ private:
std::variant<std::vector<std::string>, std::string> gWriteOrder;
std::unordered_map<std::string, std::shared_ptr<BaseFactory>> gFactories;
std::unordered_map<std::string, std::map<std::string, std::vector<WriteEntry>>> gWriteMap;
std::unordered_map<std::string, std::map<std::string, std::pair<YAML::Node, bool>>> gAssetDependencies;
std::unordered_map<std::string, std::unordered_map<uint32_t, std::tuple<std::string, YAML::Node>>> gAddrMap;
void ProcessFile(YAML::Node root);
+1 -1
View File
@@ -93,7 +93,7 @@ std::optional<std::shared_ptr<IParsedData>> SF64::MessageLookupFactory::parse(st
entry["autogen"] = true;
SPDLOG_INFO("Message ID: {} Ptr: {:X} Offset: {:X}", id, ptr, (SEGMENT_NUMBER(offset) << 24) | (ptr - vram));
Companion::Instance->RegisterAsset(output, entry);
Companion::Instance->AddAsset(entry);
message.push_back({id, ptr});
id = reader.ReadInt32();
ptr = reader.ReadInt32();