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/
/obj-*/
/*.slvs
.vscode/

View File

@ -9,22 +9,14 @@ jobs:
- stage: test
name: macOS
os: osx
osx_image: xcode11.2
osx_image: xcode12.2
install: "./.travis/install-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
if: tag IS present
name: macOS
os: osx
osx_image: xcode11.2
osx_image: xcode12.2
install: "./.travis/install-macos.sh"
script: "./.travis/build-macos.sh && ./.travis/sign-macos.sh"
deploy:

View File

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

View File

@ -1,9 +1,25 @@
#!/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
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
make -j2
make test_solvespace
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"
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
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
MSBuild.exe "src/solvespace.vcxproj"
MSBuild.exe "src/solvespace-cli.vcxproj"
MSBuild.exe "test/solvespace-testsuite.vcxproj"
MSBuild.exe "src/solvespace.vcxproj" -maxcpucount
MSBuild.exe "src/solvespace-cli.vcxproj" -maxcpucount
MSBuild.exe "test/solvespace-testsuite.vcxproj" -maxcpucount
bin/$BUILD_TYPE/solvespace-testsuite.exe

View File

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

View File

@ -6,21 +6,23 @@ app="bin/SolveSpace.app"
dmg="bin/SolveSpace.dmg"
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)
echo $MACOS_CERTIFICATE_P12 | base64 --decode > certificate.p12
if [ "$CI" = "true" ]; then
# 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
security create-keychain -p secret build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p secret build.keychain
# create a keychain
security create-keychain -p secret build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p secret build.keychain
# import the key
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PASSWORD -T /usr/bin/codesign
# import the key
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
security find-identity -v
# check if all is good
security find-identity -v
fi
# sign the .app
codesign -s "${MACOS_DEVELOPER_ID}" --timestamp --options runtime -f --deep "${app}"

View File

@ -106,9 +106,27 @@ if(ENABLE_LTO)
endif()
if(ENABLE_OPENMP)
include(FindOpenMP)
if(OpenMP_FOUND)
if(APPLE)
# 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}")
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()

View File

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

View File

@ -624,7 +624,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
}
if(gs.withEndpoints > 0) {
menu->AddItem(_("Select Edge Chain"),
[this]() { MenuEdit(Command::SELECT_CHAIN); });
[]() { MenuEdit(Command::SELECT_CHAIN); });
}
if(gs.constraints == 1 && gs.n == 0) {
Constraint *c = SK.GetConstraint(gs.constraint[0]);
@ -641,7 +641,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
}
if(gs.constraintLabels > 0 || gs.points > 0) {
menu->AddItem(_("Snap to Grid"),
[this]() { MenuEdit(Command::SNAP_TO_GRID); });
[]() { MenuEdit(Command::SNAP_TO_GRID); });
}
if(gs.points == 1 && gs.point[0].isFromRequest()) {
@ -714,7 +714,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
}
if(gs.entities == gs.n) {
menu->AddItem(_("Toggle Construction"),
[this]() { MenuRequest(Command::CONSTRUCTION); });
[]() { MenuRequest(Command::CONSTRUCTION); });
}
if(gs.points == 1) {
@ -748,28 +748,28 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
menu->AddSeparator();
if(LockedInWorkplane()) {
menu->AddItem(_("Cut"),
[this]() { MenuClipboard(Command::CUT); });
[]() { MenuClipboard(Command::CUT); });
menu->AddItem(_("Copy"),
[this]() { MenuClipboard(Command::COPY); });
[]() { MenuClipboard(Command::COPY); });
}
} else {
menu->AddItem(_("Select All"),
[this]() { MenuEdit(Command::SELECT_ALL); });
[]() { MenuEdit(Command::SELECT_ALL); });
}
if((!SS.clipboard.r.IsEmpty() || !SS.clipboard.c.IsEmpty()) && LockedInWorkplane()) {
menu->AddItem(_("Paste"),
[this]() { MenuClipboard(Command::PASTE); });
[]() { MenuClipboard(Command::PASTE); });
menu->AddItem(_("Paste Transformed..."),
[this]() { MenuClipboard(Command::PASTE_TRANSFORM); });
[]() { MenuClipboard(Command::PASTE_TRANSFORM); });
}
if(itemsSelected) {
menu->AddItem(_("Delete"),
[this]() { MenuClipboard(Command::DELETE); });
[]() { MenuClipboard(Command::DELETE); });
menu->AddSeparator();
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
// 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) {
menu->AddSeparator();
menu->AddItem(_("Zoom to Fit"),
[this]() { MenuView(Command::ZOOM_TO_FIT); });
[]() { MenuView(Command::ZOOM_TO_FIT); });
}
menu->PopUp();

View File

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