Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
submodules: true
- name: Add cloned repo as safe
run: sh -c "git config --global --add safe.directory $PWD"
- name: Init required submodules
Comment thread
pawelchcki marked this conversation as resolved.
run: git submodule update --init --depth=1 deps/dd-trace-cpp deps/nginx-datadog
- name: Configure
run: cmake --preset=ci-dev -B build .
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
submodules: true
- name: Add cloned repo as safe
run: sh -c "git config --global --add safe.directory $PWD"
- name: Init required submodules
run: git submodule update --init --depth=1 deps/dd-trace-cpp deps/nginx-datadog
- name: Configure
run: cmake --preset ci-release -B build .
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
submodules: true
- name: Add cloned repo as safe
run: sh -c "git config --global --add safe.directory $PWD"
- name: Init required submodules
run: git submodule update --init --depth=1 deps/dd-trace-cpp deps/nginx-datadog
- name: Configure
run: cmake --preset=ci-dev -B build .
- name: Build
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
path = deps/nginx-datadog
url = ../httpd-datadog.git
branch = mirror-nginx-datadog
[submodule "deps/inject-browser-sdk"]
path = deps/inject-browser-sdk
url = ../inject-browser-sdk.git
17 changes: 0 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,6 @@ if (NOT HTTPD_SRC_DIR)
endif ()

include(cmake/utils.cmake)
include(cmake/deps/fmt.cmake)

if (HTTPD_DATADOG_ENABLE_RUM)
include(FetchContent)

set(INJECT_BROWSER_SDK_GIT_REF "49245e1c6ed8275990bb910125187e0aaad09e3d" CACHE STRING
"Git tag/branch for inject-browser-sdk")

FetchContent_Declare(
InjectBrowserSDK
GIT_REPOSITORY https://github.com/DataDog/inject-browser-sdk.git
GIT_TAG ${INJECT_BROWSER_SDK_GIT_REF}
)
FetchContent_MakeAvailable(InjectBrowserSDK)

include(cmake/deps/rapidjson.cmake)
endif ()

add_library(httpd INTERFACE)
target_include_directories(
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

## Fork, Clone, Branch and Create your PR

When cloning the repo, you have to initialize the submodules:
When cloning the repo, initialize the submodules you need. For a standard build:

```sh
git submodule update --init --recursive
git submodule update --init deps/dd-trace-cpp deps/nginx-datadog
```

The `deps/inject-browser-sdk` submodule is a private repo and is only required when building with `-DHTTPD_DATADOG_ENABLE_RUM=ON`. If you have access, use `--recursive` instead to pull it as well.

### Rules
- Follow the pattern of what you already see in the code.
- Follow the coding style.
Expand Down
14 changes: 4 additions & 10 deletions cmake/deps/fmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 10.2.1
EXCLUDE_FROM_ALL
)

FetchContent_GetProperties(fmt)
if(NOT fmt_POPULATED)
FetchContent_Populate(fmt)

set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(${fmt_SOURCE_DIR} ${fmt_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()

set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
FetchContent_MakeAvailable(fmt)
16 changes: 16 additions & 0 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
include(${CMAKE_SOURCE_DIR}/cmake/deps/fmt.cmake)

add_subdirectory(dd-trace-cpp)

# Force POSITION_INDEPENDENT_CODE (PIC) because mod_datadog.so is loaded via
# dlopen, but dd-trace-cpp sets this based on BUILD_SHARED_LIBS, whereas we
# link with the static library.
set_target_properties(dd-trace-cpp-objects PROPERTIES POSITION_INDEPENDENT_CODE ON)

if (HTTPD_DATADOG_ENABLE_RUM)
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inject-browser-sdk/CMakeLists.txt")
message(FATAL_ERROR
"deps/inject-browser-sdk submodule is not initialized. "
"Run: git submodule update --init --recursive")
endif ()
# mod_datadog/CMakeLists.txt references ${injectbrowsersdk_SOURCE_DIR}, which
# FetchContent used to set; replicate it for the submodule layout.
set(injectbrowsersdk_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/inject-browser-sdk" CACHE INTERNAL "")
add_subdirectory(inject-browser-sdk EXCLUDE_FROM_ALL)

include(${CMAKE_SOURCE_DIR}/cmake/deps/rapidjson.cmake)
endif ()
1 change: 1 addition & 0 deletions deps/inject-browser-sdk
Submodule inject-browser-sdk added at 49245e
Loading