You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

3 months ago
  1. # Needs CMake 3.28 for module
  2. cmake_minimum_required(VERSION 3.28)
  3. project(ffmpegraph CXX)
  4. set(CMAKE_CXX_STANDARD 26)
  5. # color shit out
  6. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  7. add_compile_options(-fdiagnostics-color=always)
  8. elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  9. add_compile_options(-fcolor-diagnostics)
  10. endif()
  11. # Use mold as the default linker, if it exists.
  12. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  13. find_program(MOLD_LINKER "mold")
  14. if (MOLD_LINKER)
  15. add_link_options(-fuse-ld=mold)
  16. endif()
  17. endif()
  18. # Find all the modules
  19. file(GLOB_RECURSE modules src/*.cppm)
  20. # Create the executable target
  21. add_executable(ffmpegraph)
  22. # Main file
  23. target_sources(ffmpegraph
  24. PUBLIC
  25. src/main.cpp
  26. )
  27. # The modules
  28. target_sources(ffmpegraph
  29. PUBLIC
  30. FILE_SET CXX_MODULES FILES
  31. ${modules}
  32. )
  33. #Compile flags
  34. target_compile_options(ffmpegraph PRIVATE
  35. -Wall -Wextra # Standard screaming
  36. -Wconversion -Wsign-conversion # Scream about accidentally converting stuff
  37. -Werror=return-type # Scream extra hard at not returning when you should.
  38. # Target detection black magic
  39. $<$<CONFIG:DEBUG>:-O0 -g3 -glldb>
  40. $<$<CONFIG:RELEASE>:-O3 -march=native>
  41. )
  42. # Link against exernal libraries
  43. target_link_libraries(ffmpegraph PRIVATE raylib m)