diff --git a/CMakeLists.txt b/CMakeLists.txt index dc6e0d2f..c32b707c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,9 @@ elseif(MSVC) set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}") set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}") set(CMAKE_ASM_NASM_FLAGS "-g cv8") +endif() + +if(WIN32) add_definitions(-D_HAS_EXCEPTIONS=0) add_definitions(-DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 651793fd..8541bbb7 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -47,7 +47,7 @@ if(NOT OPENSSL_NO_ASM) endforeach() endif() else() - if (CMAKE_CL_64) + if (${ARCH} STREQUAL "x86_64") set(PERLASM_STYLE nasm) else() set(PERLASM_STYLE win32n) diff --git a/crypto/bio/printf.c b/crypto/bio/printf.c index 3709fcb2..f59a15f6 100644 --- a/crypto/bio/printf.c +++ b/crypto/bio/printf.c @@ -83,7 +83,7 @@ int BIO_printf(BIO *bio, const char *format, ...) { va_start(args, format); out_len = _vscprintf(format, args); va_end(args); - assert(out_len >= sizeof(buf)); + assert(out_len >= (int)sizeof(buf)); } #endif diff --git a/crypto/cpu-intel.c b/crypto/cpu-intel.c index ef327df0..01000894 100644 --- a/crypto/cpu-intel.c +++ b/crypto/cpu-intel.c @@ -68,7 +68,7 @@ #include #include -#if defined(OPENSSL_WINDOWS) +#if defined(_MSC_VER) OPENSSL_MSVC_PRAGMA(warning(push, 3)) #include #include @@ -83,7 +83,7 @@ OPENSSL_MSVC_PRAGMA(warning(pop)) * |*out_edx|. */ static void OPENSSL_cpuid(uint32_t *out_eax, uint32_t *out_ebx, uint32_t *out_ecx, uint32_t *out_edx, uint32_t leaf) { -#if defined(OPENSSL_WINDOWS) +#if defined(_MSC_VER) int tmp[4]; __cpuid(tmp, (int)leaf); *out_eax = (uint32_t)tmp[0]; @@ -114,7 +114,7 @@ static void OPENSSL_cpuid(uint32_t *out_eax, uint32_t *out_ebx, /* OPENSSL_xgetbv returns the value of an Intel Extended Control Register (XCR). * Currently only XCR0 is defined by Intel so |xcr| should always be zero. */ static uint64_t OPENSSL_xgetbv(uint32_t xcr) { -#if defined(OPENSSL_WINDOWS) +#if defined(_MSC_VER) return (uint64_t)_xgetbv(xcr); #else uint32_t eax, edx; diff --git a/crypto/crypto.c b/crypto/crypto.c index 3e1765b8..f74ef66c 100644 --- a/crypto/crypto.c +++ b/crypto/crypto.c @@ -107,7 +107,7 @@ uint32_t OPENSSL_armcap_P = 0; #if defined(BORINGSSL_NO_STATIC_INITIALIZER) static CRYPTO_once_t once = CRYPTO_ONCE_INIT; -#elif defined(OPENSSL_WINDOWS) +#elif defined(_MSC_VER) #pragma section(".CRT$XCU", read) static void __cdecl do_library_init(void); __declspec(allocate(".CRT$XCU")) void(*library_init_constructor)(void) = diff --git a/crypto/rand_extra/forkunsafe.c b/crypto/rand_extra/forkunsafe.c index 1a3977f8..58e241fb 100644 --- a/crypto/rand_extra/forkunsafe.c +++ b/crypto/rand_extra/forkunsafe.c @@ -25,6 +25,7 @@ static int g_buffering_enabled = 0; /* g_lock protects |g_buffering_enabled|. */ static struct CRYPTO_STATIC_MUTEX g_lock = CRYPTO_STATIC_MUTEX_INIT; +#if !defined(OPENSSL_WINDOWS) void RAND_enable_fork_unsafe_buffering(int fd) { /* We no longer support setting the file-descriptor with this function. */ if (fd != -1) { @@ -35,6 +36,7 @@ void RAND_enable_fork_unsafe_buffering(int fd) { g_buffering_enabled = 1; CRYPTO_STATIC_MUTEX_unlock_write(&g_lock); } +#endif int rand_fork_unsafe_buffering_enabled(void) { CRYPTO_STATIC_MUTEX_lock_read(&g_lock);