123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- cmake_minimum_required(VERSION 3.10)
- project(horrible-harry)
- ###########
- # Debug or Release
- ###########
- if (NOT CMAKE_BUILD_TYPE)
- ## set default to Debug
- set(CMAKE_BUILD_TYPE Debug) # override with -DCMAKE_BUILD_TYPE=Release
- message("==> CMAKE_BUILD_TYPE empty. Changing it to Debug.")
- else()
- message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.")
- endif()
- ## https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
- ## During Debug, use debug version of libstdc++ (asserts on access to invalid iterators, etc!)
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
- ###########
- # Suppress certain warnings
- ###########
- # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
- # rm CMakeCache.txt and cmake . if you change any of the C++ Standards.
- ##############
- # C++ Standard
- ##############
- ## set(CMAKE_CXX_STANDARD 14)
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_CXX_EXTENSIONS ON)
- # Enable testing
- # set(BUILD_TESTING ON)
- # include(CTest)
- ### ADD gtest
- add_subdirectory(googletest)
- ### TESTS
- add_executable(test-lastseen test-lastseen.cpp lastseen.cpp)
- add_dependencies(test-lastseen gtest)
- target_link_libraries(test-lastseen gtest_main)
- enable_testing()
- add_test(NAME test-lastseen
- COMMAND test-lastseen)
- add_executable(test-utils test-utils.cpp utils.cpp)
- add_dependencies(test-utils gtest)
- target_link_libraries(test-utils gtest_main)
- add_test(NAME test-utils
- COMMAND test-utils)
- add_executable(test-render test-render.cpp render.cpp terminal.cpp utils.cpp)
- add_dependencies(test-render gtest)
- target_link_libraries(test-render gtest_main)
- target_link_libraries(test-render zf_log)
- add_executable(test-mangle test-mangle.cpp wordplay.cpp render.cpp terminal.cpp charman.cpp lastseen.cpp logs_utils.cpp)
- add_dependencies(test-mangle gtest)
- target_link_libraries(test-mangle gtest_main)
- target_link_libraries(test-mangle zf_log)
- add_test(NAME test-render
- COMMAND test-render)
- add_test(NAME test-mangle COMMAND test-mangle)
- # include(FetchContent)
- #
- # FetchContent_Populate(
- # zf_log
- # GIT_REPOSITORY https://github.com/wonder-mice/zf_log.git
- # SOURCE_DIR zf_log
- # )
- # add_subdirectory(${zf_log_SOURCE_DIR}/src zf_log)
- # This works, if zf_log is pulled in.
- add_subdirectory(zf_log)
- # Example for how to define a test which uses gtest_gmock
- # add_executable(mytest tester.cpp)
- # target_link_libraries(mytest gmock_main)
- # Here's how to add all *.h and *.cpp files
- # to a project:
- #
- # file(GLOB SOURCES
- # header-folder/*.h
- # source-folder/*.cpp
- # )
- # add_executable(yourProj ${SOURCES})
- add_custom_command(
- OUTPUT images.h
- COMMAND ./build_images.sh
- DEPENDS ansi-to-src ghost.ans ghead.ans wolf.ans panther.ans bat.ans skull.ans skull-blink.ans icu.ans
- COMMENT "Generating images.h"
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- )
- add_executable(hharry hharry.cpp lastseen.cpp terminal.cpp render.cpp utils.cpp images.h wordplay.cpp charman.cpp logs_utils.cpp)
- target_link_libraries(hharry util)
- target_link_libraries(hharry zf_log)
- # target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_INFO)
- target_compile_definitions(hharry PUBLIC ZF_LOG_DEF_LEVEL=ZF_LOG_VERBOSE)
- add_executable(try-re try-re.c)
- add_executable(ansi-color ansi-color.c)
- add_executable(ansi-to-src ansi-to-src.cpp utils.cpp)
- add_executable(images images.cpp utils.cpp images.h)
- target_link_libraries(images zf_log)
|