From e50b36b11d86066b4782bb1912afc63aefcffebe Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 10 Mar 2016 18:06:30 -0600 Subject: [PATCH 1/5] Vendor in ASIO --- .gitmodules | 3 +++ vendor/asio | 1 + 2 files changed, 4 insertions(+) create mode 160000 vendor/asio diff --git a/.gitmodules b/.gitmodules index 87093d533..9d8d2c07d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,3 +18,6 @@ path = vendor/UIforETWbins url = https://github.com/OSVR/UIforETWbins.git branch = master +[submodule "vendor/asio"] + path = vendor/asio + url = https://github.com/OSVR/asio.git diff --git a/vendor/asio b/vendor/asio new file mode 160000 index 000000000..722f7e2be --- /dev/null +++ b/vendor/asio @@ -0,0 +1 @@ +Subproject commit 722f7e2be05a51c69644662ec514d6149b2b7ef8 From 97949bd2b43b8011f937f6a76e1169d05759940a Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Thu, 10 Mar 2016 18:07:48 -0600 Subject: [PATCH 2/5] Add interface target to use ASIO in boost-less mode (using C++11 instead) --- vendor/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 3d5bbfbbd..a31cb1527 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -45,6 +45,15 @@ else() target_include_directories(vendored-hidapi INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/vrpn/submodules/hidapi") endif() +# Interface target for ASIO headers +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/asio/asio/include/asio.hpp") + message(FATAL_ERROR "You are missing the ASIO git submodule: you must have not done a recursive clone or updated without updating submodules. You can get it now by running git submodule update --init vendor/asio from the root source directory.") +endif() +add_library(vendored-asio INTERFACE) +target_include_directories(vendored-asio INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/asio/asio/include") +target_compile_definitions(vendored-asio INTERFACE ASIO_STANDALONE) +target_compile_options(vendored-asio INTERFACE "${OSVR_CXX11_FLAGS}") + # Interface target for util headers add_library(util-headers INTERFACE) target_include_directories(util-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/util-headers") From 8eb42732dbd5ae068128f5ddf96370ec5d5262f4 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 11 Mar 2016 13:14:10 -0600 Subject: [PATCH 3/5] Need to build our VRPN with Winsock2 header to avoid conflicts with ASIO --- vendor/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index a31cb1527..214b7d0f0 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -12,6 +12,9 @@ endif() # Build VRPN as subproject set(VRPN_GPL_SERVER FALSE CACHE INTERNAL "" FORCE) +if(WIN32) + set(VRPN_USE_WINSOCK2 TRUE CACHE INTERNAL "" FORCE) +endif() if(BUILD_CLIENT AND NOT BUILD_SERVER) set(VRPN_BUILD_SERVER_LIBRARY FALSE CACHE INTERNAL "" FORCE) set(VRPN_BUILD_CLIENT_LIBRARY TRUE CACHE INTERNAL "" FORCE) From 01350fcb3619ffdc45b94a108861909ad16a9abe Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Fri, 11 Mar 2016 13:26:22 -0600 Subject: [PATCH 4/5] Turn off sort includes for clang-format. This got moved into the style file in new versions, and defaulted to true, so I was getting surprised by larger than expected diffs. --- .clang-format | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.clang-format b/.clang-format index 72b5e5320..a1b5a6ab9 100644 --- a/.clang-format +++ b/.clang-format @@ -7,6 +7,11 @@ TabWidth: 4 UseTab: Never NamespaceIndentation: Inner +# Turning this off - not because I don't think it's a good idea, but because +# it's distracting to have it sorting includes on a feature branch. We can turn +# it on and sort includes in their own step. +SortIncludes: false + # AccessModifierOffset: -2 # ConstructorInitializerIndentWidth: 4 # AlignEscapedNewlinesLeft: false From 06fa8881da8f120b3e212f93c8c886c5f65f1198 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Mon, 14 Mar 2016 16:50:44 -0500 Subject: [PATCH 5/5] Add missing link library for asio Specifically, mswsock is the one containing AcceptEx for ahead-of-time linking. --- vendor/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 214b7d0f0..22e694ed6 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -56,6 +56,9 @@ add_library(vendored-asio INTERFACE) target_include_directories(vendored-asio INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/asio/asio/include") target_compile_definitions(vendored-asio INTERFACE ASIO_STANDALONE) target_compile_options(vendored-asio INTERFACE "${OSVR_CXX11_FLAGS}") +if(WIN32) + target_link_libraries(vendored-asio INTERFACE ws2_32 mswsock) +endif() # Interface target for util headers add_library(util-headers INTERFACE)