Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CMake
on:
push:
pull_request:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
Expand Down Expand Up @@ -37,9 +36,12 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type

# The macro ${{github.workspace}} results in windows file seprators, (\) which CMake often cannot parse.
# To get around this use a relative path instead.
run: |
if [ ${{ matrix.os }} == 'windows-latest' ]; then
cmake -DTEST=ON -Dgtest_disable_pthreads=ON -B ${{github.workspace}}/build
cmake -DTEST=ON -Dgtest_disable_pthreads=ON -B ./build
Comment thread
OlekRaymond marked this conversation as resolved.
else
cmake -DTEST=ON -B ${{github.workspace}}/build
fi;
Expand Down
25 changes: 13 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ if(DEBUG)
)
endif(DEBUG)

option(SANITIZE "Enable Sanitize" OFF)
if(SANITIZE)
add_compile_options(
-fsanitize=address
-fsanitize=leak
)
add_link_options(
-fsanitize=address
-fsanitize=leak
)
endif(SANITIZE)
if (NOT MSVC)
option(SANITIZE "Enable Sanitize" OFF)
if(SANITIZE)
add_compile_options(
-fsanitize=address
-fsanitize=leak
)
add_link_options(
-fsanitize=address
-fsanitize=leak
)
endif(SANITIZE)
endif(NOT MSVC)

# set up CPM.cmake
if(CPM_SOURCE_CACHE)
Expand All @@ -52,5 +54,4 @@ add_subdirectory(test)
add_subdirectory(benchmark)
add_subdirectory(examples)

#install(FILES include/Graph.hpp DESTINATION /usr/include)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
46 changes: 25 additions & 21 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
option(CODE_COVERAGE "Enable coverage reporting" OFF)
option(CMAKE_USE_WIN32_THREADS_INIT "using WIN32 threads" ON)
option(gtest_disable_pthreads "Disable uses of pthreads in gtest." ON)

# Force dynamic linking since MSVC now links C runtimes dynamically by default
set(gtest_force_shared_crt on)

if(CODE_COVERAGE)
message( "Code Coverage Enabled" )
add_compile_options(
-O0 #no optimization
-g #generate debug info
--coverage #set coverage flag
-fprofile-arcs
-ftest-coverage
-fPIC
)
link_libraries(
"gcov"
"-fprofile-arcs"
"--coverage"
)
if (NOT MSVC)
option(CODE_COVERAGE "Enable coverage reporting" OFF)
if(CODE_COVERAGE)
message( "Code Coverage Enabled" )
add_compile_options(
-O0 #no optimization
-g #generate debug info
--coverage #set coverage flag
-fprofile-arcs
-ftest-coverage
-fPIC
)
link_libraries(
"gcov"
"-fprofile-arcs"
"--coverage"
)

endif(CODE_COVERAGE)
endif(CODE_COVERAGE)
endif(NOT MSVC)

option(TEST "Enable Test" OFF)
if(TEST)
include(${CPM_DOWNLOAD_LOCATION})
add_compile_options(
-Wall
-Wextra
)
if (NOT MSVC)
add_compile_options(
-Wall
-Wextra
)
endif(NOT MSVC)

CPMAddPackage(
NAME googletest
Expand Down