summaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
blob: eee667d07cfa2ac324d7532ca4af4053337a80b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(game)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_DEFAULT 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_DEFAULT 11)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS FALSE)

set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_LINKER_PREFERENCE_PROPAGATES OFF)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES ON)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

set(CMAKE_INSTALL_MESSAGE LAZY)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR CMAKE_INSTALL_PREFIX STREQUAL "")
    set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()

if(MSVC)
    add_compile_options(-EHsc)
endif()

if(WIN32)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES=1 -DNOMINMAX -DWIN32_LEAN_AND_MEAN)
endif()

set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS OFF)
set_directory_properties(PROPERTIES CORRADE_CXX_STANDARD 20)
set_directory_properties(PROPERTIES INTERFACE_CORRADE_CXX_STANDARD 20)

set(_userconfig "userconfig-${CMAKE_CXX_COMPILER_ID}.cmake")
if(EXISTS "${CMAKE_SOURCE_DIR}/${_userconfig}")
    include("${CMAKE_SOURCE_DIR}/${_userconfig}" NO_POLICY_SCOPE)
else()
    message(STATUS "user config '${_userconfig}' not found")
endif()

find_package(Corrade QUIET REQUIRED)
find_package(Magnum QUIET REQUIRED COMPONENTS GL Shaders Trade Sdl2Application)
find_package(MagnumPlugins QUIET REQUIRED)
find_package(MagnumIntegration QUIET REQUIRED ImGui)

include_directories(.)
include_directories(src)

if(MSVC)
    add_definitions(/FI"compat/prelude.hpp")
else()
    add_definitions(-include compat/prelude.hpp)
endif()

add_subdirectory(src)
add_subdirectory(draw)
add_subdirectory(main)
add_subdirectory(anim-crop-tool)
add_subdirectory(test)

install(DIRECTORY images DESTINATION "share/${PROJECT_NAME}")