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.5KB

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