2021-04-03 19:14:31 +02:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
|
|
|
project(project-kyoku LANGUAGES CXX)
|
|
|
|
|
2021-09-14 16:51:06 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2021-04-03 19:14:31 +02:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2021-07-27 20:18:37 +02:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wpedantic -g")
|
2021-09-14 16:51:06 +02:00
|
|
|
|
2021-09-14 21:02:23 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
|
|
|
|
|
2021-06-21 21:10:50 +02:00
|
|
|
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
|
|
|
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
|
|
|
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
|
|
|
set(CMAKE_USE_PTHREADS_INIT 1)
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
2021-04-03 19:14:31 +02:00
|
|
|
|
2021-09-14 21:02:23 +02:00
|
|
|
file(GLOB_RECURSE SOURCES "src/main.cpp" "src/application/*.cpp" "src/application/*.h")
|
2021-07-27 20:18:37 +02:00
|
|
|
add_executable(project-kyoku ${SOURCES})
|
2021-04-04 22:43:12 +02:00
|
|
|
|
2021-09-28 05:48:06 +02:00
|
|
|
option(SFML_BUILT "SFML_BUILT" OFF)
|
2021-09-14 16:51:06 +02:00
|
|
|
|
|
|
|
if(SFML_BUILT)
|
|
|
|
set(SFML_LIB_DIR
|
|
|
|
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-graphics.so.2.5
|
|
|
|
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-system.so.2.5
|
|
|
|
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-window.so.2.5
|
|
|
|
${CMAKE_SOURCE_DIR}/SFML-2.5.1/lib/libsfml-audio.so.2.5)
|
|
|
|
set(SFML_INCL_DIR ${CMAKE_SOURCE_DIR}/SFML-2.5.1/include)
|
|
|
|
target_link_libraries(project-kyoku ${SFML_LIB_DIR})
|
|
|
|
else()
|
2021-09-28 05:48:06 +02:00
|
|
|
find_package(SFML REQUIRED graphics window system)
|
|
|
|
include_directories(${SFML_INCL_DIR} ${CMAKE_SOURCE_DIR}/include)
|
2021-09-14 16:51:06 +02:00
|
|
|
target_link_libraries(project-kyoku sfml-system sfml-audio sfml-graphics sfml-network)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(${SFML_INCL_DIR} ${CMAKE_SOURCE_DIR}/include)
|
2021-09-14 21:02:23 +02:00
|
|
|
|
|
|
|
SET(CMAKE_INSTALL_PREFIX /)
|
2021-09-28 05:48:06 +02:00
|
|
|
# When new game modes appear, aggregate them into a ONE subdirectory
|
2021-09-14 21:02:23 +02:00
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modes/classicmode/CMakeLists.txt")
|
|
|
|
add_subdirectory(modes/classicmode)
|
|
|
|
target_link_libraries(project-kyoku classicmode)
|
|
|
|
endif()
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt")
|
|
|
|
add_subdirectory(tools)
|
|
|
|
target_link_libraries(project-kyoku tools)
|
|
|
|
endif()
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/core/CMakeLists.txt")
|
|
|
|
add_subdirectory(core)
|
|
|
|
target_link_libraries(project-kyoku core)
|
|
|
|
endif()
|