From e9d3125807b513e86e4e4e56b18b5b538c33cb05 Mon Sep 17 00:00:00 2001 From: CJFEdu Date: Mon, 20 Jan 2025 03:21:35 -0600 Subject: [PATCH 1/3] Make Examples Optional in CMAKE Makes including the examples optional. SDL2/SDL3 specifically have long download/build times. If they aren't being used, then this can dramatically speed up build times. --- CMakeLists.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02b20b3..78734ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,17 +3,21 @@ project(clay) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +option(CLAY_INCLUDE_EXAMPLES "Build examples" OFF) + if(APPLE) enable_language(OBJC) endif() -add_subdirectory("examples/cpp-project-example") -add_subdirectory("examples/raylib-multi-context") -add_subdirectory("examples/raylib-sidebar-scrolling-container") -# add_subdirectory("examples/cairo-pdf-rendering") Some issue with github actions populating cairo, disable for now -if(NOT MSVC) - add_subdirectory("examples/clay-official-website") - add_subdirectory("examples/SDL3-simple-demo") -endif() -add_subdirectory("examples/introducing-clay-video-demo") -add_subdirectory("examples/SDL2-video-demo") +if(CLAY_INCLUDE_EXAMPLES) + add_subdirectory("examples/cpp-project-example") + add_subdirectory("examples/raylib-multi-context") + add_subdirectory("examples/raylib-sidebar-scrolling-container") + # add_subdirectory("examples/cairo-pdf-rendering") Some issue with github actions populating cairo, disable for now + if(NOT MSVC) + add_subdirectory("examples/clay-official-website") + add_subdirectory("examples/SDL3-simple-demo") + endif() + add_subdirectory("examples/introducing-clay-video-demo") + add_subdirectory("examples/SDL2-video-demo") +endif() \ No newline at end of file From b0f9edeb294515c423651cf8d0db77cb4f109c57 Mon Sep 17 00:00:00 2001 From: CJFEdu Date: Wed, 22 Jan 2025 12:35:17 -0600 Subject: [PATCH 2/3] Added Granular CMAKE Options Added separate CMAKE options to include each of the individual examples as well as one global option to include all examples. I set build all examples to OFF as a default since downloading all of SDL 2 and 3 seems excessive. Instead, the demo from the video and the website are turned on by default. A note about these options should probably be added to the ReadMe as well, but I wasn't sure where the logical place to put it would be. --- CMakeLists.txt | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78734ca..b3af80b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,21 +3,38 @@ project(clay) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -option(CLAY_INCLUDE_EXAMPLES "Build examples" OFF) +option(CLAY_INCLUDE_ALL_EXAMPLES "Build all examples" OFF) +option(CLAY_INCLUDE_DEMOS "Build video demo and website" ON) +option(CLAY_INCLUDE_CPP_EXAMPLE "Build C++ example" OFF) +option(CLAY_INCLUDE_RAYLIB_EXAMPLES "Build raylib examples" OFF) +option(CLAY_INCLUDE_SDL2_EXAMPLES "Build SDL 2 examples" OFF) +option(CLAY_INCLUDE_SDL3_EXAMPLES "Build SDL 3 examples" OFF) + +message(STATUS "CLAY_INCLUDE_DEMOS: ${CLAY_INCLUDE_DEMOS}") if(APPLE) enable_language(OBJC) endif() -if(CLAY_INCLUDE_EXAMPLES) +if(CLAY_INCLUDE_ALL_EXAMPLES OR CLAY_INCLUDE_CPP_EXAMPLE) add_subdirectory("examples/cpp-project-example") - add_subdirectory("examples/raylib-multi-context") - add_subdirectory("examples/raylib-sidebar-scrolling-container") - # add_subdirectory("examples/cairo-pdf-rendering") Some issue with github actions populating cairo, disable for now +endif() +if(CLAY_INCLUDE_ALL_EXAMPLES OR CLAY_INCLUDE_DEMOS) if(NOT MSVC) add_subdirectory("examples/clay-official-website") - add_subdirectory("examples/SDL3-simple-demo") endif() add_subdirectory("examples/introducing-clay-video-demo") +endif () + +if(CLAY_INCLUDE_ALL_EXAMPLES OR CLAY_INCLUDE_RAYLIB_EXAMPLES) + add_subdirectory("examples/raylib-multi-context") + add_subdirectory("examples/raylib-sidebar-scrolling-container") +endif () +if(CLAY_INCLUDE_ALL_EXAMPLES OR CLAY_INCLUDE_SDL2_EXAMPLES) add_subdirectory("examples/SDL2-video-demo") -endif() \ No newline at end of file +endif () +if(NOT MSVC AND (CLAY_INCLUDE_ALL_EXAMPLES OR CLAY_INCLUDE_SDL3_EXAMPLES)) + add_subdirectory("examples/SDL3-simple-demo") +endif() + +# add_subdirectory("examples/cairo-pdf-rendering") Some issue with github actions populating cairo, disable for now From 56f5c158fa0fb6f8d9f71c357bf980ce1f67e93f Mon Sep 17 00:00:00 2001 From: CJFEdu Date: Sat, 25 Jan 2025 08:45:58 -0600 Subject: [PATCH 3/3] Made Build All Examples the default --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3af80b..ecb29d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(clay) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -option(CLAY_INCLUDE_ALL_EXAMPLES "Build all examples" OFF) -option(CLAY_INCLUDE_DEMOS "Build video demo and website" ON) +option(CLAY_INCLUDE_ALL_EXAMPLES "Build all examples" ON) +option(CLAY_INCLUDE_DEMOS "Build video demo and website" OFF) option(CLAY_INCLUDE_CPP_EXAMPLE "Build C++ example" OFF) option(CLAY_INCLUDE_RAYLIB_EXAMPLES "Build raylib examples" OFF) option(CLAY_INCLUDE_SDL2_EXAMPLES "Build SDL 2 examples" OFF)