-
Notifications
You must be signed in to change notification settings - Fork 16
/
.appveyor.yml
186 lines (156 loc) · 10.1 KB
/
.appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Windows testing using Visual Studio.
#
# Syntax for this file:
# http://www.appveyor.com/docs/appveyor-yml
# See http://msdn.microsoft.com/en-us/library/ms164311.aspx for
# command-line options to MSBuild.
image: Visual Studio 2015
platform: x64
shallow_clone: false
# No need to build the branch if building a PR.
skip_branch_with_pr: true
environment:
JAVA_DIR: "C:\\Program Files\\Java\\jdk1.8.0"
PYTHON_DIR: "C:\\Python37-x64"
init:
- SET BTYPE=Release
- "SET PATH=%PYTHON_DIR%;%PYTHON_DIR%\\Scripts;%PATH%"
- SET JAVA_HOME=%JAVA_DIR%
- SET PATH=%JAVA_HOME%\bin;%PATH%
cache:
## Cache some dependencies.
# The syntax here is <dir-to-cache> -> <invalidated-when-this-file-changes>
# If the appveyor.yml script is changed, then the cache is invalidated.
# https://www.appveyor.com/docs/build-cache/
- C:\projects\deps\eigen -> dependencies\CMakeLists.txt
- C:\projects\deps\colpack -> dependencies\colpack.cmake
- C:\projects\deps\adol-c -> dependencies\CMakeLists.txt
- C:\projects\deps\ipopt -> dependencies\CMakeLists.txt
- C:\projects\deps\casadi -> dependencies\CMakeLists.txt
- C:\projects\deps\opensim-core -> dependencies\opensim-core.cmake
install:
- cmake --version
# Moco's python bindings require numpy.
- python -m pip install numpy
# - choco install doxygen.portable # <-- too unreliable.
- ps: (New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/myosin/files/doxygen-1.8.14.windows.x64.bin.zip/download", "C:\doxygen.zip")
- 7z x C:\doxygen.zip -oC:\doxygen
- SET PATH=C:\doxygen;%PATH%
- echo %PATH%
## Use Chocolatey to install SWIG.
- choco install swig --version 3.0.9 --yes --limit-output #> $null
# Install dependencies.
# We are using superbuild for opensim-core, as that allows us to specify
# specific commits to use. Also, for some reason, Moco couldn't find
# OpenSim headers when using NuGet.
# TODO - nuget sources add -name opensim-core --source https://ci.appveyor.com/nuget/opensim-core-kd63opes1em0
# TODO - nuget install opensim-core -Version 0.0.0 -ExcludeVersion -OutputDirectory C:\
# We rely on the opensim-core source code submodule for bindings and the
# superbuild.
# Don't want to clone the entire repo, so we provide a depth.
# We tried specifying a depth (--depth=1) but that may cause "Server does not allow request for unadvertised object"
- git submodule update --init
# https://blogs.msdn.microsoft.com/vcblog/2016/09/19/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows/
# https://github.com/Microsoft/vcpkg/blob/master/docs/examples/using-sqlite.md
# https://github.com/appveyor/ci/issues/1076
#- vcpkg integrate install
# TODO cache eigen.
# TODO vcpkg is pretty slow; using superbuild for now.
#- vcpkg install eigen3:x64-windows
- mkdir ..\opensim-moco_deps_build
- cd ..\opensim-moco_deps_build
- IF NOT EXIST C:\projects\deps mkdir C:\projects\deps
- dir C:\projects\
- dir C:\projects\deps
- ps: if (Test-Path C:\projects\deps\eigen) { ls C:\projects\deps\eigen }
- ps: if (Test-Path C:\projects\deps\colpack) { ls C:\projects\deps\colpack }
- ps: if (Test-Path C:\projects\deps\adol-c) { ls C:\projects\deps\adol-c }
- ps: if (Test-Path C:\projects\deps\ipopt) { ls C:\projects\deps\ipopt }
- ps: if (Test-Path C:\projects\deps\casadi) { ls C:\projects\deps\casadi }
- ps: if (Test-Path C:\projects\deps\casadi\casadi) { ls C:\projects\deps\casadi\casadi }
- ps: if (Test-Path C:\projects\deps\opensim-core) { ls C:\projects\deps\opensim-core }
# Make sure that CasADi can find IPOPT and ADOL-C can find ColPack during
# the superbuild.
# Furthermore, CasADi's CMake Config file is not relocatable, so we must
# place CasADi's installation back in its original location.
- ps: if (Test-Path C:\projects\deps\colpack) { cmake -E copy_directory C:\projects\deps\colpack C:\projects\opensim-moco_deps_install\colpack }
- ps: if (Test-Path C:\projects\deps\ipopt) { cmake -E copy_directory C:\projects\deps\ipopt C:\projects\opensim-moco_deps_install\ipopt }
- ps: if (Test-Path C:\projects\deps\casadi) { cmake -E copy_directory C:\projects\deps\casadi C:\projects\opensim-moco_deps_install\casadi }
- ps: if (Test-Path C:\projects\deps\eigen) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_eigen OFF CACHE BOOL "")' }
- ps: if (Test-Path C:\projects\deps\colpack) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_colpack OFF CACHE BOOL "")' }
- ps: if (Test-Path C:\projects\deps\adol-c) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_adol-c OFF CACHE BOOL "")' }
- ps: if (Test-Path C:\projects\deps\ipopt) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_ipopt OFF CACHE BOOL "")' }
- ps: if (Test-Path C:\projects\deps\casadi) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_casadi OFF CACHE BOOL "")' }
- ps: if (Test-Path C:\projects\deps\opensim-core) { Add-Content .\CMakeCacheInit.cmake -Value 'set(SUPERBUILD_opensim-core OFF CACHE BOOL "")' }
- ps: Add-Content .\CMakeCacheInit.cmake -Value 'set(CMAKE_INSTALL_PREFIX "C:/projects/opensim-moco_deps_install" CACHE PATH "")'
- ps: Add-Content .\CMakeCacheInit.cmake -Value 'set(OPENSIM_JAVA_WRAPPING ON CACHE BOOL "")'
- ps: Add-Content .\CMakeCacheInit.cmake -Value 'set(OPENSIM_PYTHON_WRAPPING ON CACHE BOOL "")'
# /W0 disables warnings. The other CXX flags are copied from CMake's default
# CMAKE_CXX_FLAGS.
# https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - set CXXFLAGS="/W0"
- cmake ..\opensim-moco\dependencies -G"Visual Studio 14 2015 Win64" -DCMAKE_CXX_FLAGS="/DWIN32 /D_WINDOWS /W0 /GR /EHsc" -C CMakeCacheInit.cmake
# List the values of the CMake variables.
- cmake . -LAH
# The dependencies might spew out a lot of warnings that make the log
# difficult to read.
- cmake --build . --config %BTYPE% -- /maxcpucount:4 # TODO /verbosity:quiet
- dir C:\projects\
- IF EXIST C:\projects\opensim-moco_deps_install dir C:\projects\opensim-moco_deps_install
# To get the caching mechanism to work, we had to use a different directory
# for the cache (maybe b/c CMake makes empty folders in
# opensim-moco_deps_install?).
- IF NOT EXIST C:\projects\deps\eigen cmake -E copy_directory C:\projects\opensim-moco_deps_install\eigen C:\projects\deps\eigen
- IF NOT EXIST C:\projects\deps\colpack cmake -E copy_directory C:\projects\opensim-moco_deps_install\colpack C:\projects\deps\colpack
- IF NOT EXIST C:\projects\deps\adol-c cmake -E copy_directory C:\projects\opensim-moco_deps_install\adol-c C:\projects\deps\adol-c
- IF NOT EXIST C:\projects\deps\ipopt cmake -E copy_directory C:\projects\opensim-moco_deps_install\ipopt C:\projects\deps\ipopt
- IF NOT EXIST C:\projects\deps\casadi cmake -E copy_directory C:\projects\opensim-moco_deps_install\casadi C:\projects\deps\casadi
- IF NOT EXIST C:\projects\deps\opensim-core cmake -E copy_directory C:\projects\opensim-moco_deps_install\opensim-core C:\projects\deps\opensim-core
build_script:
# Install Moco.
- mkdir ..\build
- cd ..\build
# Turn warnings into errors (/WX)
- cmake -E env CXXFLAGS="/WX" cmake ..\opensim-moco -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="C:\opensim-moco" -DADOLC_DIR="..\deps\adol-c" -DCMAKE_PREFIX_PATH="C:\projects\deps\eigen;C:\projects\deps\colpack;C:\projects\deps\opensim-core;C:\projects\deps\ipopt;C:\projects\deps\casadi;C:\projects\deps\casadi\casadi" -DMOCO_PYTHON_BINDINGS=ON -DMOCO_JAVA_BINDINGS=ON
#-DCMAKE_TOOLCHAIN_FILE="C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake"
- cmake --build . --config %BTYPE% -- /maxcpucount:4 /verbosity:minimal
- ps: $env:match = cmake -L . | Select-String -Pattern MOCO_FULL_VERSION
- ps: $env:VERSION = $env:match.split('=')[1]
- ps: $env:VERSION
test_script:
- ctest --build-config %BTYPE% --parallel 4 --output-on-failure --exclude-regex "testTugOfWarDeGrooteFregly2016|test2Muscles2DOFsDeGrooteFregly2016"
# Build doxygen.
- cmake --build . --config %BTYPE% --target tropter_doxygen -- /verbosity:minimal
- cmake --build . --config %BTYPE% --target Moco_doxygen -- /verbosity:minimal
# Install.
- cmake --build . --config %BTYPE% --target install # -- /verbosity:quiet
after_test:
- cd %APPVEYOR_BUILD_FOLDER%
## On master branch, upload binaries to AppVeyor.
# https://www.appveyor.com/docs/packaging-artifacts/
# Detect if we are on the master branch.
# - IF %APPVEYOR_REPO_BRANCH% EQU master IF NOT DEFINED APPVEYOR_PULL_REQUEST_NUMBER SET DISTR=TRUE
# Deploy always.
- SET DISTR=TRUE
- move C:\opensim-moco C:\opensim-moco-%VERSION%
- IF DEFINED DISTR 7z a C:\opensim-moco-%VERSION%-win.zip C:\opensim-moco-%VERSION%
- IF DEFINED DISTR appveyor PushArtifact C:\opensim-moco-%VERSION%-win.zip
# Upload pre-built dependencies to speed up local development.
# Change the modified timestamp of dependencies because otherwise these files
# may have been written "in the future" (b/c of the time zone difference
# between California and AppVeyor servers), causing CMake to rebuild every
# time.
# https://blogs.technet.microsoft.com/heyscriptingguy/2015/01/21/adding-and-subtracting-dates-with-powershell/
# https://stackoverflow.com/questions/18847145/loop-through-files-in-a-directory-using-powershell
# https://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch
- ps: Get-ChildItem -Path "C:\projects\deps" -Recurse -Include ** | Foreach-Object { $_.LastWriteTime = (Get-Date).AddDays(-1) }
- 7z a C:\opensim-moco-dependencies.zip C:\projects\deps
- appveyor PushArtifact C:\opensim-moco-dependencies.zip
# The published binaries can be downloaded from this link: https://ci.appveyor.com/api/projects/opensim-org/opensim-moco/artifacts/opensim-moco.zip
# Create and upload NuGet package.
#- IF DEFINED DISTR nuget pack .github/opensim-moco.nuspec -BasePath C:\opensim-moco
#- IF DEFINED DISTR appveyor PushArtifact opensim-moco.0.0.0.nupkg
# The following, if uncommented, should allow you to remote-desktop into
# the Appveyor build machine.
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))