Merge remote-tracking branch 'origin/main' into develop
Some checks failed
sgraves/cpp-build-system_mac/pipeline/head There was a failure building this commit
sgraves/cpp-build-system/pipeline/head There was a failure building this commit

This commit is contained in:
2025-12-13 09:38:21 -06:00
56 changed files with 171 additions and 181 deletions

6
.gitignore vendored
View File

@@ -12,3 +12,9 @@ support/Dockerfile
version.cpp version.cpp
version.rc version.rc
.DS_Store .DS_Store
*.gz
*.bz2
*.xz
*.zip
*.msi
*.exe

View File

@@ -37,6 +37,12 @@ pipeline {
} }
} }
stage('clean_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'clean_packages.sh' } } }
}
stage('grab_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'grab_packages.sh' } } }
}
stage('win32_shared') { stage('win32_shared') {
steps { script { retryWithBackoff(2, 5) { sh 'scripts/test_win32.sh shared' } } } steps { script { retryWithBackoff(2, 5) { sh 'scripts/test_win32.sh shared' } } }
} }

View File

@@ -36,6 +36,12 @@ pipeline {
} }
} }
stage('clean_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'clean_packages.sh' } } }
}
stage('grab_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'grab_packages.sh' } } }
}
stage('macos_aarch64_shared') { stage('macos_aarch64_shared') {
steps { steps {
script { retryWithBackoff(2, 5) { sh 'scripts/test_unix.sh shared' } } script { retryWithBackoff(2, 5) { sh 'scripts/test_unix.sh shared' } }

View File

@@ -36,6 +36,12 @@ pipeline {
} }
} }
stage('clean_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'clean_packages.cmd' } } }
}
stage('grab_packages') {
steps { script { retryWithBackoff(2, 5) { sh 'grab_packages.cmd' } } }
}
stage('msys2_x86_64_shared') { stage('msys2_x86_64_shared') {
steps { steps {
script { retryWithBackoff(2, 5) { bat 'scripts\\test_msys2.cmd shared "" x86_64' } } script { retryWithBackoff(2, 5) { bat 'scripts\\test_msys2.cmd shared "" x86_64' } }

View File

@@ -36,13 +36,26 @@ All builds are orchestrated through project scripts — **direct CMake invocatio
## 🚀 Getting Started ## 🚀 Getting Started
### 1⃣ Clone the Build System ### 1⃣ Clone the Build System and Grab Packages
```bash ```bash
git clone https://git.fifthgrid.com/sgraves/cpp-build-system.git git clone https://git.fifthgrid.com/sgraves/cpp-build-system.git
git clone https://github.com/sgraves76/cpp-build-system.git git clone https://github.com/sgraves76/cpp-build-system.git
cd cpp-build-system cd cpp-build-system
``` ```
Run the root-level `grab_packages.sh`/`grab_packages.cmd`
Example:
```bash
./grab_packages.sh
```
```cmd
grab_packages.cmd
```
This will download and validate all packages currently supported by `cpp-build-system`. They will be placed within the `support/3rd_party/` folder.
--- ---
### 2⃣ Create a New Project ### 2⃣ Create a New Project
@@ -52,11 +65,11 @@ Run the root-level `create_project.sh` with:
Example: Example:
```bash ```bash
./create_project.sh MyApp ~/dev ./create_project.sh MyApp ~/src
``` ```
This creates: This creates:
``` ```
~/dev/MyApp/ ~/src/MyApp/
``` ```
The new directory contains: The new directory contains:
@@ -70,7 +83,7 @@ The new directory contains:
### 3⃣ Configure the Project ### 3⃣ Configure the Project
In your new project directory (`~/dev/MyApp/`), edit these two files before your first build: In your new project directory (`~/src/MyApp/`), edit these two files before your first build:
> ⚠️ **Important Notice:** > ⚠️ **Important Notice:**
> Do **not modify** the root `CMakeLists.txt` file in your project. > Do **not modify** the root `CMakeLists.txt` file in your project.
@@ -155,7 +168,7 @@ Use the provided build wrappers — they take two arguments:
If you later want to **add back packages** you previously turned off (and which `cleanup.sh` removed), run the **templates** update script from the `cpp-build-system` repository root, pointing it at your project path: If you later want to **add back packages** you previously turned off (and which `cleanup.sh` removed), run the **templates** update script from the `cpp-build-system` repository root, pointing it at your project path:
```bash ```bash
# from the cpp-build-system repo root # from the cpp-build-system repo root
./update_project.sh ~/dev/MyApp ./update_project.sh ~/src/MyApp
``` ```
This will **restore all template-managed packages and scripts** (including `cleanup.sh`) into your project so you can re-enable dependencies via `config.sh` and rebuild. This will **restore all template-managed packages and scripts** (including `cleanup.sh`) into your project so you can re-enable dependencies via `config.sh` and rebuild.

11
clean_packages.cmd Normal file
View File

@@ -0,0 +1,11 @@
@echo off
setlocal
pushd "%~dp0"
call src\scripts\setup_msys2.cmd
call mingw64 -no-start ./clean_packages.sh
popd
endlocal

21
clean_packages.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
CURRENT_DIR=$(realpath "$0")
CURRENT_DIR=$(dirname "${CURRENT_DIR}")
pushd "${CURRENT_DIR}"
mapfile -t FILE_LIST < <(find support/3rd_party/ -type f \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' -o -name '*.msi' -o -name '*.zip' \))
for NAME in "${FILE_LIST[@]}"; do
echo "Removing ${NAME}"
rm -f "${NAME}"
done
mapfile -t FILE_LIST < <(find support/3rd_party/mingw64/ -type f \( -name '*.exe' \))
for NAME in "${FILE_LIST[@]}"; do
echo "Removing ${NAME}"
rm -f "${NAME}"
done
popd

11
grab_packages.cmd Normal file
View File

@@ -0,0 +1,11 @@
@echo off
setlocal
pushd "%~dp0"
call src\scripts\setup_msys2.cmd
call mingw64 -no-start ./grab_packages.sh
popd
endlocal

View File

@@ -6,66 +6,34 @@ CURRENT_DIR=$(dirname "${CURRENT_DIR}")
. "${CURRENT_DIR}/src/scripts/versions.sh" . "${CURRENT_DIR}/src/scripts/versions.sh"
. "${CURRENT_DIR}/src/scripts/libraries.sh" . "${CURRENT_DIR}/src/scripts/libraries.sh"
function check_should_update() { function download_package() {
local NAME=$1 local NAME=$1
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ }) local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] || if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ]; then
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
return 0
fi
return 1
}
function download_and_update_hash() {
local NAME=$1
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
local CLEANUP_LIST=(${PROJECT_CLEANUP[${NAME}]//:/ })
if [ "${NAME}" == "GTEST" ]; then
CLEANUP_LIST=(${PROJECT_CLEANUP["TESTING"]//:/ })
fi
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ] && [ "${CLEANUP_LIST[0]}" != "" ]; then
rm -r ${CURRENT_DIR}/support/${CLEANUP_LIST[0]}
fi
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
echo "failed $NAME" echo "failed $NAME"
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
exit 1 exit 1
fi fi
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}"
sha256sum ${ITEM_LIST[1]} >${ITEM_LIST[1]}.sha256 pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}/"
if ! sha256sum -c "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"; then
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
echo "failed sha256 validation: $NAME"
exit 1
fi
popd popd
fi fi
local HASH=$(cat support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256 | awk '{print $1}')
HASH_LIST+=("set(${NAME}_HASH ${HASH})")
} }
function create_hashes_cmake() { function download_packages() {
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ]; then download_package $NAME
download_and_update_hash $NAME
fi
done done
} }
pushd "${CURRENT_DIR}" pushd "${CURRENT_DIR}"
HASH_LIST=() download_packages
create_hashes_cmake
if check_should_update BOOST || check_should_update BOOST2; then
rm -f support/3rd_party/boost_*
fi
download_and_update_hash BOOST
download_and_update_hash BOOST2
(printf "%s\n" "${HASH_LIST[@]}" | sort) >${CURRENT_DIR}/cmake/hashes.cmake
popd popd

74
scripts/create_packages.sh Executable file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/env bash
SCRIPTS_DIR=$(dirname "$0")
SCRIPTS_DIR=$(realpath ${SCRIPTS_DIR})
CURRENT_DIR=${SCRIPTS_DIR}/..
CURRENT_DIR=$(realpath "${CURRENT_DIR}")
. "${CURRENT_DIR}/src/scripts/versions.sh"
. "${CURRENT_DIR}/src/scripts/libraries.sh"
function check_should_update() {
local NAME=$1
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
return 0
fi
return 1
}
function download_and_update_hash() {
local NAME=$1
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ] ||
[ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256" ]; then
local CLEANUP_LIST=(${PROJECT_CLEANUP[${NAME}]//:/ })
if [ "${NAME}" == "GTEST" ]; then
CLEANUP_LIST=(${PROJECT_CLEANUP["TESTING"]//:/ })
fi
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ] && [ "${CLEANUP_LIST[0]}" != "" ]; then
rm -r ${CURRENT_DIR}/support/${CLEANUP_LIST[0]}
fi
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
echo "failed $NAME"
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
exit 1
fi
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}"
sha256sum ${ITEM_LIST[1]} >${ITEM_LIST[1]}.sha256
popd
fi
local HASH=$(cat support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256 | awk '{print $1}')
HASH_LIST+=("set(${NAME}_HASH ${HASH})")
}
function create_hashes_cmake() {
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
if [ "${NAME}" != "BOOST" ] && [ "${NAME}" != "BOOST2" ]; then
download_and_update_hash $NAME
fi
done
}
pushd "${CURRENT_DIR}"
HASH_LIST=()
create_hashes_cmake
if check_should_update BOOST || check_should_update BOOST2; then
rm -f support/3rd_party/boost_*
fi
download_and_update_hash BOOST
download_and_update_hash BOOST2
(printf "%s\n" "${HASH_LIST[@]}" | sort) >${CURRENT_DIR}/cmake/hashes.cmake
popd

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.