Skip to content

Commit

Permalink
Install Google Test
Browse files Browse the repository at this point in the history
  • Loading branch information
cm-jones committed Jun 27, 2024
1 parent 87f9151 commit d4dc9e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get install -y cmake g++
run: |
sudo apt-get update
sudo apt-get install -y cmake g++ libgtest-dev
- name: Build and Install GTest
run: |
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp lib/*.a /usr/lib
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12)
project(cramer VERSION 0.1.0 LANGUAGES CXX)
project(cramer VERSION 1.0.0 LANGUAGES CXX)

# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -15,8 +15,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-g -O0)

if(ENABLE_COVERAGE)
add_compile_options(--coverage)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
add_compile_options(--coverage -fprofile-arcs -ftest-coverage)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()
endif()

Expand All @@ -30,6 +30,7 @@ find_package(GTest REQUIRED)

# Include directories
include_directories(
${GTEST_INCLUDE_DIRS}
include
)

Expand All @@ -46,11 +47,6 @@ target_link_libraries(cramer PRIVATE
Threads::Threads
)

if(ENABLE_COVERAGE)
target_compile_options(cramer PRIVATE --coverage)
target_link_libraries(cramer PRIVATE --coverage)
endif()

# Enable testing
enable_testing()

Expand Down

0 comments on commit d4dc9e4

Please sign in to comment.