# Needs CMake 3.28 for module cmake_minimum_required(VERSION 3.28) message(STATUS "Create project") project(ffmpegraph CXX) set(CMAKE_CXX_STANDARD 26) # Use mold as the default linker, if it exists. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") find_program(MOLD_LINKER "mold") if (MOLD_LINKER) add_link_options(-fuse-ld=mold) message(STATUS "Setting linker to mold") endif() endif() include(FetchContent) message(STATUS "Fetching raylib") FetchContent_Declare(raylib GIT_REPOSITORY https://github.com/raysan5/raylib GIT_TAG 5.0 SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/raylib" ) FetchContent_MakeAvailable(raylib) message(STATUS "Fetching clopts") FetchContent_Declare(clopts GIT_REPOSITORY https://github.com/Sirraide/clopts.git GIT_TAG master SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/clopts" ) FetchContent_MakeAvailable(clopts) # Find all the modules file(GLOB_RECURSE modules src/*.cppm) # Create the executable target add_executable(ffmpegraph) # Main file target_sources(ffmpegraph PUBLIC src/main.cpp ) # The modules target_sources(ffmpegraph PUBLIC FILE_SET CXX_MODULES FILES ${modules} ) #Compile flags target_compile_options(ffmpegraph PRIVATE -Wall -Wextra # Standard screaming -Wconversion -Wsign-conversion # Scream about accidentally converting stuff -Werror=return-type # Scream extra hard at not returning when you should. # Target detection black magic $<$:-O0 -g3 -glldb> $<$:-O3 -march=native> ) # color shit out if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(ffmpegraph PRIVATE -fdiagnostics-color=always) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(ffmpegraph PRIVATE -fcolor-diagnostics) endif() # Link against exernal libraries target_link_libraries(ffmpegraph PRIVATE raylib m) target_include_directories(ffmpegraph PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/libs/clopts/include")