From cff9bef72c2aa54527a7ffe10e395b251100c4c4 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 --- .travis.yml | 5 ++--- CMakeLists.txt | 21 ++++++++++++++++++--- intercept | 1 - src/CMakeLists.txt | 4 ++-- 6 files changed, 25 insertions(+), 12 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/.travis.yml b/.travis.yml index a9cb874..12761e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,13 +7,12 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-7 - - gcc-7-multilib - g++-7 - g++-7-multilib + - linux-libc-dev:i386 # asm/errno.h before_script: - CXX=g++-7 CC=gcc-7 cmake . script: - - make + - CXX=g++-7 CC=gcc-7 make diff --git a/CMakeLists.txt b/CMakeLists.txt index 960d5cb..90e45b5 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) @@ -33,9 +36,21 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) 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")