Skip to content

Commit

Permalink
Update submodules to git submodule checkout method so they aren't clo…
Browse files Browse the repository at this point in the history
…ned in hub repos. (#21)
  • Loading branch information
lundinc2 authored Oct 14, 2020
1 parent c29f483 commit 80c3761
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
cmake -S test/unit-test -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
make -C build/ all
- name: Test
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[submodule "test/unit-test/CMock"]
path = test/unit-test/CMock
url = https://github.com/ThrowTheSwitch/CMock.git
update = none
[submodule "3rdparty/mbedtls"]
path = 3rdparty/mbedtls
url = https://github.com/ARMmbed/mbedtls.git
branch = mbedtls-2.16
update = none
[submodule "3rdparty/pkcs11"]
path = 3rdparty/pkcs11
url = https://github.com/amazon-freertos/pkcs11.git
update = none
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ A list of all the configurations and their default values are defined in the dox

### Steps to build **Library** and **Unit Tests**

1. Go to the root directory of this repository.
### Checkout CMock Submodule
By default, the submodules in this repository are configured with `update=none` in [.gitmodules](.gitmodules) to avoid increasing clone time and disk space usage of other repositories (like [amazon-freertos](https://github.com/aws/amazon-freertos) that submodule this repository.

1. Run *cmake* while inside build directory: `cmake -S ../test/unit-test -B build -DBUILD_CLONE_SUBMODULES=ON `
To build unit tests, the submodule dependency of CMock is required. Use the following command to clone the submodule:
```
git submodule update --checkout --init --recursive test/unit-test/CMock
```

1. Go to the root directory of this repository. (Make sure that the **CMock** submodule is cloned as described [above](#checkout-cmock-submodule))

1. Run *cmake* while inside build directory: `cmake -S ../test/unit-test -B build`

1. Run this command to build the library and unit tests: `make -C build all`

Expand Down
2 changes: 1 addition & 1 deletion test/unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set(MODULE_ROOT_DIR ${__MODULE_ROOT_DIR} CACHE INTERNAL "corePKCS11 repository r
# Configure options to always show in CMake GUI.
option( BUILD_CLONE_SUBMODULES
"Set this to ON to automatically clone any required Git submodules. When OFF, submodules must be manually cloned."
ON )
OFF )

# Set output directories.
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
Expand Down
2 changes: 1 addition & 1 deletion test/unit-test/cmock_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ macro( clone_cmock )
find_package( Git REQUIRED )
message( "Cloning submodule CMock." )
execute_process( COMMAND rm -rf ${CMOCK_DIR}
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive ${MODULE_ROOT_DIR}
COMMAND ${GIT_EXECUTABLE} submodule update --checkout --init --recursive ${MODULE_ROOT_DIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE CMOCK_CLONE_RESULT )

Expand Down

0 comments on commit 80c3761

Please sign in to comment.