cmake_minimum_required(VERSION 3.20) project(biergarten-pipeline VERSION 0.1.0 LANGUAGES CXX) cmake_policy(SET CMP0167 NEW) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(CURL REQUIRED) find_package(Boost REQUIRED COMPONENTS unit_test_framework) include(FetchContent) FetchContent_Declare( nlohmann_json GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_TAG v3.11.3 ) FetchContent_MakeAvailable(nlohmann_json) FetchContent_Declare( llama GIT_REPOSITORY https://github.com/ggml-org/llama.cpp.git # Stable release tag: b8485 (commit 31a5cf4c3f5d3af7f16fc4abc9baa75f8d568421) GIT_TAG 31a5cf4c3f5d3af7f16fc4abc9baa75f8d568421 ) FetchContent_MakeAvailable(llama) # Workaround for upstream llama.cpp release stream (b8485/b8496) missing # include in llama-quant.cpp where std::sort is used. # Remove once fixed upstream. if(TARGET llama) target_compile_options(llama PRIVATE $<$:-include algorithm> ) endif() file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp src/*.h ) add_executable(biergarten-pipeline ${SOURCES}) target_include_directories(biergarten-pipeline PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ) target_link_libraries(biergarten-pipeline PRIVATE CURL::libcurl nlohmann_json::nlohmann_json Boost::unit_test_framework llama ) target_compile_options(biergarten-pipeline PRIVATE $<$: -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion > $<$: /W4 /WX > ) add_custom_command(TARGET biergarten-pipeline POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/output COMMENT "Creating output/ directory for seed SQL files" ) find_program(VALGRIND valgrind) if(VALGRIND) add_custom_target(memcheck COMMAND ${VALGRIND} --leak-check=full --error-exitcode=1 $ --help DEPENDS biergarten-pipeline COMMENT "Running Valgrind memcheck" ) endif() include(CTest) if(BUILD_TESTING) find_package(Boost REQUIRED COMPONENTS unit_test_framework) file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS tests/*.cpp tests/*.cc tests/*.cxx ) if(TEST_SOURCES) add_executable(biergarten-pipeline-tests ${TEST_SOURCES}) target_include_directories(biergarten-pipeline-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ) target_link_libraries(biergarten-pipeline-tests PRIVATE Boost::unit_test_framework CURL::libcurl nlohmann_json::nlohmann_json llama ) add_test( NAME biergarten-pipeline-tests COMMAND biergarten-pipeline-tests ) endif() endif()