Merge pull request #4768 from ligfx/fixwindows

CMake: Small Windows fixes
This commit is contained in:
Markus Wick 2017-01-28 03:44:18 +01:00 committed by GitHub
commit 5e9c10f65c
2 changed files with 19 additions and 12 deletions

View File

@ -166,7 +166,7 @@ if(ENABLE_GENERIC)
message(STATUS "Warning! Building generic build!") message(STATUS "Warning! Building generic build!")
set(_M_GENERIC 1) set(_M_GENERIC 1)
add_definitions(-D_M_GENERIC=1) add_definitions(-D_M_GENERIC=1)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
set(_M_X86 1) set(_M_X86 1)
set(_M_X86_64 1) set(_M_X86_64 1)
add_definitions(-D_M_X86=1) add_definitions(-D_M_X86=1)
@ -180,7 +180,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
# CRC instruction set is used in the CRC32 hash function # CRC instruction set is used in the CRC32 hash function
check_and_add_flag(HAVE_ARCH_ARMV8 -march=armv8-a+crc) check_and_add_flag(HAVE_ARCH_ARMV8 -march=armv8-a+crc)
else() else()
message(FATAL_ERROR "You're building on an unsupported platform '${CMAKE_SYSTEM_PROCESSOR}'. Enable generic build if you really want a JIT-less binary.") message(FATAL_ERROR "You're building on an unsupported platform: "
"'${CMAKE_SYSTEM_PROCESSOR}' with ${CMAKE_SIZEOF_VOID_P}-byte pointers."
" Enable generic build if you really want a JIT-less binary.")
endif() endif()
@ -242,16 +244,7 @@ else()
endif() endif()
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-DNOMINMAX)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-D_WIN32_WINNT=0x0602)
add_definitions(-D_SECURE_SCL=0)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# This doesn't play well with the packaging script that doesn't understand @rpath # This doesn't play well with the packaging script that doesn't understand @rpath
set(CMAKE_MACOSX_RPATH OFF) set(CMAKE_MACOSX_RPATH OFF)
@ -575,6 +568,9 @@ if(NOT ANDROID)
set(PORTAUDIO_LIBRARIES portaudio) set(PORTAUDIO_LIBRARIES portaudio)
else() else()
message(STATUS "Using static PortAudio from Externals for mic support") message(STATUS "Using static PortAudio from Externals for mic support")
option(PA_USE_ASIO "Enable PortAudio support for ASIO" OFF)
option(PA_USE_DS "Enable PortAudio support for DirectSound" OFF)
option(PA_USE_WDMKS "Enable PortAudio support for WDMKS" OFF)
add_subdirectory(Externals/portaudio) add_subdirectory(Externals/portaudio)
set(PORTAUDIO_LIBRARIES portaudio_static) set(PORTAUDIO_LIBRARIES portaudio_static)
endif() endif()

View File

@ -3,6 +3,17 @@ if(NOT FLAG_CXX_CXX14)
check_and_add_flag(HAS_CXX1Y -std=c++1y) check_and_add_flag(HAS_CXX1Y -std=c++1y)
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DNOMINMAX)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-D_WIN32_WINNT=0x0602)
add_definitions(-D_SECURE_SCL=0)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif()
# These aren't actually needed for C11/C++11 # These aren't actually needed for C11/C++11
# but some dependencies require them (LLVM, libav). # but some dependencies require them (LLVM, libav).
add_definitions(-D__STDC_LIMIT_MACROS) add_definitions(-D__STDC_LIMIT_MACROS)