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

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

# nfd dependency requires it for macOS
if(APPLE)
    message("-- Enabling Obj-C language...")
    enable_language(OBJC)
endif()

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)

# nativefiledialog
FetchContent_Declare(
    nfd
    GIT_REPOSITORY https://github.com/btzy/nativefiledialog-extended.git
    GIT_TAG v1.2.1
)
FetchContent_MakeAvailable(nfd)

target_include_directories(sillyeditor PRIVATE ${imgui_SOURCE_DIR})

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