2020-07-03 03:48:58 +00:00
|
|
|
cmake_minimum_required (VERSION 3.6)
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
|
2020-07-03 03:53:28 +00:00
|
|
|
project(SimpleEngine)
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
# Add some CMake options:
|
2021-09-06 02:32:13 +00:00
|
|
|
option(SIMPLE_ENGINE_BUILD_EXAMPLES "Build example projects" ON)
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
set(SFML_BUILD_AUDIO ON)
|
|
|
|
set(SFML_BUILD_GRAPHICS ON)
|
|
|
|
set(SFML_BUILD_WINDOW ON)
|
|
|
|
set(SFML_BUILD_SYSTEM ON)
|
|
|
|
|
2020-11-04 18:57:44 +00:00
|
|
|
find_package(SFML 2 COMPONENTS system main window graphics audio REQUIRED)
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
# Link sources
|
|
|
|
file(GLOB_RECURSE source_list src/*.cpp)
|
2020-07-03 03:53:28 +00:00
|
|
|
add_library(simpleengine STATIC ${source_list})
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
# Link headers
|
2020-07-03 03:53:28 +00:00
|
|
|
target_include_directories(simpleengine PUBLIC include PRIVATE include/simpleengine)
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
# Link dependencies
|
2020-11-04 18:57:44 +00:00
|
|
|
target_link_libraries(simpleengine PUBLIC sfml-system sfml-main sfml-window sfml-network sfml-graphics sfml-audio OpenGL Freetype OpenAL Vorbis FLAC)
|
|
|
|
#target_link_libraries(simpleengine PUBLIC FLAC OpenAL OpenGL Vorbis)
|
2020-07-03 03:48:58 +00:00
|
|
|
|
|
|
|
# Add examples as a target if the user has them enabled
|
2021-09-06 02:32:13 +00:00
|
|
|
if (SIMPLE_ENGINE_BUILD_EXAMPLES)
|
2020-07-03 03:48:58 +00:00
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Set C++ standard to C++17
|
2020-07-03 03:53:28 +00:00
|
|
|
set_target_properties(simpleengine PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF)
|