-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update nx version * Run clang-format * Fix spelling * Fix spelling issues * Fix clang format
- Loading branch information
1 parent
c1e3a14
commit f84158e
Showing
80 changed files
with
692 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
:: Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/ | ||
|
||
@echo off | ||
setlocal %= Reset errorlevel and prohibit changing env vars of the parent shell. =% | ||
|
||
if [%1] == [/?] goto :show_usage | ||
if [%1] == [-h] goto :show_usage | ||
if [%1] == [--help] goto :show_usage | ||
goto :skip_show_usage | ||
:show_usage | ||
echo Usage: %~n0%~x0 [--no-tests] [--debug] [^<cmake-generation-args^>...] | ||
echo --debug Compile using Debug configuration (without optimizations) instead of Release. | ||
goto :exit | ||
:skip_show_usage | ||
|
||
:: Make the build dir at the same level as the parent dir of this script, suffixed with "-build". | ||
set BASE_DIR_WITH_BACKSLASH=%~dp0 | ||
set BASE_DIR=%BASE_DIR_WITH_BACKSLASH:~0,-1% | ||
set BUILD_DIR=%BASE_DIR%-build | ||
|
||
:: Try to find the vcvars64.bat script, assuming that build_nx_kit.bat runs from the | ||
:: "open/artifacts/nx_kit" subdirectory of the nx repository. | ||
set VCVARS_BAT=%BASE_DIR%\..\..\build_utils\msvc\call_vcvars64.bat | ||
if exist "%VCVARS_BAT%" ( | ||
echo on | ||
call "%VCVARS_BAT%" || goto :exit | ||
@echo off | ||
) | ||
|
||
if [%1] == [--no-tests] ( | ||
shift | ||
set NO_TESTS=1 | ||
) else ( | ||
set NO_TESTS=0 | ||
) | ||
|
||
if [%1] == [--debug] ( | ||
shift | ||
set BUILD_TYPE=Debug | ||
) else ( | ||
set BUILD_TYPE=Release | ||
) | ||
|
||
set GENERATOR_OPTIONS=-GNinja -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe | ||
|
||
echo on | ||
rmdir /S /Q "%BUILD_DIR%" 2>NUL | ||
mkdir "%BUILD_DIR%" || goto :exit | ||
cmake "%BASE_DIR%" -B "%BUILD_DIR%" %GENERATOR_OPTIONS% %1 %2 %3 %4 %5 %6 %7 %8 %9 || goto :exit | ||
cmake --build "%BUILD_DIR%" || goto :exit | ||
@echo off | ||
|
||
:: Run unit tests if needed. | ||
if [%NO_TESTS%] == [1] echo NOTE: Unit tests were not run. & goto :skip_tests | ||
|
||
cd "%BUILD_DIR%\unit_tests" | ||
setlocal | ||
PATH=%BUILD_DIR%;%PATH% | ||
echo on | ||
ctest --output-on-failure -C "${BUILD_TYPE}" || @goto :exit | ||
@echo off | ||
endlocal | ||
|
||
:skip_tests | ||
|
||
echo: | ||
echo Nx kit built successfully, see the library in %BUILD_DIR% | ||
|
||
:exit | ||
exit /b %ERRORLEVEL% %= Needed for a proper cmd.exe exit status. =% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
|
||
## Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/ | ||
|
||
set -e #< Exit on error. | ||
set -u #< Prohibit undefined variables. | ||
|
||
if [[ $# > 0 && ($1 == "/?" || $1 == "-h" || $1 == "--help") ]]; then | ||
echo "Usage: $(basename "$0") [--no-tests] [--debug] [<cmake-generation-args>...]" | ||
echo " --debug Compile using Debug configuration (without optimizations) instead of Release." | ||
exit | ||
fi | ||
|
||
# Make the build dir at the same level as the parent dir of this script, suffixed with "-build". | ||
declare BASE_DIR="$(readlink -f "$(dirname "$0")")" #< Absolute path to this script's dir. | ||
declare -r BUILD_DIR="${BASE_DIR}-build" | ||
|
||
declare NO_TESTS=0 | ||
if [[ $# > 0 && $1 == "--no-tests" ]]; then | ||
shift | ||
NO_TESTS=1 | ||
fi | ||
|
||
declare BUILD_TYPE="Release" | ||
if [[ $# > 0 && $1 == "--debug" ]]; then | ||
shift | ||
BUILD_TYPE=Debug | ||
fi | ||
|
||
declare -a GEN_OPTIONS=() | ||
declare LIBRARY_NAME="" | ||
|
||
case "$(uname -s)" in #< Check if running in Windows from Cygwin/MinGW. | ||
CYGWIN*|MINGW*) | ||
# Assume that the MSVC environment is set up correctly and Ninja is installed. Also | ||
# specify the compiler explicitly to avoid clashes with gcc. | ||
GEN_OPTIONS+=( -GNinja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe ) | ||
BASE_DIR=$(cygpath -w "${BASE_DIR}") #< Windows-native CMake requires Windows path. | ||
LIBRARY_NAME="nx_kit.dll" | ||
;; | ||
*) | ||
if command -v ninja &> /dev/null; then #< Use Ninja if it is available on PATH. | ||
GEN_OPTIONS+=( -GNinja ) | ||
fi | ||
LIBRARY_NAME="libnx_kit.so" | ||
;; | ||
esac | ||
|
||
if [[ "${BUILD_TYPE}" == "Release" ]]; then | ||
GEN_OPTIONS+=( -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ) | ||
fi | ||
|
||
(set -x #< Log each command. | ||
rm -rf "${BUILD_DIR}/" | ||
) | ||
|
||
cmake "${BASE_DIR}" -B "${BUILD_DIR}" \ | ||
${GEN_OPTIONS[@]+"${GEN_OPTIONS[@]}"} `#< allow empty array for bash before 4.4 #` \ | ||
"$@" | ||
cmake --build "${BUILD_DIR}" | ||
|
||
if [[ ! -f "${BUILD_DIR}/${LIBRARY_NAME}" ]]; then | ||
echo "ERROR: Failed to build nx_kit." | ||
exit 64 | ||
fi | ||
|
||
echo "" | ||
echo "Built: ${BUILD_DIR}/${LIBRARY_NAME}" | ||
echo "" | ||
|
||
# Run unit tests if needed. | ||
if (( ${NO_TESTS} == 1 )); then | ||
echo "NOTE: Unit tests were not run." | ||
else | ||
cd "${BUILD_DIR}/unit_tests" | ||
PATH="${BUILD_DIR}:${PATH}" | ||
(set -x #< Log each command. | ||
ctest --output-on-failure -C "${BUILD_TYPE}" | ||
) | ||
fi | ||
echo "" | ||
|
||
echo "Samples built successfully, see the binaries in ${BUILD_DIR}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.