summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: e39e28e059f1180001cf6a1ddd7f98a9371ea3f0 (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
cmake_minimum_required(VERSION 3.10)
include(FetchContent)

project(
    sillyeditor
    VERSION 1.0
    DESCRIPTION "a simple level editor"
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(sillyeditor)

set_target_properties(
  sillyeditor PROPERTIES
  DESCRIPTION ${PROJECT_DESCRIPTION}
  OUTPUT_NAME "editor"
)

file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")

target_sources(sillyeditor PRIVATE ${SRC_FILES})

# sfml
FetchContent_Declare(sfml
    GIT_REPOSITORY https://github.com/SFML/SFML.git
    GIT_TAG 3.0.0
    GIT_SHALLOW ON
    EXCLUDE_FROM_ALL
    SYSTEM)
FetchContent_MakeAvailable(sfml)

# imgui
FetchContent_Declare(
    imgui
    GIT_REPOSITORY https://github.com/ocornut/imgui.git
    GIT_TAG v1.91.8
)
FetchContent_MakeAvailable(imgui)

# imgui-sfml
FetchContent_Declare(
    imgui-sfml
    GIT_REPOSITORY https://github.com/SFML/imgui-sfml.git
    GIT_TAG v3.0
)

set(SFML_DIR "${sfml_SOURCE_DIR}/cmake")
set(IMGUI_DIR ${imgui_SOURCE_DIR})
set(IMGUI_SFML_FIND_SFML OFF)
FetchContent_MakeAvailable(imgui-sfml)

target_include_directories(sillyeditor PRIVATE ${imgui_SOURCE_DIR})

target_link_libraries(sillyeditor PRIVATE sfml-graphics ImGui-SFML::ImGui-SFML)