diff --git a/CMakeLists.txt b/CMakeLists.txt index abfe76bd..6e13ce70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ if (USE_STANDALONE) add_definitions(-DSTANDALONE) add_executable(${PROJECT_NAME} ${SRC_DIR}) else() - add_library(${PROJECT_NAME} SHARED ${SRC_DIR}) + add_library(${PROJECT_NAME} STATIC ${SRC_DIR}) endif() if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") @@ -71,13 +71,13 @@ else() $<$: /w; /Od; - /MDd + /MTd > $<$: /Oi; /Gy; /W3; - /MD + /MT > /STACK:16777216 /permissive-; @@ -89,13 +89,13 @@ else() elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") target_compile_options(${PROJECT_NAME} PRIVATE $<$: - /MDd + /MTd > $<$: /O2; /Oi; /Gy; - /MD + /MT > /STACK:16777216 /permissive-; @@ -139,7 +139,12 @@ endif() # Fetch Dependencies -if(EXISTS "/mnt/c/WINDOWS/system32/wsl.exe") +if(MSVC) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$: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") FetchContent_Declare( GSL GIT_REPOSITORY https://github.com/Microsoft/GSL.git @@ -171,6 +176,9 @@ endif() # Link YamlCpp +set(YAML_CPP_BUILD_TOOLS OFF) +set(YAML_CPP_BUILD_TESTS OFF) +set(YAML_CPP_DISABLE_UNINSTALL ON) FetchContent_Declare( yaml-cpp GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git diff --git a/src/storm/SWrapper.cpp b/src/storm/SWrapper.cpp index 811e31bf..00da1def 100644 --- a/src/storm/SWrapper.cpp +++ b/src/storm/SWrapper.cpp @@ -56,7 +56,7 @@ bool SWrapper::CreateFile(const std::string& path, std::vector data) { } if(!SFileCreateFile(this->hMpq, path.c_str(), theTime, size, 0, MPQ_FILE_COMPRESS, &hFile)){ - throw std::runtime_error("Failed to create file at path " + path + " with error " + std::to_string(GetLastError())); + return false; } if(!SFileWriteFile(hFile, (void*) raw, size, MPQ_COMPRESSION_ZLIB)){