Skip to content

Commit 2ba6ac4

Browse files
committed
Merge branch 'hostilefork-github-workflow'
2 parents 80ab3f7 + 19d72af commit 2ba6ac4

21 files changed

+349
-50
lines changed

.github/workflows/linux-gcc-build.yml

+242
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
#
2+
# File: %linux-gcc-build.yml
3+
#
4+
#=============================================================================#
5+
#
6+
# This does Linux builds on GitHub's Ubuntu container, using gcc.
7+
#
8+
9+
name: Linux GCC
10+
11+
12+
# When To Trigger Builds
13+
#
14+
on:
15+
push:
16+
branches: [
17+
master, # for now do a linux build on every push to master
18+
linux, # pushing to a branch called "linux" builds this
19+
github-workflow # specifically pushing github-workflow branch
20+
]
21+
pull_request:
22+
branches: [
23+
master
24+
]
25+
workflow_dispatch: # Allows running this workflow manually from Actions tab
26+
27+
28+
# Standardize to use bash on all platforms.
29+
#
30+
defaults:
31+
run:
32+
shell: bash
33+
34+
35+
# Each "Job" runs in its own VM, and a workflow run is made up of one or more
36+
# jobs that can run sequentially or in parallel.
37+
#
38+
jobs:
39+
linux-gcc-build: # Name of this workflow's only job
40+
41+
# https://github.com/actions/virtual-environments#available-environments
42+
#
43+
# Building on older available Ubuntus means the GLIBC used by the EXE will
44+
# run on newer Ubuntus. The reverse is not true.
45+
#
46+
runs-on: ubuntu-20.04
47+
48+
49+
# Build Matrix (add as many permutations as desired)
50+
#
51+
strategy:
52+
matrix:
53+
include:
54+
- rigorous: ON
55+
build_type: Debug
56+
sanitize: ON
57+
58+
- rigorous: ON
59+
build_type: Release
60+
sanitize: OFF
61+
62+
63+
# Environment Variables
64+
#
65+
# (Proxy build matrix variables to environment variables so that behavior
66+
# in script code used here doesn't need GitHub-Workflow-specific syntax)
67+
#
68+
env:
69+
RIGOROUS: ${{ matrix.rigorous }}
70+
BUILD_TYPE: ${{ matrix.build_type }}
71+
SANITIZE: ${{ matrix.sanitize }}
72+
73+
74+
# Steps are a sequence of tasks that will be executed within a single VM
75+
# as part of the job.
76+
#
77+
steps: # (no indentatation needed below; so indent the minimum!)
78+
79+
80+
#====# CHECKOUT STEPS #=====================================================#
81+
82+
83+
# Checkout Action
84+
#
85+
# https://github.com/actions/checkout
86+
#
87+
- uses: actions/checkout@v4
88+
with:
89+
path: "bezitopo/"
90+
91+
92+
# Portably Capture Git Hashes
93+
#
94+
- name: Grab Git Hash and Short Hash Into Environment Variables
95+
run: |
96+
cd bezitopo
97+
git_commit="$(git show --format="%H" --no-patch)"
98+
git_commit_short="$(git show --format="%h" --no-patch)"
99+
echo "GIT_COMMIT=$git_commit" >> $GITHUB_ENV
100+
echo "GIT_COMMIT_SHORT=$git_commit_short" >> $GITHUB_ENV
101+
102+
103+
#====# TOOLCHAIN INSTALLATION STEPS #=======================================#
104+
105+
106+
# Install Qt Libraries
107+
#
108+
# https://github.com/jurplel/install-qt-action
109+
#
110+
- name: Install Qt
111+
uses: jurplel/install-qt-action@v4
112+
with:
113+
aqtversion: '==3.1.*'
114+
version: '5.15.2'
115+
host: 'linux'
116+
target: 'desktop'
117+
arch: 'gcc_64'
118+
cache: 'true'
119+
cache-key-prefix: 'install-qt-action'
120+
121+
122+
# Install OpenGL Dependencies
123+
#
124+
# Mesa is an open-source implementation of the OpenGL specification for 3D
125+
# graphics. GLU is the OpenGL Utility library, which includes higher-level
126+
# drawing routines and support for NURBS (Non-Uniform Rational B-Splines)
127+
#
128+
- name: Install Mesa Common and GLU Libraries
129+
run: |
130+
sudo apt install mesa-common-dev libglu1-mesa-dev
131+
132+
133+
# Show a little bit of sanity check information.
134+
#
135+
- name: Output System Information
136+
run: |
137+
echo "GCC version check:"
138+
gcc -v
139+
140+
141+
#====# BUILD STEPS #========================================================#
142+
143+
144+
# Generate Makefile
145+
#
146+
# Note: Should not have to set -DCMAKE_PREFIX_PATH=<...> as the GitHub
147+
# Action that installed Qt is supposed to set the enviornment correctly.
148+
#
149+
- name: Use CMake to Generate a makefile
150+
run: |
151+
mkdir build
152+
cd build
153+
154+
cmake \
155+
-DRIGOROUS=$RIGOROUS \
156+
-DSANITIZE=$SANITIZE \
157+
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
158+
../bezitopo/ # directory containing CMakeLists.txt
159+
160+
161+
# Run Make
162+
#
163+
# At time of writing, 2 jobs is the most the GitHub Workflow runners do.
164+
#
165+
- name: Run Make
166+
working-directory: build/
167+
run: |
168+
make -j 2
169+
170+
171+
# https://github.com/actions/upload-artifact
172+
#
173+
- name: Optional Download of Build Files Before Tests
174+
if: false # Change this to true to download a file
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: downloaded-file-name.ext
178+
path: build/some-file.ext
179+
180+
181+
#====# TESTING STEPS #======================================================#
182+
183+
- name: Basic Smoke Test (Run Bezitopo and Exit)
184+
working-directory: build/
185+
run: |
186+
echo "exit" | ./bezitopo
187+
188+
189+
- name: Fetch Independence Park File From Website
190+
working-directory: build/
191+
run: |
192+
curl -o topo0.asc http://bezitopo.org/topo0.asc
193+
194+
195+
- name: Test Independence Park Processing Command
196+
working-directory: build/
197+
run: |
198+
(echo "indpark"; echo "exit") | ./bezitopo
199+
200+
201+
- name: Run Bezitest
202+
if: false # !!! At time of writing, bezitest segfaults
203+
working-directory: build/
204+
run: |
205+
./bezitest
206+
207+
208+
#====# DEPLOY STEPS (TBD) #==================================================#
209+
210+
# !!! This is how you would do deployments of the build products to AWS if
211+
# that were something you wanted to do.
212+
213+
214+
# Configure AWS Credentials
215+
#
216+
# https://github.com/aws-actions/configure-aws-credentials
217+
#
218+
# This is disabled with `if: false`, but would be something along the
219+
# lines of `if: github.ref = 'refs/heads/master`
220+
#
221+
- name: Configure AWS Credentials
222+
if: false # disabled
223+
uses: aws-actions/configure-aws-credentials@v4
224+
with:
225+
aws-access-key-id: ${{ secrets.YOUR_GITHUB_AWS_ACCESS_KEY }}
226+
aws-secret-access-key: ${{ secrets.YOUR_GITHUB_AWS_SECRET_KEY }}
227+
aws-region: us-east-1
228+
229+
230+
# Upload Files to AWS
231+
#
232+
- name: Upload Files to AWS
233+
if: false # disabled
234+
run: |
235+
cd build
236+
NEW_NAME="bezitopo-${GIT_COMMIT_SHORT}${VARIATION}"
237+
MIME_TYPE="" # e.g. "--content-type application/wasm"
238+
239+
local=bezitopo
240+
lastpart=ci-builds/${NEW_NAME}
241+
remote=s3://${AWS_S3_BUCKET_NAME}/$lastpart
242+
aws s3 cp $local $remote $MIME_TYPE

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
#Ignore backup files
22
*~
33
*.backup
4+
5+
# Ignore User's Visual Studio Code Configuration Files
6+
.vscode/

AUTHORS.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
-- Organize code into src/
66
- Tom Kacvinsky <[email protected]>
77
-- Apple Silicon testing
8+
- Brian Dickens <[email protected]>
9+
-- Continuous integration and warning fixes
810

911
# Projections
1012
- Pierre Abbat <[email protected]>

CMakeLists.txt

+44-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
cmake_minimum_required(VERSION 3.5.0)
12
project(bezitopo)
2-
cmake_minimum_required(VERSION 3.1.0)
3+
34
# Copyright 2012-2022,2024 Pierre Abbat.
45
# Copyright 2020 звездочёт.
56
# This file is part of Bezitopo.
@@ -42,6 +43,47 @@ set(FUZZ none)
4243
#Setting FUZZ to boldatni disables reading all geoid formats except boldatni
4344
#in convertgeoid and disables the boldatni magic string check.
4445

46+
# To build with Address Sanitizer: cmake -DSANITIZE=ON <...>
47+
# The build products are slower and bigger, but run faster than using Valgrind.
48+
# See: https://clang.llvm.org/docs/AddressSanitizer.html
49+
#
50+
option(SANITIZE "Enable AddressSanitizer" OFF)
51+
if (SANITIZE)
52+
message(STATUS "AddressSanitizer enabled")
53+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
54+
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
55+
endif()
56+
57+
# To enable rigorous compilation settings: cmake -DRIGOROUS=ON <...>
58+
# This converts all warnings to errors and raises the compiler warning levels.
59+
# Some useful warnings are disabled pending review of stylistic choices
60+
#
61+
option(RIGOROUS "Enable rigorous compilation settings" OFF)
62+
if (RIGOROUS)
63+
message(STATUS "Rigorous compilation settings enabled")
64+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
65+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -pedantic")
66+
set(DISABLED_WARNINGS
67+
-Wno-sign-compare
68+
-Wno-unused-parameter
69+
-Wno-unused-variable
70+
-Wno-unused-but-set-variable
71+
-Wno-overloaded-virtual
72+
-Wno-parentheses
73+
-Wno-empty-body
74+
-Wno-implicit-fallthrough
75+
-Wno-maybe-uninitialized # a bad one to disable!
76+
-Wno-unused-result # also not good to turn off
77+
)
78+
foreach(WARNING ${DISABLED_WARNINGS})
79+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING}")
80+
endforeach()
81+
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
82+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX")
83+
# TBD: MSVC warning disablements to get RIGOROUS working
84+
endif ()
85+
endif()
86+
4587
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
4688
find_package(Qt5 COMPONENTS Core Widgets Gui LinguistTools REQUIRED)
4789
find_package(FFTW)
@@ -130,7 +172,7 @@ set(sourcelib src/angle.cpp
130172
src/boundrect.cpp
131173
src/breakline.cpp
132174
src/circle.cpp
133-
src/cogo.cpp
175+
src/cogo.cpp
134176
src/cogospiral.cpp
135177
src/color.cpp
136178
src/contour.cpp

src/angle.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,13 @@ string radtoangle(double angle,int64_t unitp)
313313
dig=angmult-base*trunc(angmult/base);
314314
angmult=trunc(angmult/base);
315315
sprintf(digit,(base>10)?"%02d":"%01d",dig);
316-
if (base>10)
317-
if (ret.substr(0,1)==".")
318-
ret+=(prec>60)?"":"";
319-
else
320-
strcat(digit,(prec>60)?"":"");
321-
ret=digit+ret;
316+
if (base>10) {
317+
if (ret.substr(0,1)==".")
318+
ret+=(prec>60)?"":"";
319+
else
320+
strcat(digit,(prec>60)?"":"");
321+
ret=digit+ret;
322+
}
322323
}
323324
if (base>10)
324325
ret=unitsign+ret;

src/bezier.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "rootfind.h"
3636
using namespace std;
3737

38-
const char ctrlpttab[16]=
38+
const unsigned char ctrlpttab[16]=
3939
{
4040
3, 3, 3, 3,
4141
3, 3, 2, 4,

src/bezitest.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <csignal>
3131
#include <cfloat>
3232
#include <cstring>
33-
#include <QTime>
33+
#include <QElapsedTimer>
3434
#include "config.h"
3535
#include "point.h"
3636
#include "cogo.h"
@@ -1923,7 +1923,7 @@ void testmanysum()
19231923
double odd[32];
19241924
long double oddl[32];
19251925
int pairtime=0;
1926-
QTime starttime;
1926+
QElapsedTimer starttime;
19271927
cout<<"manysum"<<endl;
19281928
for (i=0;i<32;i++)
19291929
oddl[i]=odd[i]=2*i+1;
@@ -2953,7 +2953,7 @@ void test1curly(double curvature,double clothance,PostScript &ps,array<int,3> &t
29532953
double curlyLength,tooCurlyLength,maxLength;
29542954
spiralarc s;
29552955
int i;
2956-
QTime starttime;
2956+
QElapsedTimer starttime;
29572957
const int niter=1000;
29582958
double lo=0,hi=1,mid;
29592959
BoundRect br;

0 commit comments

Comments
 (0)