blocky/thirdparty/CMakeLists.txt

155 lines
3.6 KiB
CMake

include(FetchContent)
# ---- args ----
# repository: https://github.com/Taywee/args
# license : MIT
FetchContent_Declare(
args
URL "https://github.com/Taywee/args/archive/refs/tags/6.3.0.zip"
)
set(ARGS_BUILD_EXAMPLE OFF)
set(ARGS_BUILD_UNITTESTS OFF)
FetchContent_MakeAvailable(args)
# ---- GLEW ----
# repository: https://github.com/Perlmint/glew-cmake
# license : Modified BSD License, the Mesa 3-D License (MIT) and the Khronos License (MIT).
FetchContent_Declare(
glew
URL "https://github.com/Perlmint/glew-cmake/archive/refs/tags/glew-cmake-2.2.0.zip"
)
FetchContent_MakeAvailable(glew)
if (BLOCKY_STATIC)
add_library(glew ALIAS libglew_static)
else()
add_library(glew ALIAS libglew_shared)
endif()
# ---- GLFW ----
# repository: https://github.com/glfw/glfw
# license : zlib
FetchContent_Declare(
glfw
URL "https://github.com/glfw/glfw/archive/refs/tags/3.3.4.zip"
)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(glfw)
# ---- ImGUI (docking branch) ----
# repository: https://github.com/ocornut/imgui/
# license : MIT
FetchContent_Declare(
imgui
URL "https://github.com/ocornut/imgui/archive/9b0c26b0b2adae3ccf66dc9552fae4945d735a0c.zip"
)
FetchContent_Populate(imgui)
add_library(imgui)
target_sources(imgui
PRIVATE
"${imgui_SOURCE_DIR}/imgui.cpp"
"${imgui_SOURCE_DIR}/imgui_demo.cpp"
"${imgui_SOURCE_DIR}/imgui_draw.cpp"
"${imgui_SOURCE_DIR}/imgui_internal.h"
"${imgui_SOURCE_DIR}/imgui_tables.cpp"
"${imgui_SOURCE_DIR}/imgui_widgets.cpp"
"${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.cpp"
"${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp"
"${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp"
PUBLIC
"${imgui_SOURCE_DIR}/imgui.h"
"${imgui_SOURCE_DIR}/imstb_rectpack.h"
"${imgui_SOURCE_DIR}/imstb_textedit.h"
"${imgui_SOURCE_DIR}/imstb_truetype.h"
"${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h"
"${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h"
"${imgui_SOURCE_DIR}/misc/cpp/imgui_stdlib.h"
)
target_include_directories(imgui SYSTEM
PUBLIC
"${imgui_SOURCE_DIR}"
"${imgui_SOURCE_DIR}/backends"
"${imgui_SOURCE_DIR}/misc/cpp"
)
target_link_libraries(imgui
PRIVATE glfw
)
# ---- ImPlot ----
# repository: https://github.com/epezent/implot
# license : MIT
FetchContent_Declare(
implot
URL "https://github.com/epezent/implot/archive/refs/heads/master.zip"
)
FetchContent_Populate(implot)
add_library(implot)
target_link_libraries(implot
PRIVATE
imgui
)
target_include_directories(implot SYSTEM
PUBLIC
"${implot_SOURCE_DIR}"
)
target_sources(implot
PUBLIC
"${implot_SOURCE_DIR}/implot.h"
"${implot_SOURCE_DIR}/implot_internal.h"
PRIVATE
"${implot_SOURCE_DIR}/implot.cpp"
"${implot_SOURCE_DIR}/implot_items.cpp"
)
# ---- minimp4 ----
# repository: https://github.com/lieff/minimp4
# license : CC0
FetchContent_Declare(
minimp4
URL "https://github.com/lieff/minimp4/archive/4575afb4f69ace25a1a048e25cc86bf8c8d14f2b.zip"
)
FetchContent_Populate(minimp4)
add_library(minimp4)
target_include_directories(minimp4 PUBLIC SYSTEM ${minimp4_SOURCE_DIR})
target_sources(minimp4
PUBLIC
"${minimp4_SOURCE_DIR}/minimp4.h"
PRIVATE
minimp4.c
)
# ---- stb ----
FetchContent_Declare(
stb
URL "https://github.com/nothings/stb/archive/af1a5bc352164740c1cc1354942b1c6b72eacb8a.zip"
)
FetchContent_Populate(stb)
add_library(stb INTERFACE)
target_include_directories(stb SYSTEM
INTERFACE
"${stb_SOURCE_DIR}"
)