diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e657912..635bf383e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ if(UNIX) endif() if(WIN32) - if((NOT MSVC) OR (MSVC_VERSION LESS 1900) OR (MSVC_VERSION GREATER 1919)) + if((NOT MSVC) OR (MSVC_VERSION LESS 1930) OR (MSVC_VERSION GREATER 1934)) message(SEND_ERROR "MSVC 2015 or 2017 is required") endif() endif() diff --git a/depends/protobuf/CMakeLists.txt b/depends/protobuf/CMakeLists.txt index b12230b71..1d1796d1c 100644 --- a/depends/protobuf/CMakeLists.txt +++ b/depends/protobuf/CMakeLists.txt @@ -149,7 +149,7 @@ if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation -Wno-class-memaccess -Wno-sign-compare") elseif(MSVC) # Disable warnings for integer conversion to smaller type - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4273") endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) @@ -159,15 +159,11 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Protobuf shared libraries -add_library(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS}) -ide_folder(protobuf "Depends") add_library(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS}) ide_folder(protobuf-lite "Depends") -set_target_properties(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) set_target_properties(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) -target_link_libraries(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) target_link_libraries(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) install(TARGETS protobuf-lite @@ -175,6 +171,11 @@ install(TARGETS protobuf-lite RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) if(NOT CMAKE_CROSSCOMPILING) + add_library(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS}) + ide_folder(protobuf "Depends") + set_target_properties(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS) + target_link_libraries(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) + # Protobuf compiler shared library add_library(protoc SHARED ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS}) diff --git a/depends/protobuf/google/protobuf/stubs/hash.h b/depends/protobuf/google/protobuf/stubs/hash.h index b4b2da574..0ee778563 100644 --- a/depends/protobuf/google/protobuf/stubs/hash.h +++ b/depends/protobuf/google/protobuf/stubs/hash.h @@ -104,7 +104,14 @@ // And.. they are moved back to stdext in MSVC 2013 (haven't checked 2012). That // said, use unordered_map for MSVC 2010 and beyond is our safest bet. #elif defined(_MSC_VER) -# if _MSC_VER >= 1600 // Since Visual Studio 2010 +# if _MSC_VER >= 1900 // Since Visual Studio 2019 +# define GOOGLE_PROTOBUF_HASH_NAMESPACE std +# include +# define GOOGLE_PROTOBUF_HASH_MAP_CLASS unordered_map +# include +# define GOOGLE_PROTOBUF_HASH_SET_CLASS unordered_set + +# elif _MSC_VER >= 1600 // Since Visual Studio 2010 # define GOOGLE_PROTOBUF_HAS_CXX11_HASH # define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare # elif _MSC_VER >= 1500 // Since Visual Studio 2008 @@ -233,7 +240,7 @@ namespace google { HashFcn hash_function() const { return HashFcn(); } }; -#elif defined(_MSC_VER) && !defined(_STLPORT_VERSION) +#elif defined(_MSC_VER) && _MSC_VER < 1900 && !defined(_STLPORT_VERSION) template struct hash : public GOOGLE_PROTOBUF_HASH_COMPARE { @@ -435,4 +442,4 @@ namespace google { } // namespace protobuf } // namespace google -#endif // GOOGLE_PROTOBUF_STUBS_HASH_H__ \ No newline at end of file +#endif // GOOGLE_PROTOBUF_STUBS_HASH_H__