(Chore): Add cJSON library

This commit is contained in:
illyum 2024-08-16 19:29:49 -06:00
parent aebd66f6ad
commit 1753df7652

View File

@ -19,22 +19,9 @@ include(FetchContent)
## - Raylib ## - Raylib
## - rlImGui ## - rlImGui
#### - ImGui #### - ImGui
## - cJSON
# Use FetchContent to download and build raylib # Use FetchContent to download and build raylib
# This is a faster alternative to using a git repo, since this just downloads the source
# while the git repo pull takes a lot longer. Not sure why, other repos don't seem to have this issue
# If you would like to use git instead, use this:
# - - - - - - - - - - - - - - - - - - - - - - - -
#FetchContent_Declare(
# raylib
# GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
# GIT_TAG "master"
# GIT_SHALLOW TRUE
# GIT_PROGRESS TRUE
#)
# - - - - - - - - - - - - - - - - - - - - - - - -
FetchContent_Declare( FetchContent_Declare(
raylib raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git GIT_REPOSITORY https://github.com/raysan5/raylib.git
@ -61,7 +48,7 @@ add_library(ImGui STATIC
) )
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR}) target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR})
# configure rlImGui (raylib backend for ImGui) # rlImGui
FetchContent_Declare( FetchContent_Declare(
rlimgui rlimgui
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
@ -70,6 +57,15 @@ FetchContent_Declare(
) )
FetchContent_MakeAvailable(rlimgui) FetchContent_MakeAvailable(rlimgui)
# cJSON
FetchContent_Declare(
cjson
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
GIT_SHALLOW TRUE
GIT_TAG master
)
FetchContent_MakeAvailable(cjson)
# Add source files # Add source files
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp") file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src") set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/src")
@ -79,6 +75,14 @@ add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES}) target_sources(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE}) target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
# Include directories for deps
target_include_directories(${PROJECT_NAME} PRIVATE
${raylib_SOURCE_DIR}
${imgui_SOURCE_DIR}
${rlimgui_SOURCE_DIR}
${cjson_SOURCE_DIR}
)
# Link with Raylib # Link with Raylib
target_link_libraries(${PROJECT_NAME} PRIVATE raylib) target_link_libraries(${PROJECT_NAME} PRIVATE raylib)
@ -88,4 +92,4 @@ target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_D
target_link_libraries(rlImGui PRIVATE raylib ImGui) target_link_libraries(rlImGui PRIVATE raylib ImGui)
# Link ImGui and rlImGui with the executable # Link ImGui and rlImGui with the executable
target_link_libraries(${PROJECT_NAME} PRIVATE ImGui rlImGui) target_link_libraries(${PROJECT_NAME} PRIVATE ImGui rlImGui cjson)