summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 098f9639519f106212ec87003939ea687be1c094 (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 doom-inspired level editor"
)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_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/*.c" "src/*.h")

target_sources(sillyeditor PRIVATE ${SRC_FILES})

# raylib
find_package(raylib QUIET)
if (NOT raylib_FOUND)
    include(FetchContent)
    FetchContent_Declare(
        raylib
        URL https://github.com/raysan5/raylib/archive/refs/tags/5.5.tar.gz
    )
    FetchContent_MakeAvailable(raylib)
endif()

# raygui
FetchContent_Declare(
    raygui
    GIT_REPOSITORY https://github.com/raysan5/raygui.git
    GIT_TAG 4.0
)
FetchContent_MakeAvailable(raygui)

# nativefiledialog
FetchContent_Declare(
    nfd
    GIT_REPOSITORY https://github.com/hjalleboii/nativefiledialog.git # TODO: change to the original repo later
    GIT_TAG master
)
FetchContent_MakeAvailable(nfd)

add_subdirectory(${nfd_SOURCE_DIR}/build/cmake ${CMAKE_BINARY_DIR}/nfd_build)

target_include_directories(sillyeditor PRIVATE ${raygui_SOURCE_DIR}/src ${nfd_SOURCE_DIR}/src/include)

target_link_libraries(sillyeditor PRIVATE raylib m nfd)