Skip to content

Commit 178fea2

Browse files
committed
Merge branch 'develop'
2 parents 5d9d392 + aeadce8 commit 178fea2

File tree

801 files changed

+9929
-11406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

801 files changed

+9929
-11406
lines changed

.devcontainer/.vscode-docker/c_cpp_properties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
}
1616
],
1717
"version": 4
18-
}
18+
}

.devcontainer/Dockerfile.ubuntu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ RUN set -ex \
5353
ARG BOOST_VERSION=1.68.0
5454
RUN set -ex \
5555
&& export boost_version_underscore=$(echo ${BOOST_VERSION} | tr '.' '_') \
56-
&& curl -fsSLo /tmp/boost_${boost_version_underscore}.tar.gz https://archives.boost.io/release/1.68.0/source/boost_${boost_version_underscore}.tar.gz \
56+
&& curl -fsSLo /tmp/boost_${boost_version_underscore}.tar.gz https://archives.boost.io/release/${BOOST_VERSION}/source/boost_${boost_version_underscore}.tar.gz \
5757
&& tar -C /tmp/ -xzf /tmp/boost_${boost_version_underscore}.tar.gz \
5858
&& cd /tmp/boost_${boost_version_underscore} \
5959
&& ./bootstrap.sh \

.devcontainer/docker_build_win.ps1

Lines changed: 58 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,86 @@
44

55
# Get arguments from the user
66
param (
7-
[String]$windows_image,
8-
[String]$windows_version,
9-
[String]$python3_versions = "3.9.0 3.10.0 3.11.0 3.12.0 3.13.0",
10-
[String]$arch = "x64"
7+
[String]$windows_image,
8+
[String]$windows_version,
9+
[String]$python3_versions = "3.9.0 3.10.0 3.11.0 3.12.0 3.13.0",
10+
[String]$arch = "x64"
1111
)
1212

13-
try {
14-
# Determine some information about windows an the PC so we can run the right docker image
15-
if (-not ${windows_image}) {
13+
# Determine some information about windows an the PC so we can run the right docker image
14+
if (-not ${windows_image})
15+
{
1616
$product_type = (Get-WmiObject -Class Win32_OperatingSystem).ProductType
17-
if (${product_type} -eq 1) {
18-
$windows_image = "mcr.microsoft.com/windows"
19-
} else {
20-
$windows_image = "mcr.microsoft.com/windows/servercore"
17+
if (${product_type} -eq 1)
18+
{
19+
$windows_image = "mcr.microsoft.com/windows"
2120
}
22-
}
23-
if (-not ${windows_version}) {
21+
else
22+
{
23+
$windows_image = "mcr.microsoft.com/windows/servercore"
24+
}
25+
}
26+
27+
if (-not ${windows_version})
28+
{
2429
$windows_version = "ltsc2022"
25-
}
30+
}
2631

27-
Write-Host "${windows_version_table}"
32+
Write-Host "${windows_version_table}"
2833

29-
# Determine how much resources we can provide the docker container
30-
$num_cpus = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
31-
$memory = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb
34+
# Determine how much resources we can provide the docker container
35+
$num_cpus = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
36+
$memory = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb
3237

33-
# Find the script directory and set some constants
34-
$script_dir = $PSScriptRoot
35-
$project_dir = "${script_dir}/.."
36-
$dockerfile = "${script_dir}/Dockerfile.windows"
37-
$image_name = "microstrain/mscl_windows_builder:${windows_version}"
38+
# Find the script directory and set some constants
39+
$script_dir = $PSScriptRoot
40+
$project_dir = "${script_dir}/.."
41+
$dockerfile = "${script_dir}/Dockerfile.windows"
42+
$image_name = "microstrain/mscl_windows_builder:${windows_version}"
3843

39-
if ("${arch}" -eq "x86") {
44+
if ("${arch}" -eq "x86")
45+
{
4046
$cmake_arch = "Win32"
41-
} else {
47+
}
48+
else
49+
{
4250
$cmake_arch = ${arch}
43-
}
51+
}
52+
53+
# Construct the flags that we will pass to the build script
54+
$python2_build_script_flags = "-python2Dirs C:/Python2.7-${cmake_arch}"
55+
$python3_build_script_flags = "-python3Dirs "
4456

45-
# Construct the flags that we will pass to the build script
46-
$python2_build_script_flags = "-python2Dirs C:/Python2.7-${cmake_arch}"
47-
$python3_build_script_flags = "-python3Dirs "
48-
foreach ($python3_version in ${python3_versions}.split(" ")) {
57+
foreach ($python3_version in ${python3_versions}.split(" "))
58+
{
4959
$python3_build_script_flags += "C:/Python${python3_version}-${cmake_arch},"
50-
}
51-
$python3_build_script_flags = $python3_build_script_flags.TrimEnd(',')
60+
}
61+
62+
$python3_build_script_flags = $python3_build_script_flags.TrimEnd(',')
5263

53-
# Make sure we have the most recent image (okay if this fails)
54-
docker pull "${windows_image}:${windows_version}"
64+
# Make sure we have the most recent image (okay if this fails)
65+
docker pull "${windows_image}:${windows_version}"
5566

56-
# Build the image
57-
docker build `
67+
# Build the image
68+
docker build `
5869
-t "${image_name}" `
5970
-f "${dockerfile}" `
6071
--build-arg WINDOWS_IMAGE="${windows_image}" `
6172
--build-arg WINDOWS_VERSION="${windows_version}" `
6273
--build-arg PYTHON3_VERSIONS="${python3_versions}" `
6374
"${project_dir}"
6475

65-
if ("${env:ISHUDSONBUILD}" -eq "True") {
76+
if ("${env:ISHUDSONBUILD}" -eq "True")
77+
{
6678
$docker_it_flags = ""
67-
} else {
79+
}
80+
else
81+
{
6882
$docker_it_flags = "-it"
69-
}
83+
}
7084

71-
# Run the build
72-
docker run `
85+
# Run the build
86+
docker run `
7387
--rm `
7488
${docker_it_flags} `
7589
--cpus="${num_cpus}" `
@@ -78,12 +92,7 @@ try {
7892
-v "${project_dir}:C:/Projects/MSCL" `
7993
-w "C:/projects/mscl" `
8094
"${image_name}" -Command " `
81-
git config --global --add safe.directory C:/projects/mscl; `
82-
git fetch origin --tags; `
83-
& 'C:/Projects/MSCL/BuildScripts/build_win.ps1' -branch ${env:BRANCH_NAME} -arch ${cmake_arch} -buildDir C:/projects/mscl/build_windows_${arch} ${python2_build_script_flags} ${python3_build_script_flags}; `
95+
git config --global --add safe.directory C:/projects/mscl; `
96+
git fetch origin --tags; `
97+
& 'C:/Projects/MSCL/BuildScripts/build_win.ps1' -branch ${env:BRANCH_NAME} -arch ${cmake_arch} -buildDir C:/projects/mscl/build_windows_${arch} ${python2_build_script_flags} ${python3_build_script_flags}; `
8498
"
85-
}
86-
catch {
87-
# Rethrow the exception to display in the console
88-
throw $_
89-
}

BuildScripts/buildReadme_Linux.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For more information on how to configure the build to use, or not use the option
2020

2121
- \>= gcc 4.9.1-5
2222
- \>= [cmake 3.16](https://cmake.org/download/)
23-
-   \= [Boost 1.68](https://www.boost.org/users/download/)
23+
- \>= [Boost 1.68](https://www.boost.org/users/download/)
2424

2525
##### Optional
2626

BuildScripts/buildReadme_Windows.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For more information on how to configure the build to use, or not use the option
2222

2323
- \>= [Visual Studio 2015](https://visualstudio.microsoft.com/downloads/) (msvc-14.0) or MSBuild equivalent
2424
- \>= [cmake 3.16](https://cmake.org/download/)
25-
-   \= [Boost 1.68](https://www.boost.org/users/download/)
25+
- \>= [Boost 1.68](https://www.boost.org/users/download/)
2626

2727
##### Optional
2828

@@ -44,11 +44,11 @@ this is what a common `LIB_PATH` directory will look like:
4444

4545
#### Installing Boost
4646

47-
SourceForge hosts some [Pre-Built Boost binaries for Windows](https://sourceforge.net/projects/boost/files/boost-binaries/1.68.0/).
47+
SourceForge hosts some [Pre-Built Boost binaries for Windows](https://sourceforge.net/projects/boost/files/boost-binaries/).
4848
Simply installing these for your specific compiler will make it so you do not need to build Boost yourself, which can be time-consuming.
4949

5050
If you want to install Boost yourself, you can follow the instructions on
51-
[Boost's Getting Started page](https://www.boost.org/doc/libs/1_68_0/more/getting_started/windows.html).
51+
[Boost's Getting Started page](https://www.boost.org/doc/libs/1_79_0/more/getting_started/windows.html).
5252

5353
## Building MSCL for C++
5454

BuildScripts/build_win.ps1

Lines changed: 84 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ param (
1010
[String[]]$python2Dirs
1111
)
1212

13+
# Cache the error action to reset it later
14+
$CacheErrorActionPreference = ${ErrorActionPreference}
15+
16+
# Stop executing when cmdlets fail (does not stop functions from stopping execution)
17+
$ErrorActionPreference = 'Stop'
18+
1319
try
1420
{
1521
# Get some directory information
@@ -22,23 +28,38 @@ try
2228
# Make sure the build directory exists
2329
New-Item "${buildDir}" -ItemType Directory -Force
2430

31+
if (-Not ($?))
32+
{
33+
throw $_
34+
}
35+
2536
# Configure MSCL to build the documentation and zip examples only on x64 release
2637
if ("$arch" -eq "x64")
2738
{
2839
cmake -S "${project_dir}" -B "${buildDir}" -G "${generator}" -A "${arch}" -T "${toolset}" `
29-
-DCMAKE_VERBOSE_MAKEFILE="ON" `
30-
-DBUILD_SHARED_LIBS="OFF" `
31-
-DMSCL_BUILD_PYTHON2="OFF" `
32-
-DMSCL_BUILD_PYTHON3="OFF" `
33-
-DMSCL_BUILD_CSHARP="OFF" `
34-
-DMSCL_BUILD_TESTS="OFF" `
35-
-DMSCL_BUILD_EXAMPLES="OFF" `
36-
-DMSCL_ZIP_EXAMPLES="ON" `
37-
-DMSCL_BUILD_DOCUMENTATION="ON" `
38-
-DMSCL_BUILD_PACKAGE="ON" `
39-
-DMSCL_BRANCH="${branch}"
40+
-DCMAKE_VERBOSE_MAKEFILE="ON" `
41+
-DBUILD_SHARED_LIBS="OFF" `
42+
-DMSCL_BUILD_PYTHON2="OFF" `
43+
-DMSCL_BUILD_PYTHON3="OFF" `
44+
-DMSCL_BUILD_CSHARP="OFF" `
45+
-DMSCL_BUILD_TESTS="OFF" `
46+
-DMSCL_BUILD_EXAMPLES="OFF" `
47+
-DMSCL_ZIP_EXAMPLES="ON" `
48+
-DMSCL_BUILD_DOCUMENTATION="ON" `
49+
-DMSCL_BUILD_PACKAGE="ON" `
50+
-DMSCL_BRANCH="${branch}"
51+
52+
if (-Not ($?))
53+
{
54+
throw $_
55+
}
4056

4157
cmake --build "${buildDir}" --config "Release" --target package
58+
59+
if (-Not ($?))
60+
{
61+
throw $_
62+
}
4263
}
4364

4465
# Configure MSCL to build with everything except csharp, python2, and python3
@@ -55,11 +76,27 @@ try
5576
-DMSCL_BUILD_PACKAGE="ON" `
5677
-DMSCL_BRANCH="${branch}"
5778

79+
if (-Not ($?))
80+
{
81+
throw $_
82+
}
83+
5884
# Build multiple configurations
5985
foreach ($config in ${configs})
6086
{
6187
cmake --build "${buildDir}" --config "${config}" --target package
88+
89+
if (-Not ($?))
90+
{
91+
throw $_
92+
}
93+
6294
cmake --build "${buildDir}" --config "${config}" --target "RUN_TESTS"
95+
96+
if (-Not ($?))
97+
{
98+
throw $_
99+
}
63100
}
64101

65102
# Build CSharp
@@ -76,10 +113,20 @@ try
76113
-DMSCL_BUILD_PACKAGE="ON" `
77114
-DMSCL_BRANCH="${branch}"
78115

116+
if (-Not ($?))
117+
{
118+
throw $_
119+
}
120+
79121
# Build multiple configurations for CSharp
80122
foreach ($config in ${configs})
81123
{
82124
cmake --build "${buildDir}" --config "${config}" --target package
125+
126+
if (-Not ($?))
127+
{
128+
throw $_
129+
}
83130
}
84131

85132
# Build python3
@@ -105,10 +152,20 @@ try
105152
-UPython3_INCLUDE_DIR `
106153
-UPython3_EXECUTABLE -DPython3_EXECUTABLE="${python3Dir}/python.exe"
107154

155+
if (-Not ($?))
156+
{
157+
throw $_
158+
}
159+
108160
# Build multiple configurations
109161
foreach ($config in ${configs})
110162
{
111163
cmake --build "${buildDir}" --config "${config}" --target package
164+
165+
if (-Not ($?))
166+
{
167+
throw $_
168+
}
112169
}
113170
}
114171
}
@@ -136,16 +193,31 @@ try
136193
-UPython2_INCLUDE_DIR `
137194
-UPython2_EXECUTABLE -DPython2_EXECUTABLE="${python2Dir}/python.exe"
138195

196+
if (-Not ($?))
197+
{
198+
throw $_
199+
}
200+
139201
# Build multiple configurations
140202
foreach ($config in ${configs})
141203
{
142204
cmake --build "${buildDir}" --config "${config}" --target package
205+
206+
if (-Not ($?))
207+
{
208+
throw $_
209+
}
143210
}
144211
}
145212
}
146213
}
147214
catch
148215
{
149-
# Rethrow the exception to display in the console
216+
# Propagate exception up to calling script
150217
throw $_
151218
}
219+
finally
220+
{
221+
# Reset the ErrorActionPreference
222+
$ErrorActionPreference = ${CacheErrorActionPreference}
223+
}

0 commit comments

Comments
 (0)