aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/third-party/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/third-party/CMakeLists.txt')
-rw-r--r--libtransport/third-party/CMakeLists.txt82
1 files changed, 72 insertions, 10 deletions
diff --git a/libtransport/third-party/CMakeLists.txt b/libtransport/third-party/CMakeLists.txt
index 46a4c0f23..25c6f7c20 100644
--- a/libtransport/third-party/CMakeLists.txt
+++ b/libtransport/third-party/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2021-2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-include(FetchContent)
-
set (THIRD_PARTY_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
option(ENABLE_RELY "Enable download/build of rely library" OFF)
@@ -20,21 +18,34 @@ option(ENABLE_RELY "Enable download/build of rely library" OFF)
if (ENABLE_RELY)
##################################
# Download librely
-
- if(DEFINED ENV{BITBUCKET_USERNAME} AND DEFINED ENV{BITBUCKET_PASSWORD})
- set(GIT_REPO https://$ENV{BITBUCKET_USERNAME}:$ENV{BITBUCKET_PASSWORD}@bitbucket-eng-gpk1.cisco.com/bitbucket/scm/icn/rely.git)
+
+ if (INTERNAL_ENVIRONMENT)
+ include(SetRelyGitRepo)
+ SetRelyGitRepo()
else()
- set(GIT_REPO ssh://git@bitbucket-eng-gpk1.cisco.com:7999/icn/rely.git)
+ if(DEFINED ENV{GITHUB_USERNAME} AND DEFINED ENV{GITHUB_PASSWORD})
+ set(GIT_REPO https://$ENV{GITHUB_USERNAME}:$ENV{GITHUB_PASSWORD}@github.com/steinwurf/rely.git)
+ else()
+ set(GIT_REPO ssh://github.com/steinwurf/rely.git)
+ endif()
endif()
FetchContent_Declare(
rely
GIT_REPOSITORY ${GIT_REPO}
GIT_TAG release/latest
+ GIT_SHALLOW
+ GIT_PROGRESS
+ EXCLUDE_FROM_ALL
)
set(ENABLE_PIC ON)
- FetchContent_MakeAvailable(rely)
+ FetchContent_GetProperties(rely)
+ if(NOT rely_POPULATED)
+ pr("Download and build" "rely")
+ FetchContent_Populate(rely)
+ add_subdirectory(${rely_SOURCE_DIR} ${rely_BINARY_DIR} EXCLUDE_FROM_ALL)
+ endif()
list(APPEND THIRD_PARTY_INCLUDE_DIRS
${rely_BINARY_DIR}
@@ -44,7 +55,7 @@ if (ENABLE_RELY)
# Get rely libraries
get_property(steinwurf_object_libraries GLOBAL
PROPERTY steinwurf::object_libraries)
-
+
foreach(rely_library ${steinwurf_object_libraries})
list(APPEND THIRD_PARTY_OBJECT_LIBRARIES
$<TARGET_OBJECTS:${rely_library}>
@@ -56,13 +67,28 @@ if (ENABLE_RELY)
)
endif()
+# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
+if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
+ cmake_policy(SET CMP0135 NEW)
+endif()
+
FetchContent_Declare(
glog
URL https://github.com/google/glog/archive/refs/tags/v0.5.0.zip
PATCH_COMMAND patch -p1 CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/glog.patch
+ EXCLUDE_FROM_ALL
)
-FetchContent_MakeAvailable(glog)
+FetchContent_GetProperties(glog)
+if(NOT glog_POPULATED)
+ pr("Download and build" "glog")
+ FetchContent_Populate(glog)
+ option(WITH_GFLAGS OFF)
+ option(WITH_GTEST OFF)
+ option(WITH_UNWIND OFF)
+ option(BUILD_TESTING OFF)
+ add_subdirectory(${glog_SOURCE_DIR} ${glog_BINARY_DIR} EXCLUDE_FROM_ALL)
+endif()
list(APPEND THIRD_PARTY_INCLUDE_DIRS
${glog_BINARY_DIR}
@@ -77,6 +103,42 @@ list(APPEND THIRD_PARTY_DEPENDENCIES
glog
)
+if(UNIX AND (NOT APPLE) AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES Android))
+ ##############################################################
+ # Get memif version
+ ##############################################################
+ list(GET LIBMEMIF_DEFAULT_VERSION 0 MEMIF_VERSION)
+
+ FetchContent_Declare(
+ memif
+ GIT_REPOSITORY https://github.com/FDio/vpp
+ GIT_TAG v${MEMIF_VERSION}
+ GIT_SHALLOW
+ GIT_PROGRESS
+ PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/memif.patch || true
+ EXCLUDE_FROM_ALL
+ )
+
+ FetchContent_GetProperties(memif)
+ if(NOT memif_POPULATED)
+ FetchContent_Populate(memif)
+ add_subdirectory(${memif_SOURCE_DIR}/extras/libmemif ${memif_BINARY_DIR} EXCLUDE_FROM_ALL)
+ endif()
+
+ list(APPEND THIRD_PARTY_INCLUDE_DIRS
+ ${memif_BINARY_DIR}
+ ${memif_SOURCE_DIR}/extras/libmemif/src
+ )
+
+ list(APPEND THIRD_PARTY_OBJECT_LIBRARIES
+ $<TARGET_OBJECTS:memif>
+ )
+
+ list(APPEND THIRD_PARTY_DEPENDENCIES
+ memif
+ )
+endif()
+
set (THIRD_PARTY_LIBRARIES ${THIRD_PARTY_LIBRARIES} PARENT_SCOPE)
set (THIRD_PARTY_OBJECT_LIBRARIES ${THIRD_PARTY_OBJECT_LIBRARIES} PARENT_SCOPE)
set (THIRD_PARTY_INCLUDE_DIRS ${THIRD_PARTY_INCLUDE_DIRS} PARENT_SCOPE)