Travis: Build improvements and fixes (#751)

- Add OpenMP to macOS build
- Use as many cores as possible in CI
- Update travis osx image to xcode12.2
- Ignore .vscode folder
- In `.travis/sign-macos.sh`, only create keychain when `CI` variable is present
- Only run macOS deploy stage when a tag is pushed
pull/753/head
Koen Schmeets 2020-10-20 09:39:26 +02:00 committed by GitHub
parent b28499ea48
commit 8e7416f3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 85 additions and 51 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
/debian/libslvs1-dev/ /debian/libslvs1-dev/
/obj-*/ /obj-*/
/*.slvs /*.slvs
.vscode/

View File

@ -9,22 +9,14 @@ jobs:
- stage: test - stage: test
name: macOS name: macOS
os: osx os: osx
osx_image: xcode11.2 osx_image: xcode12.2
install: "./.travis/install-macos.sh" install: "./.travis/install-macos.sh"
script: "./.travis/build-macos.sh" script: "./.travis/build-macos.sh"
deploy:
provider: releases
api_key:
secure: dDlkIawHcODlW9B/20/cQCtzeoocvs0hKuNngRKXKqzXLWTRq33oq/B7+39tAixWbmv6exTpijiKrRNFiSCW5Z4iwHLwaRD4XJznxw63e/Hus/dxg2Tvqx7XFpkCz8mT1Z+gZQE5YxAngeZPpI/sZbZtF1UO3yH5eLeeokZ15p26ZskQUPoYuzrTgTzYL3XfpG3F+20rNBawH1ycsCTVD/08/n31d2m3CrKAsbW7er92ek6w4fzKr7NW8WeXjrPJETVpw5fQg1Od3pRGW8dPQaJcvKQEogMp8Mm0ETYd0qigg89/giBz7QwOgmAWQ4dH+DfZH4Ojl//127QztBolMvyDMQBykWrtJoGcij05sT6K2IJr2FHeUBO12MAEdjiVvhQj3DtTzjPiZAHHDBSLWxLKWWhlhHE4pq7g1MQhqXkaAHI2BLNzwLmaowbMT0bECf9yfz6xx18h6XPQFX44oOktraobVALFlyHqeKa8zdcUt22LF6uAL1m5dxL0tny3eXCIPE4UH/RZgua/cHV9G3cUvKQa/QnFSLRhvWVSbGB+7YsHouBJcsUOOW1gmd5442XuC7mpppccRldh+GSxUk6TBJRAx7TeQ0ybDUaoco9MUqp2twv3KreR2+8Q12PDaAhfQVNEGdF3wTm1sShImjCN4VN3eSLlBEbve1QRQXM=
skip_cleanup: true
file: build/bin/SolveSpace.dmg
on:
repo: solvespace/solvespace
tags: true
- stage: deploy - stage: deploy
if: tag IS present
name: macOS name: macOS
os: osx os: osx
osx_image: xcode11.2 osx_image: xcode12.2
install: "./.travis/install-macos.sh" install: "./.travis/install-macos.sh"
script: "./.travis/build-macos.sh && ./.travis/sign-macos.sh" script: "./.travis/build-macos.sh && ./.travis/sign-macos.sh"
deploy: deploy:

View File

@ -7,5 +7,5 @@ cd build
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DENABLE_SANITIZERS=ON -DENABLE_SANITIZERS=ON
make VERBOSE=1 make -j$(nproc) VERBOSE=1
make test_solvespace make test_solvespace

View File

@ -1,9 +1,25 @@
#!/bin/sh -xe #!/bin/sh -xe
if echo $TRAVIS_TAG | grep ^v; then BUILD_TYPE=RelWithDebInfo; else BUILD_TYPE=Debug; fi if echo $TRAVIS_TAG | grep ^v; then
BUILD_TYPE=RelWithDebInfo
else
BUILD_TYPE=Debug
fi
mkdir build mkdir build || true
cd build cd build
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
make -j2 LLVM_PREFIX=$(brew --prefix llvm@9)
make test_solvespace export CC="${LLVM_PREFIX}/bin/clang"
export CXX="${CC}++"
export LDFLAGS="-L${LLVM_PREFIX}/lib -Wl,-rpath,${LLVM_PREFIX}/lib" \
export CFLAGS="-I${LLVM_PREFIX}/include"
export CPPFLAGS="-I${LLVM_PREFIX}/include"
cmake \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE .. \
-DENABLE_OPENMP=ON
cmake --build . --config $BUILD_TYPE
make -j$(nproc) test_solvespace

View File

@ -9,8 +9,8 @@ mkdir build
cd build cd build
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$BUILD_TYPE cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
MSBuild.exe "src/solvespace.vcxproj" MSBuild.exe "src/solvespace.vcxproj" -maxcpucount
MSBuild.exe "src/solvespace-cli.vcxproj" MSBuild.exe "src/solvespace-cli.vcxproj" -maxcpucount
MSBuild.exe "test/solvespace-testsuite.vcxproj" MSBuild.exe "test/solvespace-testsuite.vcxproj" -maxcpucount
bin/$BUILD_TYPE/solvespace-testsuite.exe bin/$BUILD_TYPE/solvespace-testsuite.exe

View File

@ -1,3 +1,4 @@
#!/bin/sh -xe #!/bin/sh -xe
brew install llvm@9
git submodule update --init git submodule update --init

View File

@ -6,21 +6,23 @@ app="bin/SolveSpace.app"
dmg="bin/SolveSpace.dmg" dmg="bin/SolveSpace.dmg"
bundle_id="com.solvespace.solvespace" bundle_id="com.solvespace.solvespace"
# get the signing certificate (this is the Developer ID:Application: Your Name, exported to a p12 file, then converted to base64, e.g.: cat ~/Desktop/certificate.p12 | base64 | pbcopy) if [ "$CI" = "true" ]; then
echo $MACOS_CERTIFICATE_P12 | base64 --decode > certificate.p12 # get the signing certificate (this is the Developer ID:Application: Your Name, exported to a p12 file, then converted to base64, e.g.: cat ~/Desktop/certificate.p12 | base64 | pbcopy)
echo $MACOS_CERTIFICATE_P12 | base64 --decode > certificate.p12
# create a keychain # create a keychain
security create-keychain -p secret build.keychain security create-keychain -p secret build.keychain
security default-keychain -s build.keychain security default-keychain -s build.keychain
security unlock-keychain -p secret build.keychain security unlock-keychain -p secret build.keychain
# import the key # import the key
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PASSWORD -T /usr/bin/codesign security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k secret build.keychain security set-key-partition-list -S apple-tool:,apple: -s -k secret build.keychain
# check if all is good # check if all is good
security find-identity -v security find-identity -v
fi
# sign the .app # sign the .app
codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${app}" codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${app}"

View File

@ -106,9 +106,27 @@ if(ENABLE_LTO)
endif() endif()
if(ENABLE_OPENMP) if(ENABLE_OPENMP)
include(FindOpenMP) if(APPLE)
if(OpenMP_FOUND) # OpenMP does not work with the default Apple llvm/clang++
# Install a more recent version using Homebrew (version 11.0.0 which is the next available tag on homebrew at this time crashed):
# "brew install llvm@9"
# and set the right compiler flags using:
# LLVM_PREFIX=$(brew --prefix llvm@9)
# export CC="${LLVM_PREFIX}/bin/clang"
# export CXX="${CC}++"
# export LDFLAGS="-L${LLVM_PREFIX}/lib -Wl,-rpath,${LLVM_PREFIX}/lib" \
# export CFLAGS="-I${LLVM_PREFIX}/include"
# export CPPFLAGS="-I${LLVM_PREFIX}/include"
set(OpenMP_CXX_FLAGS "-fopenmp=libomp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} )
else()
find_package( OpenMP REQUIRED )
include(FindOpenMP)
if(OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message(STATUS "found OpenMP, compiling with flags: " ${OpenMP_CXX_FLAGS} )
endif()
endif() endif()
endif() endif()

View File

@ -315,9 +315,13 @@ void Entity::ComputeInterpolatingSpline(SBezierList *sbl, bool periodic) const {
} else { } else {
// The wrapping would work, except when n = 1 and everything // The wrapping would work, except when n = 1 and everything
// wraps to zero... // wraps to zero...
if(i > 0) bm.A[i][i - 1] = eq.x; if(i > 0) {
/**/ bm.A[i][i] = eq.y; bm.A[i][i - 1] = eq.x;
if(i < (n-1)) bm.A[i][i + 1] = eq.z; }
bm.A[i][i] = eq.y;
if(i < (n-1)) {
bm.A[i][i + 1] = eq.z;
}
} }
} }
bm.Solve(); bm.Solve();

View File

@ -624,24 +624,24 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
} }
if(gs.withEndpoints > 0) { if(gs.withEndpoints > 0) {
menu->AddItem(_("Select Edge Chain"), menu->AddItem(_("Select Edge Chain"),
[this]() { MenuEdit(Command::SELECT_CHAIN); }); []() { MenuEdit(Command::SELECT_CHAIN); });
} }
if(gs.constraints == 1 && gs.n == 0) { if(gs.constraints == 1 && gs.n == 0) {
Constraint *c = SK.GetConstraint(gs.constraint[0]); Constraint *c = SK.GetConstraint(gs.constraint[0]);
if(c->HasLabel() && c->type != Constraint::Type::COMMENT) { if(c->HasLabel() && c->type != Constraint::Type::COMMENT) {
menu->AddItem(_("Toggle Reference Dimension"), menu->AddItem(_("Toggle Reference Dimension"),
[]() { Constraint::MenuConstrain(Command::REFERENCE); }); []() { Constraint::MenuConstrain(Command::REFERENCE); });
} }
if(c->type == Constraint::Type::ANGLE || if(c->type == Constraint::Type::ANGLE ||
c->type == Constraint::Type::EQUAL_ANGLE) c->type == Constraint::Type::EQUAL_ANGLE)
{ {
menu->AddItem(_("Other Supplementary Angle"), menu->AddItem(_("Other Supplementary Angle"),
[]() { Constraint::MenuConstrain(Command::OTHER_ANGLE); }); []() { Constraint::MenuConstrain(Command::OTHER_ANGLE); });
} }
} }
if(gs.constraintLabels > 0 || gs.points > 0) { if(gs.constraintLabels > 0 || gs.points > 0) {
menu->AddItem(_("Snap to Grid"), menu->AddItem(_("Snap to Grid"),
[this]() { MenuEdit(Command::SNAP_TO_GRID); }); []() { MenuEdit(Command::SNAP_TO_GRID); });
} }
if(gs.points == 1 && gs.point[0].isFromRequest()) { if(gs.points == 1 && gs.point[0].isFromRequest()) {
@ -714,7 +714,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
} }
if(gs.entities == gs.n) { if(gs.entities == gs.n) {
menu->AddItem(_("Toggle Construction"), menu->AddItem(_("Toggle Construction"),
[this]() { MenuRequest(Command::CONSTRUCTION); }); []() { MenuRequest(Command::CONSTRUCTION); });
} }
if(gs.points == 1) { if(gs.points == 1) {
@ -748,28 +748,28 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
menu->AddSeparator(); menu->AddSeparator();
if(LockedInWorkplane()) { if(LockedInWorkplane()) {
menu->AddItem(_("Cut"), menu->AddItem(_("Cut"),
[this]() { MenuClipboard(Command::CUT); }); []() { MenuClipboard(Command::CUT); });
menu->AddItem(_("Copy"), menu->AddItem(_("Copy"),
[this]() { MenuClipboard(Command::COPY); }); []() { MenuClipboard(Command::COPY); });
} }
} else { } else {
menu->AddItem(_("Select All"), menu->AddItem(_("Select All"),
[this]() { MenuEdit(Command::SELECT_ALL); }); []() { MenuEdit(Command::SELECT_ALL); });
} }
if((!SS.clipboard.r.IsEmpty() || !SS.clipboard.c.IsEmpty()) && LockedInWorkplane()) { if((!SS.clipboard.r.IsEmpty() || !SS.clipboard.c.IsEmpty()) && LockedInWorkplane()) {
menu->AddItem(_("Paste"), menu->AddItem(_("Paste"),
[this]() { MenuClipboard(Command::PASTE); }); []() { MenuClipboard(Command::PASTE); });
menu->AddItem(_("Paste Transformed..."), menu->AddItem(_("Paste Transformed..."),
[this]() { MenuClipboard(Command::PASTE_TRANSFORM); }); []() { MenuClipboard(Command::PASTE_TRANSFORM); });
} }
if(itemsSelected) { if(itemsSelected) {
menu->AddItem(_("Delete"), menu->AddItem(_("Delete"),
[this]() { MenuClipboard(Command::DELETE); }); []() { MenuClipboard(Command::DELETE); });
menu->AddSeparator(); menu->AddSeparator();
menu->AddItem(_("Unselect All"), menu->AddItem(_("Unselect All"),
[this]() { MenuEdit(Command::UNSELECT_ALL); }); []() { MenuEdit(Command::UNSELECT_ALL); });
} }
// If only one item is selected, then it must be the one that we just // If only one item is selected, then it must be the one that we just
// selected from the hovered item; in which case unselect all and hovered // selected from the hovered item; in which case unselect all and hovered
@ -785,7 +785,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
if(itemsSelected) { if(itemsSelected) {
menu->AddSeparator(); menu->AddSeparator();
menu->AddItem(_("Zoom to Fit"), menu->AddItem(_("Zoom to Fit"),
[this]() { MenuView(Command::ZOOM_TO_FIT); }); []() { MenuView(Command::ZOOM_TO_FIT); });
} }
menu->PopUp(); menu->PopUp();

View File

@ -513,7 +513,7 @@ public:
GraphicsWindow GW; GraphicsWindow GW;
// The state for undo/redo // The state for undo/redo
typedef struct { typedef struct UndoState {
IdList<Group,hGroup> group; IdList<Group,hGroup> group;
List<hGroup> groupOrder; List<hGroup> groupOrder;
IdList<Request,hRequest> request; IdList<Request,hRequest> request;