зеркало из https://github.com/Azure/azure-umqtt-c.git
Switch cmake option from skip_unittests to run_unittests and default to OFF
This commit is contained in:
Родитель
3be47404f2
Коммит
57f89ba957
|
@ -30,7 +30,7 @@ endif()
|
|||
include(ExternalProject)
|
||||
|
||||
#the following variables are project-wide and can be used with cmake-gui
|
||||
option(skip_unittests "set skip_unittests to ON to skip unittests (default is OFF)[if possible, they are always built]" OFF)
|
||||
option(run_unittests "set run_unittests to ON to run unittests (default is OFF)" OFF)
|
||||
option(skip_samples "set skip_samples to ON to skip building samples (default is OFF)[if possible, they are always built]" OFF)
|
||||
option(compileOption_C "passes a string to the command line of the C compiler" OFF)
|
||||
option(compileOption_CXX "passes a string to the command line of the C++ compiler" OFF)
|
||||
|
@ -167,7 +167,7 @@ if (NOT ${ARCHITECTURE} STREQUAL "ARM")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT ${skip_unittests})
|
||||
if (${run_unittests})
|
||||
include("dependencies-test.cmake")
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
|
|
@ -9,7 +9,7 @@ build_root=$(cd "${script_dir}/../.." && pwd)
|
|||
run_unit_tests=ON
|
||||
run_valgrind=0
|
||||
build_folder=$build_root"/cmake/umqtt_linux"
|
||||
skip_unittests=OFF
|
||||
run_unittests=OFF
|
||||
|
||||
usage ()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ usage ()
|
|||
echo " -cl, --compileoption <value> specify a compile option to be passed to gcc"
|
||||
echo " Example: -cl -O1 -cl ..."
|
||||
echo "-rv, --run_valgrind will execute ctest with valgrind"
|
||||
echo "--skip-unittests do not build or run unit tests"
|
||||
echo "--run-unittests do not build or run unit tests"
|
||||
echo ""
|
||||
exit 1
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ process_args ()
|
|||
case "$arg" in
|
||||
"-cl" | "--compileoption" ) save_next_arg=1;;
|
||||
"-rv" | "--run_valgrind" ) run_valgrind=1;;
|
||||
"--skip-unittests" ) skip_unittests=ON;;
|
||||
"--run-unittests" ) run_unittests=ON;;
|
||||
* ) usage;;
|
||||
esac
|
||||
fi
|
||||
|
@ -50,7 +50,7 @@ process_args $*
|
|||
rm -r -f $build_folder
|
||||
mkdir -p $build_folder
|
||||
pushd $build_folder
|
||||
cmake -DcompileOption_C:STRING="$extracloptions" -Drun_valgrind:BOOL=$run_valgrind $build_root -Dskip_unittests:BOOL=$skip_unittests
|
||||
cmake -DcompileOption_C:STRING="$extracloptions" -Drun_valgrind:BOOL=$run_valgrind $build_root -Drun_unittests:BOOL=$run_unittests
|
||||
make --jobs=$(nproc)
|
||||
|
||||
if [[ $run_valgrind == 1 ]] ;
|
||||
|
|
|
@ -22,7 +22,7 @@ include /usr/share/dpkg/default.mk
|
|||
dh $@ --buildsystem=cmake --DSYSINSTALL_BINDINGS=ON
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- -Dskip_unittests=ON
|
||||
dh_auto_configure --
|
||||
|
||||
override_dh_auto_install:
|
||||
rm -f -r $$(pwd)/debian/tmp
|
||||
|
|
|
@ -34,7 +34,7 @@ rem // default build options
|
|||
set build-clean=0
|
||||
set build-config=Debug
|
||||
set build-platform=Win32
|
||||
set CMAKE_skip_unittests=OFF
|
||||
set CMAKE_run_unittests=OFF
|
||||
set CMAKE_DIR=umqtt_win32
|
||||
set MAKE_NUGET_PKG=no
|
||||
|
||||
|
@ -44,7 +44,7 @@ if "%1" equ "-c" goto arg-build-clean
|
|||
if "%1" equ "--clean" goto arg-build-clean
|
||||
if "%1" equ "--config" goto arg-build-config
|
||||
if "%1" equ "--platform" goto arg-build-platform
|
||||
if "%1" equ "--skip-unittests" goto arg-skip-unittests
|
||||
if "%1" equ "--run-unittests" goto arg-run-unittests
|
||||
if "%1" equ "--make_nuget" goto arg-build-nuget
|
||||
call :usage && exit /b 1
|
||||
|
||||
|
@ -69,15 +69,15 @@ if %build-platform% == x64 (
|
|||
)
|
||||
goto args-continue
|
||||
|
||||
:arg-skip-unittests
|
||||
set CMAKE_skip_unittests=ON
|
||||
:arg-run-unittests
|
||||
set CMAKE_run_unittests=ON
|
||||
goto args-continue
|
||||
|
||||
:arg-build-nuget
|
||||
shift
|
||||
if "%1" equ "" call :usage && exit /b 1
|
||||
set MAKE_NUGET_PKG=%1
|
||||
set CMAKE_skip_unittests=ON
|
||||
set CMAKE_run_unittests=ON
|
||||
goto args-continue
|
||||
|
||||
:args-continue
|
||||
|
@ -103,7 +103,7 @@ pushd %build-root%\cmake\%CMAKE_DIR%
|
|||
|
||||
if %MAKE_NUGET_PKG% == yes (
|
||||
echo ***Running CMAKE for Win32***
|
||||
cmake %build-root% -Dskip_unittests:BOOL=%CMAKE_skip_unittests%
|
||||
cmake %build-root% -Drun_unittests:BOOL=%CMAKE_run_unittests%
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
popd
|
||||
|
||||
|
@ -113,7 +113,7 @@ if %MAKE_NUGET_PKG% == yes (
|
|||
)
|
||||
mkdir %build-root%\cmake\umqtt_x64
|
||||
pushd %build-root%\cmake\umqtt_x64
|
||||
cmake -Dskip_unittests:BOOL=%CMAKE_skip_unittests% %build-root% -G "Visual Studio 14 Win64"
|
||||
cmake -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -G "Visual Studio 14 Win64"
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
popd
|
||||
|
||||
|
@ -124,20 +124,20 @@ if %MAKE_NUGET_PKG% == yes (
|
|||
mkdir %build-root%\cmake\umqtt_arm
|
||||
pushd %build-root%\cmake\umqtt_arm
|
||||
echo ***Running CMAKE for ARM***
|
||||
cmake -Dskip_unittests:BOOL=%CMAKE_skip_unittests% %build-root% -G "Visual Studio 14 ARM"
|
||||
cmake -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -G "Visual Studio 14 ARM"
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
|
||||
) else if %build-platform% == Win32 (
|
||||
echo ***Running CMAKE for Win32***
|
||||
cmake %build-root% -Dskip_unittests:BOOL=%CMAKE_skip_unittests%
|
||||
cmake %build-root% -Drun_unittests:BOOL=%CMAKE_run_unittests%
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
) else if %build-platform% == arm (
|
||||
echo ***Running CMAKE for ARM***
|
||||
cmake -Dskip_unittests:BOOL=%CMAKE_skip_unittests% %build-root% -G "Visual Studio 14 ARM"
|
||||
cmake -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -G "Visual Studio 14 ARM"
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
) else (
|
||||
echo ***Running CMAKE for Win64***
|
||||
cmake -Dskip_unittests:BOOL=%CMAKE_skip_unittests% %build-root% -G "Visual Studio 14 Win64"
|
||||
cmake -Drun_unittests:BOOL=%CMAKE_run_unittests% %build-root% -G "Visual Studio 14 Win64"
|
||||
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
|
||||
)
|
||||
|
||||
|
@ -196,7 +196,7 @@ echo options:
|
|||
echo -c, --clean delete artifacts from previous build before building
|
||||
echo --config ^<value^> [Debug] build configuration (e.g. Debug, Release)
|
||||
echo --platform ^<value^> [Win32] build platform (e.g. Win32, x64, arm, ...)
|
||||
echo --skip-unittests skip the unit tests
|
||||
echo --run-unittests run the unit tests
|
||||
echo --make_nuget ^<value^> [no] generates the binaries to be used for nuget packaging (e.g. yes, no)
|
||||
goto :eof
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 59bd0504af5f8ef0101f5cdda11c5b9c11f14ae6
|
||||
Subproject commit 66f4822e9d3d8a640f7166acac1ae5c2247a106a
|
|
@ -6,5 +6,5 @@ build_root=$(cd "$(dirname "$0")/.." && pwd)
|
|||
cd $build_root
|
||||
|
||||
# -- C --
|
||||
./build_all/linux/build.sh --skip-unittests "$@"
|
||||
./build_all/linux/build.sh "$@"
|
||||
[ $? -eq 0 ] || exit $?
|
||||
|
|
|
@ -6,6 +6,6 @@ build_root=$(cd "$(dirname "$0")/.." && pwd)
|
|||
cd $build_root
|
||||
|
||||
# -- C --
|
||||
./build_all/linux/build.sh --run_valgrind "$@" #-x
|
||||
./build_all/linux/build.sh --run-unittests --run_valgrind "$@" #-x
|
||||
[ $? -eq 0 ] || exit $?
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ for %%i in ("%build-root%") do set build-root=%%~fi
|
|||
REM -- C --
|
||||
cd %build-root%\build_all\windows
|
||||
|
||||
call build.cmd %*
|
||||
call build.cmd --run-unittests %*
|
||||
if errorlevel 1 goto :eof
|
||||
cd %build-root%
|
30
readme.md
30
readme.md
|
@ -2,7 +2,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
|
|||
|
||||
# Microsoft Azure MQTT
|
||||
|
||||
azure-mqtt is a general purpose library build for MQTT protocol
|
||||
azure-umqtt-c is a general purpose library build for MQTT protocol
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
@ -12,13 +12,27 @@ azure-c-shared-utility needs to be built before building azure-mqtt-c.
|
|||
|
||||
## Setup
|
||||
|
||||
### Build
|
||||
|
||||
- Clone azure-umqtt-c by:
|
||||
|
||||
```
|
||||
git clone --recursive https://github.com/Azure/azure-umqtt-c.git
|
||||
```
|
||||
- Create a folder build under azure-umqtt-c
|
||||
- Switch to the build folder and run
|
||||
cmake ..
|
||||
|
||||
- Create a folder cmake under azure-umqtt-c
|
||||
|
||||
- Switch to the cmake folder and run
|
||||
|
||||
```
|
||||
cmake ..
|
||||
```
|
||||
|
||||
- Build
|
||||
|
||||
```
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
### Installation and Use
|
||||
Optionally, you may choose to install azure-umqtt-c on your machine:
|
||||
|
@ -52,3 +66,11 @@ Optionally, you may choose to install azure-umqtt-c on your machine:
|
|||
_This requires that azure-c-shared-utility is installed (through CMake) on your machine._
|
||||
|
||||
_If running tests, this requires that umock-c, azure-ctest, and azure-c-testrunnerswitcher are installed (through CMake) on your machine._
|
||||
|
||||
### Building the tests
|
||||
|
||||
In order to build the tests use:
|
||||
|
||||
```
|
||||
cmake .. -Drun_unittests:bool=ON
|
||||
```
|
||||
|
|
Загрузка…
Ссылка в новой задаче