Skip to content
Open
Show file tree
Hide file tree
Changes from all 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: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ log.txt
*.exe
*.dll
*.pyc

html
build
deps
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
59 changes: 57 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.16.3)

###############################################################################
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-g -O0 -std=c++11 -U__STRICT_ANSI__ -fprofile-instr-generate -fcoverage-mapping")


project(craft)

FILE(GLOB SOURCE_FILES src/*.c)
include_directories(googletest/include) # this is so we can #include <gtest/gtest.h>
#include_directories(include)

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
FetchContent_MakeAvailable(googletest)

###############################################################################
add_executable(tests)
target_include_directories(tests PUBLIC model)
target_sources(tests PUBLIC
${SOURCE_FILES}
tests/tests.cpp
src/deleteme.c
deps/glew/src/glew.c
deps/lodepng/lodepng.c
deps/noise/noise.c
deps/sqlite/sqlite3.c
deps/tinycthread/tinycthread.c)

target_link_libraries(tests PRIVATE gtest) # link google test to this executable
set_property(TARGET tests PROPERTY CXX_STANDARD 11)

###############################################################################
add_custom_target(coverage
COMMAND ln -f -s ../textures .
COMMAND ln -f -s ../shaders .
COMMAND ./tests
COMMAND llvm-profdata merge -sparse default.profraw -o cumulative.profdata
COMMAND llvm-cov show -ignore-filename-regex='../google*/*' -format="html" ./tests -instr-profile=cumulative.profdata > coverageLines.html
COMMAND llvm-cov report -show-region-summary=false -ignore-filename-regex='../google*/*' ./tests -instr-profile=cumulative.profdata > coverageSummary.txt
COMMAND cat coverageSummary.txt
COMMAND cd build
)
add_dependencies(coverage tests)


add_executable(
craft
${SOURCE_FILES}
tests/craft_main.c
deps/glew/src/glew.c
deps/lodepng/lodepng.c
deps/noise/noise.c
Expand Down Expand Up @@ -39,11 +88,17 @@ if(APPLE)
endif()

if(UNIX)
target_link_libraries(craft dl glfw
target_link_libraries(craft PUBLIC dl PUBLIC glfw
${GLFW_LIBRARIES} ${CURL_LIBRARIES})
endif()

if(MINGW)
target_link_libraries(craft ws2_32.lib glfw
${GLFW_LIBRARIES} ${CURL_LIBRARIES})
endif()

if(UNIX)
target_link_libraries(tests PUBLIC dl PUBLIC glfw
${GLFW_LIBRARIES} ${CURL_LIBRARIES})
endif()

Loading