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
2 changes: 1 addition & 1 deletion .github/workflows/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ check_and_install() {
}

# Install packages if they don't exist
check_and_install postgresql # Check and install PostgreSQL
check_and_install postgresql # Check and install PostgreSQL (which includes libpq)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow scripts reference the separate Homebrew libpq formula (e.g., brew --prefix libpq in build.sh). Installing postgresql doesn’t guarantee brew --prefix libpq will work, so CI can still fail unless libpq is installed explicitly (or the other scripts are updated to use postgresql’s prefix).

Suggested change
check_and_install postgresql # Check and install PostgreSQL (which includes libpq)
check_and_install postgresql # Check and install PostgreSQL
check_and_install libpq # Check and install the standalone libpq formula used by other workflow scripts

Copilot uses AI. Check for mistakes.
check_and_install pkg-config # Check and install pkg-config
16 changes: 7 additions & 9 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ cd ./external/libpqxx
mkdir -p build
cd ./build

# Generate build system files using CMake
# '..' points to the libpqxx root directory containing CMakeLists.txt
cmake ..
# Expose paths so CMake finds libpq
export PATH="$(brew --prefix libpq)/bin:$PATH"
export PKG_CONFIG_PATH="$(brew --prefix libpq)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$(brew --prefix libpq)"
Comment on lines +15 to +17
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script now relies on brew --prefix libpq, but the CI install step (brew.sh) installs postgresql (and not the libpq formula). On a clean runner, brew --prefix libpq will fail unless libpq is installed. Either install libpq in brew.sh (and use its prefix), or switch these exports to use the installed postgresql prefix instead.

Suggested change
export PATH="$(brew --prefix libpq)/bin:$PATH"
export PKG_CONFIG_PATH="$(brew --prefix libpq)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$(brew --prefix libpq)"
POSTGRESQL_PREFIX="$(brew --prefix postgresql)"
export PATH="$POSTGRESQL_PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$POSTGRESQL_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$POSTGRESQL_PREFIX"

Copilot uses AI. Check for mistakes.

# Configure the build with specific C++ compiler flags:
# -std=c++20: Use C++20 standard
# -O3: Enable maximum optimization
# --enable-silent-rules: Reduce build output verbosity
./configure CXXFLAGS="-std=c++20 -O3" --enable-silent-rules
# 1. Generate build files (Passing your CXX flags directly to CMake instead of configure)
cmake .. -DCMAKE_CXX_STANDARD=20 -DCMAKE_BUILD_TYPE=Release

# Compile libpqxx using generated build files
# 2. Compile libpqxx
make
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
-derivedDataPath "${RUNNER_TEMP}/Build/DerivedData"
HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/"
LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib/pkgconfig -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14 -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pgxs -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pkgconfig"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTHER_LDFLAGS uses $(brew --prefix pkgconf) and $(brew --prefix postgresql@18), but this workflow installs pkg-config and postgresql in brew.sh. As-is, brew --prefix pkgconf / brew --prefix postgresql@18 will fail on runners unless those formulas are installed. Either (a) update the prefixes to match installed formulas (pkg-config, postgresql or libpq), or (b) update brew.sh to install pkgconf and postgresql@18 explicitly.

Suggested change
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkg-config)/lib -L$(brew --prefix pkg-config)/lib/pkgconfig -L$(brew --prefix postgresql)/lib/postgresql -L$(brew --prefix postgresql)/lib/postgresql/pgxs -L$(brew --prefix postgresql)/lib/postgresql/pkgconfig"

Copilot uses AI. Check for mistakes.
clean build test
| xcpretty -r junit && exit ${PIPESTATUS[0]}
- name: Convert coverage report to sonarqube format
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ TestResult
xcuserdata/
xcuserstate/
TestResult.xcresult/
sonarqube-generic-coverage.xml
sonarqube-generic-coverage.xml
external/libpqxx
20 changes: 8 additions & 12 deletions backtesting-engine-cpp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3785,9 +3785,8 @@
);
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "";
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(SRCROOT)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Comment on lines 3787 to 3790
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-codes a Homebrew Cellar path to postgresql@18/18.3, which is machine- and version-specific and will break for anyone without that exact installation. Prefer using a stable path via build settings (e.g., $(shell brew --prefix ...) in a script-driven xcconfig, or linking against libpq via pkg-config) rather than committing a Cellar versioned path into the project.

Copilot uses AI. Check for mistakes.
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
Expand All @@ -3808,9 +3807,8 @@
);
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "";
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(SRCROOT)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Comment on lines 3809 to 3812
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This build configuration hard-codes a Homebrew Cellar path for postgresql@18/18.3, which isn’t portable across machines/CI and will break on version bumps. Use a stable prefix (Homebrew opt path / brew --prefix ...) or pkg-config-driven linking instead of committing a versioned Cellar path.

Copilot uses AI. Check for mistakes.
OTHER_LDFLAGS = "";
OTHER_LIBTOOLFLAGS = "";
Expand All @@ -3831,9 +3829,8 @@
"\"$(SRCROOT)/external/",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(PROJECT_DIR)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Comment on lines 3831 to 3834
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIBRARY_SEARCH_PATHS includes a versioned Homebrew Cellar path (/opt/homebrew/Cellar/postgresql@18/18.3/...). That path will differ across developer machines and will change on upgrades, making the project brittle. Prefer referencing a stable prefix (e.g., Homebrew opt symlink) or resolving via pkg-config/xcconfig rather than a Cellar version path.

Copilot uses AI. Check for mistakes.
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.mccaffers.tests;
Expand All @@ -3854,9 +3851,8 @@
"\"$(SRCROOT)/external/",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(PROJECT_DIR)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding /opt/homebrew/Cellar/postgresql@18/18.3/... into LIBRARY_SEARCH_PATHS ties the project to one specific Homebrew install/version. This is likely to break in CI and for other developers. Use a stable opt path (or brew --prefix resolved via an xcconfig/script) or pkg-config to locate libpq instead.

Suggested change
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
"/opt/homebrew/opt/postgresql@18/lib/postgresql",

Copilot uses AI. Check for mistakes.
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.mccaffers.tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "100.85.44.114"
argument = "localhost"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
Expand Down
2 changes: 1 addition & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ output=$(echo "$json" | base64)

# Step 6: Run the tests for now (/executable) from the root directory
# Passing two arguements, the destination of the QuestDB and the Strategy JSON (in base64)
./"$BUILD_DIR/$EXECUTABLE_NAME" 100.85.44.114 "$output"
./"$BUILD_DIR/$EXECUTABLE_NAME" localhost "$output"

11 changes: 7 additions & 4 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
xcodebuild \
-project backtesting-engine-cpp.xcodeproj \
-scheme tests \
HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib/pkgconfig -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14 -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pgxs -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pkgconfig" \
clean build test
clean build test
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
Comment on lines +6 to +9
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out HEADER_SEARCH_PATHS / LIBRARY_SEARCH_PATHS / OTHER_LDFLAGS lines are placed after clean build test, so uncommenting them later won’t affect the xcodebuild invocation (the command already ended). If these are meant to be optional overrides, keep them within the continued xcodebuild command (before clean build test) with the appropriate line continuations.

Suggested change
clean build test
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
clean build test

Copilot uses AI. Check for mistakes.



Loading