Skip to content

Commit

Permalink
Final tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbarker committed Sep 28, 2024
1 parent 24c4bcd commit d68af1c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms

on:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(clay)

add_subdirectory("examples/cpp-project-example")

# Don't try to compile C99 projects using MSVC
if(NOT MSVC)
add_subdirectory("examples/raylib-sidebar-scrolling-container")
add_subdirectory("examples/clay-official-website")
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,15 @@ The supported directives are:
- `CLAY_EXTEND_CONFIG_IMAGE` - Provide additional struct members to `CLAY_IMAGE_CONFIG` that will be passed through with output render commands.
- `CLAY_EXTEND_CONFIG_CUSTOM` - Provide additional struct members to `CLAY_IMAGE_CONFIG` that will be passed through with output render commands.

### Bindings
### Bindings for non C

Clay is usable out of the box as a `.h` include in both C99 and C++ with designated initializer support.
Clay is usable out of the box as a `.h` include in both C99 and C++20 with designated initializer support.
There are also supported bindings for other languages, including:

- [Odin Bindings](https://github.com/nicbarker/clay/tree/main/bindings/odin)

Unfortunately clay does **not** support Microsoft C11 or C17 via MSVC at this time.

### Debug Tools

Clay includes built-in UI debugging tools, similar to the "inspector" in browsers such as Chrome or Firefox. These tools are included in `clay.h`, and work by injecting additional render commands into the output [Clay_RenderCommandArray](#clay_rendercommandarray).
Expand Down
10 changes: 3 additions & 7 deletions clay.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
#define CLAY_WASM_EXPORT(null)
#endif

#ifdef _MSC_VER
#define CLAY_PACKED_ENUM : uint8_t
#else
#define CLAY_PACKED_ENUM __attribute__((__packed__))
#endif

// Public Macro API ------------------------

#define CLAY_LAYOUT(...) Clay__StoreLayoutConfig(CLAY__INIT(Clay_LayoutConfig) {__VA_ARGS__ })
Expand Down Expand Up @@ -113,11 +107,13 @@ static int CLAY__ELEMENT_DEFINITION_LATCH = 0;
Clay__CloseElementWithChildren()

#ifdef __cplusplus
#define CLAY__ALIGNMENT(type) alignof(type)
#define CLAY__INIT(type) type
#define CLAY__ALIGNMENT(type) alignof(type)
#define CLAY_PACKED_ENUM : uint8_t
#else
#define CLAY__INIT(type) (type)
#define CLAY__ALIGNMENT(type) (offsetof(struct { char c; type x; }, x))
#define CLAY_PACKED_ENUM __attribute__((__packed__))
#endif

#ifdef __cplusplus
Expand Down
2 changes: 0 additions & 2 deletions examples/clay-official-website/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ set(CMAKE_C_STANDARD 99)

add_executable(clay_official_website main.c)

if(!MSVC)
target_compile_options(clay_official_website PUBLIC -Wall -Werror -Wno-unknown-pragmas)
endif()
target_include_directories(clay_official_website PUBLIC .)

set(CMAKE_CXX_FLAGS_RELEASE "-O3")
1 change: 1 addition & 0 deletions examples/raylib-sidebar-scrolling-container/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.28)
project(clay_examples_raylib_sidebar_scrolling_container C)
set(CMAKE_C_STANDARD 99)

# Adding Raylib
include(FetchContent)
Expand Down

0 comments on commit d68af1c

Please sign in to comment.