forked from meekrosoft/fff
-
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.
Migrate build to CMake and standard github workflows
Replace makefiles with CMakeLists.txt. This will allow for IDE and platform agnostic builds of FFF. Update the CI for FFF to use github workflows which don't depend on MS VC. The workflow added will verify the pull requests sent to master buy running 'buildandtest' which mirrors the developer workflow. Signed-off-by: Yuval Peress <peress@google.com>
- Loading branch information
Showing
71 changed files
with
303 additions
and
1,586 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
name: Check PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
check-pr: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Configure CMake | ||
run: cmake -B ${{github.workspace}}/build | ||
- name: Build | ||
run: cmake --build ${{github.workspace}}/build | ||
- name: Test | ||
run: ctest --test-dir ${{github.workspace}} --output-on-failure |
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,34 @@ | ||
# Copyright 2022 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
project(fff) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
# Add the gtest library which will be used below | ||
add_subdirectory(gtest) | ||
|
||
# Enable ctest | ||
enable_testing() | ||
|
||
# Generate fff.h if fakegen.rb changed | ||
add_custom_command( | ||
OUTPUT | ||
${CMAKE_CURRENT_LIST_DIR}/fff.h | ||
COMMAND | ||
ruby ${CMAKE_CURRENT_LIST_DIR}/fakegen.rb >> ${CMAKE_CURRENT_LIST_DIR}/fff.h | ||
DEPENDS | ||
${CMAKE_CURRENT_LIST_DIR}/fakegen.rb | ||
${CMAKE_CURRENT_LIST_DIR}/LICENSE | ||
) | ||
add_custom_target(fff_h DEPENDS ${CMAKE_CURRENT_LIST_DIR}/fff.h) | ||
|
||
# Add an interface library for fff.h | ||
add_library(fff INTERFACE) | ||
add_dependencies(fff fff_h) | ||
target_include_directories(fff INTERFACE ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
# Add tests and samples | ||
add_subdirectory(test) | ||
add_subdirectory(examples) |
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 |
---|---|---|
@@ -1,20 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cat LICENSE > fff.h | ||
echo >> fff.h | ||
ruby fakegen.rb >> fff.h | ||
make clean | ||
make all | ||
build/fff_test_c | ||
build/fff_test_cpp --gtest_output=xml:build/test_results.xml | ||
build/ui_test_ansic | ||
build/ui_test_cpp --gtest_output=xml:build/example_results.xml | ||
build/fff_test_glob_c | ||
build/fff_test_glob_cpp --gtest_output=xml:build/test_global_results.xml | ||
build/driver_testing --gtest_output=xml:build/driver_testing.xml | ||
build/driver_testing_fff --gtest_output=xml:build/driver_testing_fff.xml | ||
build/weak_linking/test_display | ||
build/weak_linking/test_sensor | ||
build/weak_linking/test_main | ||
# Clear the environment | ||
rm -fr build fff.h | ||
mkdir build | ||
|
||
# Configure the build | ||
cmake -GNinja -B build || exit -1 | ||
|
||
# Build all targets | ||
cmake --build build || exit -1 | ||
|
||
# Run all tests | ||
ctest --test-dir build --output-on-failure |
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,6 @@ | ||
# Copyright 2022 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
add_subdirectory(driver_testing) | ||
add_subdirectory(embedded_ui) | ||
add_subdirectory(weak_linking) |
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
# Copyright 2022 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Create the driver test binary | ||
add_executable(driver_test | ||
src/driver.c | ||
src/driver.test.cpp | ||
) | ||
target_include_directories(driver_test PRIVATE include) | ||
target_link_libraries(driver_test PRIVATE gtest fff) | ||
target_compile_definitions(driver_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING) | ||
|
||
# Create the driver fff test binary | ||
add_executable(driver_fff_test | ||
src/driver.c | ||
src/driver.test.fff.cpp | ||
) | ||
target_include_directories(driver_fff_test PRIVATE include) | ||
target_link_libraries(driver_fff_test PRIVATE gtest fff) | ||
target_compile_definitions(driver_fff_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING) | ||
|
||
# Add tests to ctest | ||
add_test( | ||
NAME driver_test | ||
COMMAND $<TARGET_FILE:driver_test> | ||
) | ||
|
||
add_test( | ||
NAME driver_fff_test | ||
COMMAND $<TARGET_FILE:driver_fff_test> | ||
) |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2022 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Create the ui_test_ansic test binary | ||
add_executable(ui_test_ansic src/UI_test_ansic.c src/UI.c) | ||
target_include_directories(ui_test_ansic PRIVATE include) | ||
target_link_libraries(ui_test_ansic PRIVATE fff) | ||
|
||
# Create the ui_test_cpp test binary | ||
add_executable(ui_test_cpp src/UI_test_cpp.cpp src/UI.c) | ||
target_include_directories(ui_test_cpp PRIVATE include) | ||
target_link_libraries(ui_test_cpp PRIVATE gtest fff) | ||
|
||
# Add tests to ctest | ||
add_test( | ||
NAME ui_test_ansic | ||
COMMAND $<TARGET_FILE:ui_test_ansic> | ||
) | ||
|
||
add_test( | ||
NAME ui_test_cpp | ||
COMMAND $<TARGET_FILE:ui_test_cpp> | ||
) |
Oops, something went wrong.