Skip to content
Open
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
41 changes: 41 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2025 Ember
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

name: Linux (GCC) CI
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]

jobs:
# Linux – Cached Debug Build
Ubuntu_x86_64_debug:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache Dependencies and Homebrew
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
~/.cache/Homebrew
dependencies
key: linux-deps-${{ hashFiles('build_linux.sh') }}
restore-keys: linux-deps-

- name: Cache Build Folder
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: linux-build-${{ hashFiles('CMakeLists.txt') }}
restore-keys: linux-build-

- name: Run Linux Build Script
run: |
chmod +x ./build_linux.sh
./build_linux.sh
41 changes: 41 additions & 0 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2025 Ember
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

name: macOS (Clang) CI
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]

jobs:
# macOS – Cached Debug Build
Apple_Silicon_debug:
runs-on: macos-15
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache Dependencies and Homebrew
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
/Users/runner/Library/Caches/Homebrew
dependencies
key: macOS-deps-${{ hashFiles('build_macos.sh') }}
restore-keys: macOS-deps-

- name: Cache Build Folder
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: macOS-build-${{ hashFiles('CMakeLists.txt') }}
restore-keys: macOS-build-

- name: Run macOS Build Script
run: |
chmod +x ./build_macos.sh
./build_macos.sh
67 changes: 67 additions & 0 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (c) 2025 Ember
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

name: Windows (MSVC) CI
on:
push:
branches: [ "development" ]
pull_request:
branches: [ "development" ]

jobs:
# Windows – Cached Debug Build
x86_64_debug:
runs-on: windows-2025
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache installed dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
dependencies
C:\mysql-connector-c++
key: win-deps-${{ hashFiles('build_windows.ps1') }}
restore-keys: win-deps-

- name: Cache Build Folder
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: win-build-${{ hashFiles('CMakeLists.txt') }}
restore-keys: win-build-

- name: Run Windows Build Script
shell: pwsh
run: .\build_windows.ps1

# Windows ARM – Cached Debug Build
ARM64_debug:
runs-on: windows-11-arm
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache installed dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
dependencies
C:\mysql-connector-c++
key: win_arm-deps-${{ hashFiles('build_windows.ps1') }}
restore-keys: win_arm-deps-

- name: Cache Build Folder
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: build
key: win_arm-build-${{ hashFiles('CMakeLists.txt') }}
restore-keys: win_arm-build-

- name: Run Windows Build Script
shell: pwsh
run: .\build_windows.ps1
10 changes: 8 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Copyright (c) 2025 Ember
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

name: Docker Image CI

on:
Expand All @@ -8,8 +14,8 @@ on:

jobs:

build:
runs-on: ubuntu-latest
Ubuntu_ARM64:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout Code
uses: actions/[email protected]
Expand Down
39 changes: 34 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,37 @@ set(version_file "${CMAKE_CURRENT_BINARY_DIR}/Version.cpp")
##############################
# Botan #
##############################
find_package(Botan 2.14.0 REQUIRED)
include_directories(${BOTAN_INCLUDE_DIRS})
find_package(Botan 3.6.1 REQUIRED)
# Check if the static target exists; otherwise fallback to the shared target.
if(TARGET Botan::Botan-static)
set(BOTAN_LIBRARY Botan::Botan-static)
message(STATUS "Using Botan static library")
elseif(TARGET Botan::Botan)
set(BOTAN_LIBRARY Botan::Botan)
message(STATUS "Using Botan shared library")
else()
message(FATAL_ERROR "No valid Botan target found")
endif()

##############################
# MySQL Connector C++ #
##############################
find_package(MySQLConnectorCPP REQUIRED)
include_directories(${MYSQLCCPP_INCLUDE_DIRS})
find_package(mysql-concpp REQUIRED)
# Check if the static JDBC target exists; otherwise fallback to the shared JDBC target.
if(TARGET mysql::concpp-jdbc-static)
set(MYSQLCCPP_LIBRARY mysql::concpp-jdbc-static)
message(STATUS "Using MySQL Connector/C++ JDBC static library")
elseif(TARGET mysql::concpp-jdbc)
set(MYSQLCCPP_LIBRARY mysql::concpp-jdbc)
message(STATUS "Using MySQL Connector/C++ JDBC shared library")
else()
message(FATAL_ERROR "No valid MySQL Connector/C++ JDBC target found")
endif()

##############################
# FlatBuffers #
##############################
find_package(FlatBuffers 2.0.8 REQUIRED)
find_package(flatbuffers 2.0.8 REQUIRED)

##############################
# zlib #
Expand Down Expand Up @@ -143,6 +161,17 @@ include_directories(${CMAKE_SOURCE_DIR}/deps)
include(BuildDBCLoaders)
include(BuildSparkServices)

# For Apple: Amend homebrew installed libraries to cmake's search path
if(APPLE)
file(GLOB HOME_BREW_LIB_DIRS "/opt/homebrew/opt/*/lib")
set(HOMEBREW_LINKER_FLAGS_LIST "")
foreach(libdir ${HOME_BREW_LIB_DIRS})
list(APPEND HOMEBREW_LINKER_FLAGS_LIST "-L${libdir}")
endforeach()
message(STATUS "Appending Homebrew linker flags: ${HOMEBREW_LINKER_FLAGS_LIST}")
add_link_options(${HOMEBREW_LINKER_FLAGS_LIST})
endif()

add_subdirectory(schemas)
set(cmake_ctest_arguments "CTEST_OUTPUT_ON_FAILURE")
enable_testing()
Expand Down
35 changes: 28 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL description="Development build environment"
# Update the distro and install our tools
RUN apt-get -y update && apt-get -y upgrade \
&& apt-get -y install software-properties-common \
&& apt-get -y install wget \
&& apt-get -y install wget tar \
# GCC stuff
&& apt-get -y install build-essential gcc-14 g++-14 \
# Clang stuff
Expand All @@ -22,8 +22,9 @@ RUN apt-get -y update && apt-get -y upgrade \
&& apt-get -y install cmake \
&& apt-get -y install git \
# Install required library packages
&& apt-get install -y libbotan-2-dev \
&& apt-get install -y libmysqlcppconn-dev \
&& apt-get install -y libbotan-3-dev \
&& apt-get install -y libmysqlclient-dev \
&& apt-get install -y libssl-dev \
&& apt-get install -y zlib1g-dev \
&& apt-get install -y libpcre3-dev \
&& apt-get install -y libflatbuffers-dev \
Expand All @@ -33,6 +34,22 @@ RUN apt-get -y update && apt-get -y upgrade \
&& ./bootstrap.sh --with-libraries=system,program_options,headers \
&& ./b2 link=static install -d0 -j $(nproc) cxxflags="-std=c++23"

# Replace the apt-get install of libmysqlcppconn-dev with a custom installer
RUN arch=$(uname -m) && case "$arch" in \
x86_64) url="https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-9.3.0-linux-glibc2.28-x86-64bit.tar.gz" ;; \
aarch64) url="https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-9.3.0-linux-glibc2.28-aarch64.tar.gz" ;; \
*) echo "Unsupported architecture: $arch" && exit 1 ;; esac && \
echo "Downloading MySQL Connector/C++ from ${url}" && \
wget "$url" -O /tmp/mysql-connector.tar.gz && \
mkdir -p /usr/lib/cmake/mysql-concpp && \
tar -zxf /tmp/mysql-connector.tar.gz -C /usr/lib/cmake/mysql-concpp --strip-components=1 && \
echo "Installing headers and libraries..." && \
mkdir -p /usr/include/mysql-cppconn && \
cp -r /usr/lib/cmake/mysql-concpp/include/* /usr/include/mysql-cppconn/ && \
cp -r /usr/lib/cmake/mysql-concpp/lib64/* /usr/local/lib/ && \
ldconfig && \
echo "MySQL Connector/C++ installed."

# Copy source
ARG working_dir=/usr/src/ember
COPY . ${working_dir}
Expand All @@ -42,18 +59,22 @@ WORKDIR ${working_dir}
# These can be overriden by passing them through to `docker build`
ARG build_optional_tools=1
ARG disable_threads=0
ARG build_type=Rel
ARG build_type=Debug
ARG install_dir=/usr/local/bin

# Patch the Botan config file for header paths: (THIS IS FIXED IN BOTAN 3.8 - REMOVE WHEN apt-get HAS UPDATED)
RUN sh -c 'arch=$(dpkg-architecture -qDEB_HOST_MULTIARCH) && \
BOTAN_CFG=$(find / -type f -iname "botan-config.cmake" 2>/dev/null | grep "/usr/lib/$arch" | head -n1) && \
[ -n "$BOTAN_CFG" ] && \
sed -i -e "s|\${_Botan_PREFIX}/include|/usr/include|g" -e "s|\${_Botan_PREFIX}/lib|/usr/lib/$arch|g" "$BOTAN_CFG"'

# Generate Makefile & compile
RUN --mount=type=cache,target=build \
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${build_type} \
-DCMAKE_INSTALL_PREFIX=${install_dir} \
-DBUILD_OPT_TOOLS=${build_optional_tools} \
-DDISABLE_EMBER_THREADS=${disable_threads} \
-DBOTAN_ROOT_DIR=/usr/include/botan-2/ \
-DBOTAN_LIBRARY=/usr/lib/x86_64-linux-gnu/libbotan-2.so \
&& cd build && make -j$(nproc) install \
&& make test

Expand All @@ -62,7 +83,7 @@ ARG install_dir=/usr/local/bin
ARG working_dir=/usr/src/ember
WORKDIR ${install_dir}
RUN apt-get -y update \
&& apt-get install -y libbotan-2-19 \
&& apt-get install -y libbotan-3-7 \
&& apt-get install -y libmysqlcppconn7v5 \
&& apt-get install -y mysql-client
COPY --from=builder ${install_dir} ${install_dir}
Expand Down
Loading
Loading