diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3e576d9..441ad607e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,17 @@ add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS") add_definitions( "/wd4503") endif() -SET(DFHACK_BUILD_ARCH "32" CACHE STRING "Architecture to build ('32' or '64')") +# Automatically detect architecture based on Visual Studio generator +IF(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH) + IF(${CMAKE_GENERATOR} MATCHES "Win64") + SET(DFHACK_BUILD_ARCH "64") + ELSE() + SET(DFHACK_BUILD_ARCH "32") + ENDIF() +ELSE() + SET(DFHACK_BUILD_ARCH "32" CACHE STRING "Architecture to build ('32' or '64')") +ENDIF() + IF("${DFHACK_BUILD_ARCH}" STREQUAL "32") SET(DFHACK_BUILD_32 1) SET(DFHACK_BUILD_64 0) diff --git a/depends/protobuf/CMakeLists.txt b/depends/protobuf/CMakeLists.txt index 085af746f..5b54c8335 100644 --- a/depends/protobuf/CMakeLists.txt +++ b/depends/protobuf/CMakeLists.txt @@ -202,6 +202,9 @@ LIST(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS}) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result") +ELSEIF(MSVC) + # Disable warnings for integer conversion to smaller type + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 387ac4d97..df077ccc1 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -2373,7 +2373,7 @@ static int internal_setAddress(lua_State *L) // Print via printerr, so that it is definitely logged to stderr.log. uintptr_t iaddr = addr - Core::getInstance().vinfo->getRebaseDelta(); - fprintf(stderr, "Setting global '%s' to %x (%x)\n", name.c_str(), addr, iaddr); + fprintf(stderr, "Setting global '%s' to %p (%p)\n", name.c_str(), (void*)addr, (void*)iaddr); fflush(stderr); return 1; diff --git a/library/VTableInterpose.cpp b/library/VTableInterpose.cpp index 96cbfff9c..c547800c2 100644 --- a/library/VTableInterpose.cpp +++ b/library/VTableInterpose.cpp @@ -309,7 +309,7 @@ VMethodInterposeLinkBase::VMethodInterposeLinkBase(virtual_identity *host, int v */ fprintf(stderr, "Bad VMethodInterposeLinkBase arguments: %d %p (%s)\n", - vmethod_idx, uintptr_t(interpose_method), name_str); + vmethod_idx, interpose_method, name_str); fflush(stderr); abort(); } diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp index adc451a19..127a49b69 100644 --- a/plugins/ruby/ruby.cpp +++ b/plugins/ruby/ruby.cpp @@ -1023,7 +1023,7 @@ static VALUE rb_dfmemory_set_clear(VALUE self, VALUE set) /* call an arbitrary object virtual method */ -#ifdef WIN32 +#if defined(_WIN32) && !defined(_WIN64) __declspec(naked) static int raw_vcall(void *that, void *fptr, unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) {