Skip to content

Commit

Permalink
Change the Test submodules to be more efficient (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jebrando authored Apr 5, 2019
1 parent 7c23f61 commit 92e208f
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
/devdoc/~$o_requirements.docm
*.jar

/.vscode/*
/.vscode/*
10 changes: 5 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
[submodule "deps/azure-macro-utils-c"]
path = deps/azure-macro-utils-c
url = https://github.com/Azure/azure-macro-utils-c.git
[submodule "deps/azure-ctest"]
path = deps/azure-ctest
url = https://github.com/Azure/azure-ctest.git
[submodule "deps/azure-c-testrunnerswitcher"]
path = deps/azure-c-testrunnerswitcher
[submodule "deps/testrunnerswitcher"]
path = deps/testrunnerswitcher
url = https://github.com/Azure/azure-c-testrunnerswitcher.git
[submodule "deps/ctest"]
path = deps/ctest
url = https://github.com/Azure/azure-ctest.git
[submodule "deps/umock-c"]
path = deps/umock-c
url = https://github.com/Azure/umock-c.git
28 changes: 11 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ option(run_e2e_tests "set run_e2e_tests to ON to run e2e tests (default is OFF)"
option(skip_samples "set skip_samples to ON to skip building samples (default is OFF)[if possible, they are always built]" OFF)
option(use_installed_dependencies "set use_installed_dependencies to ON to use installed packages instead of building dependencies from submodules" OFF)
option(use_custom_heap "use externally defined heap functions instead of the malloc family" OFF)
option(no_logging "disable logging" OFF)
option(enable_raw_logging "Enables the ability to add raw logging" OFF)
option(no_logging "disable logging" OFF)
option(enable_raw_logging "Enables the ability to add raw logging" OFF)

if(${use_custom_heap})
add_definitions(-DGB_USE_CUSTOM_HEAP)
Expand All @@ -33,11 +33,9 @@ endif ()

#do not add or build any tests of the dependencies
set(original_run_e2e_tests ${run_e2e_tests})
set(original_run_int_tests ${run_int_tests})
set(original_run_unittests ${run_unittests})

set(run_e2e_tests OFF)
set(run_int_tests OFF)
set(run_unittests OFF)

if(NOT ${use_installed_dependencies})
Expand All @@ -47,33 +45,30 @@ if(NOT ${use_installed_dependencies})

if(${original_run_e2e_tests} OR ${original_run_unittests})
if (NOT TARGET testrunnerswitcher)
add_subdirectory(deps/azure-c-testrunnerswitcher)
add_subdirectory(deps/testrunnerswitcher)
endif()
if (NOT TARGET ctest)
add_subdirectory(deps/azure-ctest)
add_subdirectory(deps/ctest)
endif()
if (NOT TARGET umock_c)
add_subdirectory(deps/umock-c)
endif()
enable_testing()
endif()
if (NOT TARGET aziotsharedutil)
add_subdirectory(deps/c-utility)
# Include the common build rules for C shared utility
if(${use_installed_dependencies})
include(deps/c-utility/configs/azure_iot_build_rules.cmake)
else()
include(${SHARED_UTIL_FOLDER}/configs/azure_iot_build_rules.cmake)
endif()
endif()
endif()

include("dependencies.cmake")

# Include the common build rules for C shared utility
if(${use_installed_dependencies})
include(deps/c-utility/configs/azure_iot_build_rules.cmake)
else()
include(${SHARED_UTIL_FOLDER}/configs/azure_iot_build_rules.cmake)
endif()

set_platform_files(${SHARED_UTIL_FOLDER})

set(run_e2e_tests ${original_run_e2e_tests})
set(run_int_tests ${original_run_int_tests})
set(run_unittests ${original_run_unittests})

#these are the C source files
Expand Down Expand Up @@ -133,7 +128,6 @@ if (NOT ${ARCHITECTURE} STREQUAL "ARM")
endif ()

if (${run_unittests})
include("dependencies-test.cmake")
add_subdirectory(tests)
endif ()

Expand Down
14 changes: 0 additions & 14 deletions dependencies-test.cmake

This file was deleted.

6 changes: 0 additions & 6 deletions dependencies.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion deps/azure-macro-utils-c
2 changes: 1 addition & 1 deletion deps/c-utility
2 changes: 1 addition & 1 deletion deps/umock-c
33 changes: 16 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ azure-umqtt-c is a general purpose library build for MQTT protocol
## Dependencies

azure-mqtt client use the azure-c-shared-utility, which is a C library provisioning common functionality for basic tasks (like string, list manipulation, IO, etc.).
azure-c-shared-utility is available here: https://github.com/Azure/azure-c-shared-utility.
azure-c-shared-utility is available here: <https://github.com/Azure/azure-c-shared-utility.>
azure-c-shared-utility needs to be built before building azure-mqtt-c.

## Setup
Expand All @@ -16,49 +16,48 @@ azure-c-shared-utility needs to be built before building azure-mqtt-c.

- Clone azure-umqtt-c by:

```
git clone --recursive https://github.com/Azure/azure-umqtt-c.git
```Shell
git clone https://github.com/Azure/azure-umqtt-c.git
cd azure-umqtt-c
git submodule update --init
```

- Create a folder cmake under azure-umqtt-c

- Switch to the cmake folder and run

```
```Shell
cmake ..
```

- Build
- Build

```
```Shell
cmake --build .
```

### Installation and Use

Optionally, you may choose to install azure-umqtt-c on your machine:

1. Switch to the *cmake* folder and run
```

```Shell
cmake -Duse_installed=ON ../
```
```
cmake --build . --target install
```

or install using the follow commands for each platform:

On Linux:
```

```Shell
sudo make install
```

On Windows:
```
msbuild /m INSTALL.vcxproj
```

2. Use it in your project (if installed)
```
```Shell
find_package(umqtt REQUIRED CONFIG)
target_link_library(yourlib umqtt)
```
Expand All @@ -71,6 +70,6 @@ _If running tests, this requires that umock-c, azure-ctest, and azure-c-testrunn

In order to build the tests use:

```
```Shell
cmake .. -Drun_unittests:bool=ON
```

0 comments on commit 92e208f

Please sign in to comment.