Skip to content

Commit

Permalink
chore: add dependencies vendor
Browse files Browse the repository at this point in the history
Signed-off-by: ComixHe <heyuming@deepin.org>
  • Loading branch information
ComixHe authored and black-desk committed Mar 21, 2024
1 parent 2f8e8cf commit 29ebf67
Show file tree
Hide file tree
Showing 262 changed files with 106,804 additions and 54 deletions.
136 changes: 84 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,96 @@ option(OCPPI_BUILD_SHARED_LIBRARY "Build a shared library or not"

option(OCPPI_INSTALL "Enable install target or not" ${PROJECT_IS_TOP_LEVEL})

option(OCPPI_USE_VENDOR_EXPECTED
"Use tl::expected which from vendor of project." OFF)

option(OCPPI_USE_VENDOR_SEMVER "Use semver which from vendor of project." OFF)

option(OCPPI_USE_VENDOR_JSON "Use nlohmann_json which from vendor of project."
OFF)

option(OCPPI_USE_VENDOR_SPDLOG "Use spdlog which from vendor of project." OFF)

option(OCPPI_USE_VENDOR_ALL
"Use all external dependencies which from vendor of project.")

include(./cmake/CPM.cmake)

CPMFindPackage(
NAME expected
VERSION 1.0.0
GITHUB_REPOSITORY TartanLlama/expected
GIT_TAG v1.1.0
GIT_SHALLOW ON
OPTIONS "EXPECTED_BUILD_TESTS OFF"
FIND_PACKAGE_ARGUMENTS "NAMES tl-expected"
EXCLUDE_FROM_ALL ON)
if(OCPPI_USE_VENDOR_ALL)
set(OCPPI_USE_VENDOR_EXPECTED ON)
set(OCPPI_USE_VENDOR_SEMVER ON)
set(OCPPI_USE_VENDOR_JSON ON)
set(OCPPI_USE_VENDOR_SPDLOG ON)
endif()

if(NOT TARGET tl::expected)
# NOTE: v1.0.0 version of tl::expected doesn't have a namespaced alias so we
# have to add it here.
add_library(tl::expected ALIAS expected)
if(OCPPI_USE_VENDOR_EXPECTED)
set(EXPECTED_BUILD_TESTS OFF)
set(EXTERNALS "${EXTERNALS} expected")
else()
CPMFindPackage(
NAME expected
VERSION 1.1.0
GITHUB_REPOSITORY TartanLlama/expected
GIT_TAG v1.1.0
GIT_SHALLOW ON
OPTIONS "EXPECTED_BUILD_TESTS OFF"
FIND_PACKAGE_ARGUMENTS "NAMES tl-expected"
EXCLUDE_FROM_ALL ON)
endif()

CPMFindPackage(
NAME semver
VERSION 0.3.0
GITHUB_REPOSITORY Neargye/Semver
GIT_TAG v0.3.0
GIT_SHALLOW ON
GIT_PROGRESS ON
EXCLUDE_FROM_ALL ON)
if(OCPPI_USE_VENDOR_SEMVER)
set(EXTERNALS "${EXTERNALS} semver")
else()
CPMFindPackage(
NAME semver
VERSION 0.3.1
GITHUB_REPOSITORY Neargye/Semver
GIT_TAG v0.3.1
GIT_SHALLOW ON
GIT_PROGRESS ON
EXCLUDE_FROM_ALL ON)
endif()

CPMFindPackage(
NAME nlohmann_json
VERSION 3.11.2
URL "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz"
EXCLUDE_FROM_ALL ON
OPTIONS "JSON_Install ON")
if(OCPPI_USE_VENDOR_JSON)
set(JSON_Install ON)
set(EXTERNALS "${EXTERNALS} json")
else()
CPMFindPackage(
NAME nlohmann_json
VERSION 3.11.3
URL "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz"
EXCLUDE_FROM_ALL ON
OPTIONS "JSON_Install ON")
endif()

if(OCPPI_USE_VENDOR_SPDLOG)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(EXTERNALS "${EXTERNALS} spdlog")
else()
CPMFindPackage(
NAME spdlog
VERSION 1.13.0
GITHUB_REPOSITORY "gabime/spdlog"
GIT_TAG "v1.13.0"
GIT_SHALLOW ON
EXCLUDE_FROM_ALL ON
OPTIONS
"CMAKE_POSITION_INDEPENDENT_CODE ON" # NOTE:
# https://github.com/gabime/spdlog/issues/1190
)

endif()

CPMFindPackage(
NAME Boost COMPONENTS headers
VERSION 1.64.0
URL "https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.7z"
VERSION 1.83.0
URL "https://github.com/boostorg/boost/releases/download/boost-1.83.0/boost-1.83.0.7z"
EXCLUDE_FROM_ALL ON)

if(NOT TARGET Boost::process)
add_library(Boost::process ALIAS Boost::headers)
endif()

CPMFindPackage(
NAME fmt
VERSION 9.1.0
GITHUB_REPOSITORY "fmtlib/fmt"
GIT_TAG "10.2.1"
GIT_SHALLOW ON
EXCLUDE_FROM_ALL ON
OPTIONS "CMAKE_POSITION_INDEPENDENT_CODE ON")

CPMFindPackage(
NAME spdlog
VERSION 1.10.0
GITHUB_REPOSITORY "gabime/spdlog"
GIT_TAG "v1.13.0"
GIT_SHALLOW ON
EXCLUDE_FROM_ALL ON
OPTIONS
"CMAKE_POSITION_INDEPENDENT_CODE ON" # NOTE:
# https://github.com/gabime/spdlog/issues/1190
"SPDLOG_FMT_EXTERNAL ON")

include(./cmake/GitSemver.cmake)

set(OCPPI_SEMVER ${PROJECT_VERSION})
Expand All @@ -98,8 +123,15 @@ set(CMAKE_CXX_FLAGS_DEBUG "-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE")

include(./cmake/PFL.cmake)

pfl_init(ENABLE_TESTING ${OCPPI_ENABLE_TESTING} BUILD_EXAMPLES
${OCPPI_BUILD_EXAMPLES} INSTALL ${OCPPI_INSTALL})
pfl_init(
ENABLE_TESTING
${OCPPI_ENABLE_TESTING}
BUILD_EXAMPLES
${OCPPI_BUILD_EXAMPLES}
INSTALL
${OCPPI_INSTALL}
EXTERNALS
${EXTERNALS})

pfl_add_library(
SOVERSION
Expand Down
5 changes: 3 additions & 2 deletions cmake/PFL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(PFL_INITIALIZED)
return()
endif()

message(STATUS "PFL: --==Version: v0.2.12==--")
message(STATUS "PFL: --==Version: v0.2.13==--")

# You should call this function in your top level CMakeLists.txt to tell
# PFL.cmake some global settings about your project.
Expand Down Expand Up @@ -40,7 +40,8 @@ function(pfl_init)
PARENT_SCOPE)

foreach(EXTERNAL ${PFL_INIT_EXTERNALS})
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/external/${EXTERNAL})
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/external/${EXTERNAL}
EXCLUDE_FROM_ALL)
endforeach()
endfunction()

Expand Down
1 change: 1 addition & 0 deletions external/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DisableFormat: true
7 changes: 7 additions & 0 deletions external/.cmake-format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):

# Disable formatting entirely, making cmake-format a no-op
disable = True
10 changes: 10 additions & 0 deletions external/expected/.appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
os:
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019
- Visual Studio 2022

build_script:
- cmake -Bbuild -S.
- cmake --build build
- cmake --build build --target RUN_TESTS
1 change: 1 addition & 0 deletions external/expected/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BasedOnStyle: LLVM
131 changes: 131 additions & 0 deletions external/expected/.github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: CMake

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-20.04

strategy:
matrix:
std: [11, 14]
cxx: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11]

exclude:
- cxx: g++-4.8
std: 14
- cxx: g++4.9
std: 14

include:
- cxx: g++-4.8
install: sudo apt install g++-4.8
- cxx: g++-4.9
install: sudo apt install g++-4.9
- cxx: g++-5
install: sudo apt install g++-5
- cxx: g++-6
install: sudo apt install g++-6
- cxx: g++-7
install: sudo apt install g++-7
- cxx: g++-8
std: 11
install: sudo apt install g++-8
- cxx: g++-8
std: 14
install: sudo apt install g++-8
- cxx: g++-8
std: 17
install: sudo apt install g++-8
- cxx: g++-9
std: 14
- cxx: g++-9
std: 17
- cxx: g++-10
std: 14
- cxx: g++-10
std: 17
- cxx: g++-11
std: 14
install: sudo apt install g++-11
- cxx: g++-11
std: 17
install: sudo apt install g++-11
- cxx: g++-11
std: 20
install: sudo apt install g++-11


- cxx: clang++-3.5
install: sudo apt install clang-3.5
- cxx: clang++-3.6
install: sudo apt install clang-3.6
- cxx: clang++-3.7
install: sudo apt install clang-3.7
- cxx: clang++-3.8
install: sudo apt install clang-3.8
- cxx: clang++-3.9
install: sudo apt install clang-3.9
- cxx: clang++-4.0
install: sudo apt install clang-4.0
- cxx: clang++-5.0
install: sudo apt install clang-5.0
- cxx: clang++-6.0
install: sudo apt install clang-6.0
- cxx: clang++-7
install: sudo apt install clang-7
- cxx: clang++-8
install: sudo apt install clang-8
- cxx: clang++-9
install: sudo apt install clang-9
- cxx: clang++-10
install: sudo apt install clang-10
- cxx: clang++-11
install: sudo apt install clang-11


- cxx: clang++-6.0
std: 17
install: sudo apt install clang-6.0
- cxx: clang++-7
std: 17
install: sudo apt install clang-7
- cxx: clang++-8
std: 17
install: sudo apt install clang-8
- cxx: clang++-9
std: 17
install: sudo apt install clang-9
- cxx: clang++-10
std: 17
install: sudo apt install clang-10
- cxx: clang++-11
std: 17
install: sudo apt install clang-11

steps:
- uses: actions/checkout@v3

- name: Setup Toolchain
run: |
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial main'
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ xenial universe'
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main'
sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe'
${{matrix.install}}
- name: Configure CMake
env:
CXX: ${{matrix.cxx}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_STANDARD=${{matrix.std}}

- name: Build
run: cmake --build ${{github.workspace}}/build

- name: Test
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --target test
3 changes: 3 additions & 0 deletions external/expected/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\#*
.\#*
/build/
Loading

0 comments on commit 29ebf67

Please sign in to comment.