Skip to content

Commit 613a960

Browse files
committed
Add CI runs for pkg-config, standalone, and cmake find package
1 parent 7b32b18 commit 613a960

File tree

1 file changed

+201
-0
lines changed

1 file changed

+201
-0
lines changed

.github/workflows/ci.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,3 +953,204 @@ jobs:
953953
run: |
954954
cd ../boost-root/__build__
955955
ctest --output-on-failure --no-tests=error
956+
posix-standalone-test:
957+
strategy:
958+
fail-fast: false
959+
matrix:
960+
include:
961+
- os: ubuntu-24.04
962+
- os: macos-13
963+
- os: macos-14
964+
- os: macos-15
965+
966+
runs-on: ${{matrix.os}}
967+
968+
steps:
969+
- uses: actions/checkout@v4
970+
971+
- name: Configure and Install
972+
run: |
973+
mkdir build && cd build
974+
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
975+
cmake --build . --target install
976+
977+
978+
- name: Test with find_package
979+
run: |
980+
export PKG_CONFIG_PATH=~/.local/lib/pkgconfig:$PKG_CONFIG_PATH
981+
export CPATH=~/.local/include:$CPATH
982+
983+
mkdir ~/standalone_test
984+
cat > ~/standalone_test/CMakeLists.txt <<'EOF'
985+
cmake_minimum_required(VERSION 3.10)
986+
project(StandaloneTest)
987+
988+
find_package(boost_int128 REQUIRED)
989+
message(STATUS "boost_int128 found: ${boost_int128_FOUND}")
990+
991+
add_executable(main main.cpp)
992+
target_link_libraries(main PRIVATE Boost::int128)
993+
EOF
994+
995+
cat > ~/standalone_test/main.cpp <<'EOF'
996+
#include <boost/int128.hpp>
997+
#include <iostream>
998+
int main() {
999+
using namespace boost::int128;
1000+
uint128_t d{456};
1001+
std::cout << "Value: " << d << "\n";
1002+
return 0;
1003+
}
1004+
EOF
1005+
1006+
cd ~/standalone_test
1007+
mkdir build && cd build
1008+
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local ..
1009+
cmake --build .
1010+
1011+
posix-cmake-find-package-test:
1012+
strategy:
1013+
fail-fast: false
1014+
matrix:
1015+
include:
1016+
- os: ubuntu-24.04
1017+
1018+
runs-on: ${{ matrix.os }}
1019+
1020+
steps:
1021+
- uses: actions/checkout@v4
1022+
1023+
- name: Install packages
1024+
run: sudo apt install pkg-config
1025+
1026+
- name: Setup Boost
1027+
run: |
1028+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
1029+
LIBRARY=${GITHUB_REPOSITORY#*/}
1030+
echo LIBRARY: $LIBRARY
1031+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
1032+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
1033+
echo GITHUB_REF: $GITHUB_REF
1034+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
1035+
REF=${REF#refs/heads/}
1036+
echo REF: $REF
1037+
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
1038+
echo BOOST_BRANCH: $BOOST_BRANCH
1039+
cd ..
1040+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
1041+
cd boost-root
1042+
mkdir -p libs/$LIBRARY
1043+
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
1044+
git submodule update --init tools/boostdep
1045+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
1046+
1047+
- name: Configure and Install
1048+
run: |
1049+
cd ../boost-root
1050+
mkdir __build_install__ && cd __build_install__
1051+
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
1052+
cmake --build . --target install
1053+
1054+
- name: Create test project
1055+
run: |
1056+
export PKG_CONFIG_PATH=~/.local/lib/pkgconfig:$PKG_CONFIG_PATH
1057+
export CPATH=~/.local/include:$CPATH
1058+
1059+
echo "Cflags: $(pkg-config --cflags boost_int128)"
1060+
echo "Libs: $(pkg-config --libs boost_int128)"
1061+
1062+
mkdir -p ~/test_project
1063+
cat > ~/test_project/CMakeLists.txt <<'EOF'
1064+
cmake_minimum_required(VERSION 3.8)
1065+
project(TestFindPackage)
1066+
1067+
find_package(boost_int128 REQUIRED)
1068+
1069+
add_executable(test_main main.cpp)
1070+
target_link_libraries(test_main PRIVATE Boost::int128)
1071+
EOF
1072+
1073+
cat > ~/test_project/main.cpp <<'EOF'
1074+
#include <boost/int128.hpp>
1075+
#include <iostream>
1076+
int main() {
1077+
using namespace boost::int128;
1078+
uint128_t d{42};
1079+
std::cout << "Value: " << d << "\n";
1080+
return 0;
1081+
}
1082+
EOF
1083+
1084+
- name: Test find_package
1085+
run: |
1086+
cd ~/test_project
1087+
mkdir build && cd build
1088+
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
1089+
cmake --build .
1090+
1091+
posix-pkg-config-test:
1092+
strategy:
1093+
fail-fast: false
1094+
matrix:
1095+
include:
1096+
- os: ubuntu-24.04
1097+
1098+
runs-on: ${{ matrix.os }}
1099+
1100+
steps:
1101+
- uses: actions/checkout@v4
1102+
1103+
- name: Install packages
1104+
run: sudo apt install pkg-config
1105+
1106+
- name: Setup Boost
1107+
run: |
1108+
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
1109+
LIBRARY=${GITHUB_REPOSITORY#*/}
1110+
echo LIBRARY: $LIBRARY
1111+
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
1112+
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
1113+
echo GITHUB_REF: $GITHUB_REF
1114+
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
1115+
REF=${REF#refs/heads/}
1116+
echo REF: $REF
1117+
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
1118+
echo BOOST_BRANCH: $BOOST_BRANCH
1119+
cd ..
1120+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
1121+
cd boost-root
1122+
mkdir -p libs/$LIBRARY
1123+
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
1124+
git submodule update --init tools/boostdep
1125+
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
1126+
1127+
- name: Configure and Install
1128+
run: |
1129+
cd ../boost-root
1130+
mkdir __build_install__ && cd __build_install__
1131+
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
1132+
cmake --build . --target install
1133+
1134+
- name: Test pkg-config
1135+
run: |
1136+
export PKG_CONFIG_PATH=~/.local/lib/pkgconfig:$PKG_CONFIG_PATH
1137+
export CPATH=~/.local/include:$CPATH
1138+
1139+
echo "Cflags: $(pkg-config --cflags boost_int128)"
1140+
echo "Libs: $(pkg-config --libs boost_int128)"
1141+
1142+
mkdir -p ~/pkgconfig_test
1143+
cat > ~/pkgconfig_test/main.cpp <<'EOF'
1144+
#include <boost/int128.hpp>
1145+
#include <iostream>
1146+
int main() {
1147+
using namespace boost::int128;
1148+
uint128_t d{123};
1149+
std::cout << "Value: " << d << "\n";
1150+
return 0;
1151+
}
1152+
EOF
1153+
1154+
cd ~/pkgconfig_test
1155+
g++ main.cpp $(pkg-config --cflags --libs boost_int128) -o test_pkgconfig
1156+
./test_pkgconfig

0 commit comments

Comments
 (0)