Skip to content

Commit

Permalink
consolidate third party
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminghuang committed Sep 4, 2024
1 parent a8e4243 commit 86dee5c
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- main
- develop
- dev/**
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
branches:
- main
- develop
- compatiblity_test*
- dev/**
pull_request:
branches:
- main
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- main
- develop
- dev/**
pull_request:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- main
- develop
- msvc_test
- dev/**
pull_request:
branches:
- main
Expand Down
34 changes: 2 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ option(HPP_PROTO_ENABLE_SANITIZER "Enable address and undefined behavor sanitize


set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(cmake/CPM.cmake)

if(APPLE)
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (HPP_PROTO_ENABLE_SANITIZER)
if (MSVC)
Expand All @@ -34,26 +33,7 @@ if (HPP_PROTO_ENABLE_SANITIZER)
endif()
endif()

CPMAddPackage(
NAME glaze
GIT_TAG v2.9.5.mod
GITHUB_REPOSITORY huangminghuang/glaze
)

CPMAddPackage(
NAME is_utf8
VERSION 1.3.2
GITHUB_REPOSITORY simdutf/is_utf8
DOWNLOAD_ONLY ON
)

add_subdirectory(${is_utf8_SOURCE_DIR}/src ${is_utf8_BINARY_DIR})

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
file(REAL_PATH ${CMAKE_CXX_COMPILER} CLANG_REAL_PATH)
cmake_path(GET CLANG_REAL_PATH PARENT_PATH CLANG_DIR)
endif()

include(third-party.cmake)

add_library(libhpp_proto INTERFACE)
target_include_directories(libhpp_proto INTERFACE
Expand Down Expand Up @@ -83,16 +63,6 @@ else()
endif()

if(HPP_PROTO_TESTS)
CPMAddPackage(
NAME ut
GITHUB_REPOSITORY boost-ext/ut
VERSION 2.0.1
DOWNLOAD_ONLY ON
)
add_library(Boost::ut INTERFACE IMPORTED)
target_include_directories(Boost::ut INTERFACE ${ut_SOURCE_DIR}/include)
target_compile_definitions(Boost::ut INTERFACE BOOST_UT_DISABLE_MODULE)

enable_testing()
add_subdirectory(unittests)
include(CTest)
Expand Down
12 changes: 1 addition & 11 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
CPMAddPackage(
NAME benchmark
GITHUB_REPOSITORY google/benchmark
VERSION 1.8.3
OPTIONS
"BENCHMARK_ENABLE_TESTING OFF"
"BENCHMARK_ENABLE_INSTALL OFF"
)


set(proto_files benchmark_messages_proto3.proto benchmark_messages_proto2.proto packed_repeated_message.proto)

# disable clang-tidy check for generated file
configure_file(../clang-tidy-disable-all-checks .clang-tidy)

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/owning)
add_library(hpp_owning_benchmark_messages_lib INTERFACE ${proto_files})
protobuf_generate(TARGET hpp_owning_benchmark_messages_lib
Expand Down
2 changes: 0 additions & 2 deletions clang-tidy-disable-all-checks

This file was deleted.

39 changes: 39 additions & 0 deletions third-party.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include(cmake/CPM.cmake)

CPMAddPackage(
NAME glaze
GIT_TAG v2.9.5.mod
GITHUB_REPOSITORY huangminghuang/glaze
)

CPMAddPackage(
NAME is_utf8
VERSION 1.3.2
GITHUB_REPOSITORY simdutf/is_utf8
DOWNLOAD_ONLY ON
)

add_subdirectory(${is_utf8_SOURCE_DIR}/src ${is_utf8_BINARY_DIR})

if(HPP_PROTO_TESTS)
CPMAddPackage(
NAME ut
GITHUB_REPOSITORY boost-ext/ut
VERSION 2.0.1
DOWNLOAD_ONLY ON
)
add_library(Boost::ut INTERFACE IMPORTED)
target_include_directories(Boost::ut INTERFACE ${ut_SOURCE_DIR}/include)
target_compile_definitions(Boost::ut INTERFACE BOOST_UT_DISABLE_MODULE)
endif()

if(HPP_PROTO_BENCHMARKS)
CPMAddPackage(
NAME benchmark
GITHUB_REPOSITORY google/benchmark
VERSION 1.8.3
OPTIONS
"BENCHMARK_ENABLE_TESTING OFF"
"BENCHMARK_ENABLE_INSTALL OFF"
)
endif()
3 changes: 0 additions & 3 deletions tutorial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ project(hpp_proto_tutorial

if(PROJECT_IS_TOP_LEVEL)
find_package(hpp_proto CONFIG REQUIRED)
else()
# disable clang-tidy check for generated file
configure_file(../clang-tidy-disable-all-checks .clang-tidy)
endif()


Expand Down

0 comments on commit 86dee5c

Please sign in to comment.