Skip to content

Commit 809045b

Browse files
Build - fix windows build for cxxbridge
cxxbridge is now needed in the mmSolver build component.
1 parent 25e70b8 commit 809045b

4 files changed

Lines changed: 89 additions & 9 deletions

File tree

scripts/internal/build_mmSolverLibs_linux.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ then
132132
# CXX version used in the C++ buildings, and all the build scripts
133133
# using this value:
134134
# './Cargo.toml'
135+
# './scripts/internal/build_mmSolver_windows64.bat'
136+
# './scripts/internal/build_mmSolver_linux.bash'
135137
# './scripts/internal/build_mmSolverLibs_windows64.bat'
138+
# './scripts/internal/build_mmSolverLibs_linux.bash'
136139
${RUST_CARGO_EXE} install cxxbridge-cmd --version 1.0.129
137140
fi
138141
MMSOLVERLIBS_CXXBRIDGE_EXE="${HOME}/.cargo/bin/cxxbridge"

scripts/internal/build_mmSolverLibs_windows64.bat

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ IF %ERRORLEVEL% EQU 1 (
142142
:: CXX version used in the C++ buildings, and all the build scripts
143143
:: using this value:
144144
:: './Cargo.toml'
145+
:: './scripts/internal/build_mmSolver_windows64.bat'
146+
:: './scripts/internal/build_mmSolver_linux.bash'
145147
:: './scripts/internal/build_mmSolverLibs_windows64.bat'
146148
:: './scripts/internal/build_mmSolverLibs_linux.bash'
147149
%RUST_CARGO_EXE% install cxxbridge-cmd --version 1.0.129
@@ -264,21 +266,21 @@ CHDIR "%PROJECT_ROOT%"
264266
exit /b 0
265267

266268
:failed_to_generate_cpp_header
267-
echo Failed to Generate C++ header files from Rust.
269+
echo Failed to Generate C++ header files from Rust for mmSolverLibs.
268270
exit /b 1
269271

270272
:failed_to_build_rust
271-
echo Failed to build Rust code.
273+
echo Failed to build Rust code for mmSolverLibs.
272274
exit /b 1
273275

274276
:failed_to_generate_cpp
275-
echo Failed to generate C++ build files.
277+
echo Failed to generate C++ build files for mmSolverLibs.
276278
exit /b 1
277279

278280
:failed_to_build_cpp
279-
echo Failed to build C++ code.
281+
echo Failed to build C++ code for mmSolverLibs.
280282
exit /b 1
281283

282284
:failed_to_install_cpp
283-
echo Failed to install C++ artifacts.
285+
echo Failed to install C++ artifacts for mmSolverLibs.
284286
exit /b 1

scripts/internal/build_mmSolver_linux.bash

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ echo "Build mmSolverLibs directory base: ${BUILD_MMSOLVERLIBS_DIR_BASE}"
7373
BUILD_TYPE=Release
7474
MMSOLVER_DEBUG=1
7575

76+
BUILD_TYPE_DIR="debug"
77+
if [ "${BUILD_TYPE}" = "Release" ]; then
78+
BUILD_TYPE_DIR="release"
79+
fi
80+
7681
# Build options, to allow faster compilation times. (not to be used by
7782
# users wanting to build this project.)
7883
MMSOLVER_BUILD_PLUGIN=1
@@ -108,6 +113,14 @@ MMSOLVERLIBS_INSTALL_DIR="${BUILD_MMSOLVERLIBS_DIR_BASE}/install/maya${MAYA_VERS
108113
MMSOLVERLIBS_CMAKE_CONFIG_DIR="${MMSOLVERLIBS_INSTALL_DIR}/lib64/cmake/mmsolverlibs_cpp"
109114
MMSOLVERLIBS_RUST_DIR="${BUILD_MMSOLVERLIBS_DIR_BASE}/rust_linux_maya${MAYA_VERSION}/${BUILD_TYPE_DIR}"
110115

116+
# Where to find the mmsolverlibs Rust libraries and headers.
117+
MMSOLVERLIBS_INSTALL_PATH="${BUILD_MMSOLVERLIBS_DIR_BASE}/install/maya${MAYA_VERSION}_linux/"
118+
MMSOLVERLIBS_ROOT="${PROJECT_ROOT}/lib"
119+
MMSOLVERLIBS_RUST_ROOT="${MMSOLVERLIBS_ROOT}/mmsolverlibs"
120+
MMSOLVERLIBS_CPP_TARGET_DIR="${BUILD_MMSOLVERLIBS_DIR_BASE}/rust_linux_maya${MAYA_VERSION}"
121+
MMSOLVERLIBS_LIB_DIR="${MMSOLVERLIBS_CPP_TARGET_DIR}/${BUILD_TYPE_DIR}"
122+
MMSOLVERLIBS_INCLUDE_DIR="${MMSOLVERLIBS_ROOT}/include"
123+
111124
# Paths for dependencies.
112125
EXTERNAL_BUILD_DIR="${BUILD_OCIO_DIR_BASE}/cmake_linux_maya${MAYA_VERSION}_${BUILD_TYPE}/ext/dist"
113126
OCIO_INSTALL_DIR="${BUILD_OCIO_DIR_BASE}/install/maya${MAYA_VERSION}_linux/"
@@ -135,6 +148,26 @@ minizip_DIR="${EXTERNAL_BUILD_DIR}/lib64/cmake/minizip-ng"
135148
# We don't want to find system packages.
136149
CMAKE_IGNORE_PATH="/lib;/lib64;/usr;/usr/lib;/usr/lib64;/usr/local;/usr/local/lib;/usr/local/lib64;"
137150

151+
# Check if 'cxxbridge' is installed or not, and then install it if
152+
# not.
153+
#
154+
# https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script
155+
if ! command -v cxxbridge &> /dev/null
156+
then
157+
# Install the needed 'cxxbridge' command.
158+
#
159+
# NOTE: When changing this version number, make sure to update the
160+
# CXX version used in the C++ buildings, and all the build scripts
161+
# using this value:
162+
# './Cargo.toml'
163+
# './scripts/internal/build_mmSolver_windows64.bat'
164+
# './scripts/internal/build_mmSolver_linux.bash'
165+
# './scripts/internal/build_mmSolverLibs_windows64.bat'
166+
# './scripts/internal/build_mmSolverLibs_linux.bash'
167+
${RUST_CARGO_EXE} install cxxbridge-cmd --version 1.0.129
168+
fi
169+
MMSOLVERLIBS_CXXBRIDGE_EXE="${HOME}/.cargo/bin/cxxbridge"
170+
138171
# A local copy of LDPK to reduce the amount of downloads to the
139172
# 3DEqualizer website (LDPK doesn't have a git repo to clone from).
140173
LDPK_URL="${PROJECT_ROOT}/external/archives/ldpk-2.12.0.tar"
@@ -174,6 +207,8 @@ ${CMAKE_EXE} \
174207
-DMMSOLVER_BUILD_TESTS=${MMSOLVER_BUILD_TESTS} \
175208
-DMAYA_LOCATION=${MAYA_LOCATION} \
176209
-DMAYA_VERSION=${MAYA_VERSION} \
210+
-DMMSOLVERLIBS_CXXBRIDGE_EXE=${MMSOLVERLIBS_CXXBRIDGE_EXE} \
211+
-DMMSOLVERLIBS_LIB_DIR=${MMSOLVERLIBS_LIB_DIR} \
177212
-Dmmsolverlibs_rust_DIR=${MMSOLVERLIBS_RUST_DIR} \
178213
-Dmmsolverlibs_cpp_DIR=${MMSOLVERLIBS_CMAKE_CONFIG_DIR} \
179214
-Dldpk_URL=${LDPK_URL} \

scripts/internal/build_mmSolver_windows64.bat

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ SET BUILD_PACKAGE=1
7575
SET BUILD_TYPE=Release
7676
SET MMSOLVER_DEBUG=1
7777

78+
SET RELEASE_FLAG=
79+
SET BUILD_TYPE_DIR=debug
80+
IF "%BUILD_TYPE%"=="Release" (
81+
SET RELEASE_FLAG=--release
82+
SET BUILD_TYPE_DIR=release
83+
)
84+
7885
:: Build options, to allow faster compilation times. (not to be used by
7986
:: users wanting to build this project.)
8087
SET MMSOLVER_BUILD_PLUGIN=1
@@ -107,6 +114,14 @@ SET MMSOLVERLIBS_INSTALL_DIR="%BUILD_MMSOLVERLIBS_DIR_BASE%\install\maya%MAYA_VE
107114
SET MMSOLVERLIBS_CMAKE_CONFIG_DIR="%MMSOLVERLIBS_INSTALL_DIR%\lib\cmake\mmsolverlibs_cpp"
108115
SET MMSOLVERLIBS_RUST_DIR="%BUILD_MMSOLVERLIBS_DIR_BASE%\rust_windows64_maya%MAYA_VERSION%\%BUILD_TYPE_DIR%"
109116

117+
:: Where to find the mmsolverlibs Rust libraries and headers.
118+
SET MMSOLVERLIBS_INSTALL_PATH=%BUILD_MMSOLVERLIBS_DIR_BASE%\install\maya%MAYA_VERSION%_windows64\
119+
SET MMSOLVERLIBS_ROOT=%PROJECT_ROOT%\lib
120+
SET MMSOLVERLIBS_RUST_ROOT=%MMSOLVERLIBS_ROOT%\mmsolverlibs
121+
SET MMSOLVERLIBS_CPP_TARGET_DIR=%BUILD_MMSOLVERLIBS_DIR_BASE%\rust_windows64_maya%MAYA_VERSION%
122+
SET MMSOLVERLIBS_LIB_DIR=%MMSOLVERLIBS_CPP_TARGET_DIR%\%BUILD_TYPE_DIR%
123+
SET MMSOLVERLIBS_INCLUDE_DIR=%MMSOLVERLIBS_ROOT%\include
124+
110125
:: Paths for dependencies.
111126
SET EXTERNAL_OCIO_BUILD_DIR=%BUILD_OCIO_DIR_BASE%\cmake_win64_maya%MAYA_VERSION%_%BUILD_TYPE%\ext\dist
112127
SET OCIO_INSTALL_DIR=%BUILD_OCIO_DIR_BASE%\install\maya%MAYA_VERSION%_windows64\
@@ -134,6 +149,29 @@ SET ZLIB_LIBRARY=%EXTERNAL_OCIO_BUILD_DIR%\%ZLIB_RELATIVE_LIB_PATH%
134149

135150
SET minizip_DIR=%EXTERNAL_OCIO_BUILD_DIR%\%MINIZIP_RELATIVE_CMAKE_DIR%
136151

152+
:: Check if 'cxxbridge.exe' is installed or not, and then install it if
153+
:: not.
154+
::
155+
:: https://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file
156+
where /Q cxxbridge
157+
IF %ERRORLEVEL% EQU 1 (
158+
:: Install the needed 'cxxbridge.exe' command.
159+
::
160+
:: NOTE: When changing this version number, make sure to update the
161+
:: CXX version used in the C++ buildings, and all the build scripts
162+
:: using this value:
163+
:: './Cargo.toml'
164+
:: './scripts/internal/build_mmSolver_windows64.bat'
165+
:: './scripts/internal/build_mmSolver_linux.bash'
166+
:: './scripts/internal/build_mmSolverLibs_windows64.bat'
167+
:: './scripts/internal/build_mmSolverLibs_linux.bash'
168+
%RUST_CARGO_EXE% install cxxbridge-cmd --version 1.0.129
169+
)
170+
SET MMSOLVERLIBS_CXXBRIDGE_EXE="%USERPROFILE%\.cargo\bin\cxxbridge.exe"
171+
:: Convert back-slashes to forward-slashes.
172+
:: https://stackoverflow.com/questions/23542453/change-backslash-to-forward-slash-in-windows-batch-file
173+
SET "MMSOLVERLIBS_CXXBRIDGE_EXE=%MMSOLVERLIBS_CXXBRIDGE_EXE:\=/%"
174+
137175
:: MinGW is a common install for developers on Windows and
138176
:: if installed and used it will cause build conflicts and
139177
:: errors, so we disable it.
@@ -215,6 +253,8 @@ CHDIR "%BUILD_DIR%"
215253
-DMMSOLVER_BUILD_TESTS=%MMSOLVER_BUILD_TESTS% ^
216254
-DMAYA_LOCATION=%MAYA_LOCATION% ^
217255
-DMAYA_VERSION=%MAYA_VERSION% ^
256+
-DMMSOLVERLIBS_CXXBRIDGE_EXE=%MMSOLVERLIBS_CXXBRIDGE_EXE% ^
257+
-DMMSOLVERLIBS_LIB_DIR=%MMSOLVERLIBS_LIB_DIR% ^
218258
-Dmmsolverlibs_rust_DIR=%MMSOLVERLIBS_RUST_DIR% ^
219259
-Dmmsolverlibs_cpp_DIR=%MMSOLVERLIBS_CMAKE_CONFIG_DIR% ^
220260
-DOpenColorIO_DIR=%OCIO_CMAKE_CONFIG_DIR% ^
@@ -261,17 +301,17 @@ CHDIR "%PROJECT_ROOT%"
261301
exit /b 0
262302

263303
:failed_to_generate
264-
echo Failed to generate build files.
304+
echo Failed to generate build files for mmSolver component.
265305
exit /b 1
266306

267307
:failed_to_build
268-
echo Failed to build.
308+
echo Failed to build mmSolver component.
269309
exit /b 1
270310

271311
:failed_to_install
272-
echo Failed to install.
312+
echo Failed to install mmSolver component.
273313
exit /b 1
274314

275315
:failed_to_build_zip
276-
echo Failed to build the ZIP package file.
316+
echo Failed to build the ZIP package file for mmSolver component.
277317
exit /b 1

0 commit comments

Comments
 (0)