From 4785802b9e972a09014e2713d7300a2be369fb82 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Fri, 20 Jan 2017 17:44:23 +0100 Subject: [PATCH 1/4] cmake: Move C++ standard requirement out of global scope to Source/ --- CMakeLists.txt | 10 ---------- Source/CMakeLists.txt | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a167ab78c..81c1304ad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1057,16 +1057,6 @@ enable_testing() add_custom_target(unittests) add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND}) - -######################################## -# Start compiling our code -# -add_definitions(-std=c++1y) - -# These aren't actually needed for C11/C++11 -# but some dependencies require them (LLVM, libav). -add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS) - add_subdirectory(Source) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 2cc8c77c12..46f2a9c9cc 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -1,3 +1,13 @@ +check_and_add_flag(CXX14 -std=c++14) +if(NOT FLAG_CXX_CXX14) + check_and_add_flag(HAS_CXX1Y -std=c++1y) +endif() + +# These aren't actually needed for C11/C++11 +# but some dependencies require them (LLVM, libav). +add_definitions(-D__STDC_LIMIT_MACROS) +add_definitions(-D__STDC_CONSTANT_MACROS) + set(CMAKE_FAKELANG_CREATE_STATIC_LIBRARY "touch ") if(ENABLE_PCH) # This is actually a .h file, but trick cmake into compiling it as a source file From b670f434b2578f31e411bf5c15953f1e807effb3 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Fri, 20 Jan 2017 17:50:23 +0100 Subject: [PATCH 2/4] cmake: Fix bochs disasm on Windows --- Externals/Bochs_disasm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals/Bochs_disasm/CMakeLists.txt b/Externals/Bochs_disasm/CMakeLists.txt index 3d93e7e6e9..505f752133 100644 --- a/Externals/Bochs_disasm/CMakeLists.txt +++ b/Externals/Bochs_disasm/CMakeLists.txt @@ -4,7 +4,7 @@ set(SRCS dis_decode.cc syntax.cc) if(WIN32) - set(SRCS ${SRCS} stdafx.cpp) + set(SRCS ${SRCS} stdafx.cc) endif(WIN32) add_library(bdisasm STATIC ${SRCS}) From 9e451d601c4ef401ca3d2856c2792300f503e3ed Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Fri, 20 Jan 2017 17:50:44 +0100 Subject: [PATCH 3/4] cmake: Fix glslang on Windows --- Externals/glslang/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Externals/glslang/CMakeLists.txt b/Externals/glslang/CMakeLists.txt index 4ea45b5906..8b8fb5180e 100644 --- a/Externals/glslang/CMakeLists.txt +++ b/Externals/glslang/CMakeLists.txt @@ -27,7 +27,7 @@ set(SRCS glslang/MachineIndependent/ShaderLang.cpp glslang/MachineIndependent/SymbolTable.cpp glslang/MachineIndependent/Versions.cpp - glslang/OSDependent/Unix/ossource.cpp + hlsl/hlslGrammar.cpp hlsl/hlslOpMap.cpp hlsl/hlslParseables.cpp @@ -44,6 +44,13 @@ set(SRCS SPIRV/SPVRemapper.cpp ) +if(WIN32) + list(APPEND SRCS glslang/OSDependent/Windows/ossource.cpp) +else() + list(APPEND SRCS glslang/OSDependent/Unix/ossource.cpp) +endif() + +if(NOT MSVC) # glslang requires C++11 at a minimum to compile. add_definitions(-std=c++11) @@ -53,6 +60,6 @@ add_definitions(-Wno-reorder) add_definitions(-Wno-sign-compare) add_definitions(-Wno-parentheses) add_definitions(-Wno-unused-variable) +endif() add_library(glslang STATIC ${SRCS}) - From a7376266b3a9264c2e4249b6f3baf9d315cbecb6 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Fri, 20 Jan 2017 17:51:06 +0100 Subject: [PATCH 4/4] cmake: Fix libusb on Windows and make it static --- Externals/libusb/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Externals/libusb/CMakeLists.txt b/Externals/libusb/CMakeLists.txt index fe8c236140..84754f1130 100644 --- a/Externals/libusb/CMakeLists.txt +++ b/Externals/libusb/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(usb SHARED EXCLUDE_FROM_ALL +add_library(usb STATIC EXCLUDE_FROM_ALL libusb/core.c libusb/core.c libusb/descriptor.c @@ -8,6 +8,9 @@ add_library(usb SHARED EXCLUDE_FROM_ALL libusb/sync.c ) set_target_properties(usb PROPERTIES VERSION 1.0.19) +if(WIN32) + target_include_directories(usb BEFORE PUBLIC libusb PRIVATE msvc) +else() target_include_directories(usb # turns out other projects also have "config.h", so make sure the # LibUSB one comes first @@ -16,9 +19,14 @@ target_include_directories(usb PUBLIC libusb PRIVATE "${CMAKE_CURRENT_BINARY_DIR}" ) +endif() if(WIN32 OR CYGWIN) - target_sources(usb PRIVATE libusb/os/windows_usb.c) + target_sources(usb PRIVATE + libusb/os/threads_windows.c + libusb/os/windows_winusb.c + libusb/os/windows_nt_common.c + ) set(OS_WINDOWS TRUE) elseif(APPLE) target_sources(usb PRIVATE libusb/os/darwin_usb.c)