A 2D tile-based sandbox game.
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.

CMakeLists.txt 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. cmake_minimum_required(VERSION 3.0)
  2. project(swan)
  3. find_package(SFML 2.5 COMPONENTS graphics system window REQUIRED)
  4. set(CMAKE_CXX_CLANG_TIDY
  5. clang-tidy
  6. --header-filter=.*
  7. --checks=-*,bugprone-*,cert-*,performance-*,clang-analyzer-*,-cert-dcl16-c,-cert-err58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall)
  8. add_compile_options(-std=c++2a -Wall -Wextra -Wpedantic -Wno-unused-parameter)
  9. if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL "")
  10. message(STATUS "Build mode: Debug")
  11. add_compile_options(-g -fsanitize=address)
  12. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
  13. elseif(CMAKE_BUILD_TYPE STREQUAL Release)
  14. message(STATUS "Build mode: Release")
  15. add_compile_options(-O3 -flto)
  16. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
  17. else()
  18. message(FATAL_ERROR "CMAKE_BUILD_TYPE must be Debug or Release.")
  19. endif()
  20. set(LIBRARIES sfml-graphics sfml-system sfml-window sfml-audio dl)
  21. # We want to be able to use C++20 designated initializers,
  22. # but Clang doesn't support them yet.
  23. # Remove once Clang 9.1 or something comes out.
  24. add_compile_options(-Wno-c99-extensions)
  25. include_directories(
  26. ${PROJECT_SOURCE_DIR}/libswan/include
  27. ${PROJECT_SOURCE_DIR}/third_party)
  28. set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/swan/libswan")
  29. add_subdirectory(libswan)
  30. add_subdirectory(core.mod)
  31. add_executable(swan src/main.cc)
  32. target_link_libraries(swan libswan ${LIBRARIES})
  33. set(assets
  34. assets/icon.png
  35. assets/music/happy-1.wav)
  36. foreach(a ${assets})
  37. configure_file("${a}" "${a}" COPYONLY)
  38. endforeach(a)
  39. install(TARGETS swan DESTINATION swan)
  40. install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/assets DESTINATION swan)