From 744f8cd68e06a07137579a7532066bdd18e02871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Dahlgren?= Date: Wed, 18 Apr 2018 22:38:12 +0200 Subject: [PATCH] Download Intercept library to vendor folder on build if needed --- .gitignore | 3 +++ .gitmodules | 3 --- CMakeLists.txt | 19 +++++++++++++++++-- intercept | 1 - src/CMakeLists.txt | 4 ++-- 5 files changed, 22 insertions(+), 8 deletions(-) delete mode 100644 .gitmodules delete mode 160000 intercept diff --git a/.gitignore b/.gitignore index 31074b0..eafe301 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ CTestTestfile.cmake # JetBrains .idea/ + +# Intercept library +vendor/intercept/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 02d091d..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "intercept"] - path = intercept - url = https://github.com/intercept/intercept.git \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 960d5cb..7d0a125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.6) +cmake_minimum_required (VERSION 3.8) #----Make changes here @@ -9,6 +9,9 @@ project (template-plugin) #Enabling this results in better performance when handling strings to SQF commands. option(USE_ENGINE_TYPES "USE_ENGINE_TYPES" OFF) +#Which version of Intercept to build against, branch/commit/tag +set(INTERCEPT_VERSION "dfa2ce681154337a1640ea7fa2d00576fb44349b") + #----Don't change anything below this line option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) @@ -38,4 +41,16 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) -add_subdirectory(src) \ No newline at end of file +add_subdirectory(src) + +include(ExternalProject) + +# Download Intercept library to vendor folder +ExternalProject_Add( + intercept + PREFIX ${CMAKE_CURRENT_LIST_DIR}/vendor/intercept + URL https://github.com/intercept/intercept/archive/${INTERCEPT_VERSION}.tar.gz + BUILD_COMMAND "" + CONFIGURE_COMMAND "" + INSTALL_COMMAND "" +) diff --git a/intercept b/intercept deleted file mode 160000 index f283e2f..0000000 --- a/intercept +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f283e2fd3ce1024e496c6c17eb27f81693f05ca8 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1cbbf0..c07ec34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,8 +15,8 @@ SOURCE_GROUP("src" FILES ${INTERCEPT_PLUGIN_SOURCES}) #----Don't change anything below this line -#include the Intercept headers from the submodule -set(INTERCEPT_CLIENT_PATH "${CMAKE_SOURCE_DIR}/intercept/src/client") +#include the Intercept headers from the vendored library +set(INTERCEPT_CLIENT_PATH "${CMAKE_SOURCE_DIR}/vendor/intercept/src/intercept/src/client") set(INTERCEPT_INCLUDE_PATH "${INTERCEPT_CLIENT_PATH}/headers" "${INTERCEPT_CLIENT_PATH}/headers/shared" "${INTERCEPT_CLIENT_PATH}/headers/client/" "${INTERCEPT_CLIENT_PATH}/headers/client/sqf")