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 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/CMakeLists.txt b/vendor/CMakeLists.txt index 3d5bbfbbd..22e694ed6 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) @@ -45,6 +48,18 @@ 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}") +if(WIN32) + target_link_libraries(vendored-asio INTERFACE ws2_32 mswsock) +endif() + # Interface target for util headers add_library(util-headers INTERFACE) target_include_directories(util-headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/util-headers") 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