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.

62 lines
2.0 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. # Needs CMake 3.28 for module
  2. cmake_minimum_required(VERSION 3.28)
  3. message(STATUS "Create project")
  4. project(ffmpegraph CXX)
  5. set(CMAKE_CXX_STANDARD 26)
  6. # Use mold as the default linker, if it exists.
  7. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  8. find_program(MOLD_LINKER "mold")
  9. if (MOLD_LINKER)
  10. add_link_options(-fuse-ld=mold)
  11. message(STATUS "Setting linker to mold")
  12. endif()
  13. endif()
  14. include(FetchContent)
  15. message(STATUS "Fetching raylib")
  16. FetchContent_Declare(raylib
  17. GIT_REPOSITORY https://github.com/raysan5/raylib
  18. GIT_TAG 5.0
  19. SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/raylib"
  20. )
  21. FetchContent_MakeAvailable(raylib)
  22. message(STATUS "Fetching clopts")
  23. FetchContent_Declare(clopts
  24. GIT_REPOSITORY https://github.com/Sirraide/clopts.git
  25. GIT_TAG master
  26. SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/clopts"
  27. )
  28. FetchContent_MakeAvailable(clopts)
  29. message(STATUS "Looking for files")
  30. file(GLOB_RECURSE modules src/*.cppm)
  31. file(GLOB_RECURSE headers src/*.hpp)
  32. file(GLOB_RECURSE impls src/*.cpp)
  33. message(STATUS "Create target")
  34. add_executable(ffmpegraph ${impls})
  35. target_sources(ffmpegraph PUBLIC
  36. FILE_SET CXX_MODULES FILES ${modules}
  37. FILE_SET HEADERS FILES ${headers}
  38. )
  39. target_compile_options(ffmpegraph PRIVATE
  40. -Wall -Wextra # Standard screaming
  41. -Wconversion -Wsign-conversion # Scream about accidentally converting stuff
  42. -Werror=return-type # Scream extra hard at not returning when you should.
  43. # Target detection black magic
  44. $<$<CONFIG:DEBUG>:-O0 -g3 -glldb>
  45. $<$<CONFIG:RELEASE>:-O3 -march=native>
  46. )
  47. if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  48. target_compile_options(ffmpegraph PRIVATE -fdiagnostics-color=always)
  49. elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  50. target_compile_options(ffmpegraph PRIVATE -fcolor-diagnostics)
  51. endif()
  52. target_link_libraries(ffmpegraph PRIVATE raylib m)
  53. target_include_directories(ffmpegraph PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/libs/clopts/include")