Compare commits

...

7 Commits

Author SHA1 Message Date
Mathys Gasnier
7f8f6d2306
Merge efdcdfea6e into 902ff3b0a9 2024-12-31 12:52:54 +08:00
Stowy
902ff3b0a9
Fixed compilation using clang on windows (#134)
Some checks failed
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Failing after 12s
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Failing after 10s
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
2024-12-31 17:51:18 +13:00
SuperOpt
2938c00dc8
[Renderers/Cairo] Add FindCairo.cmake (#122) 2024-12-31 13:32:56 +13:00
SuperOpt
ba78b35604
C++ projects should use CXX flags (#136) 2024-12-31 13:29:49 +13:00
Mathys Gasnier
efdcdfea6e
Adding separators to improve readability 2024-12-29 12:00:42 +01:00
Mathys Gasnier
1fd8593da8
Fixing indentation of summary 2024-12-29 11:56:35 +01:00
Mathys Gasnier
569e468cd8
Adding a summary to the readme 2024-12-29 11:54:04 +01:00
6 changed files with 160 additions and 7 deletions

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.27) cmake_minimum_required(VERSION 3.27)
project(clay) project(clay)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_subdirectory("examples/cpp-project-example") add_subdirectory("examples/cpp-project-example")
# Don't try to compile C99 projects using MSVC # Don't try to compile C99 projects using MSVC

115
README.md
View File

@ -151,6 +151,62 @@ In summary, the general order of steps is:
For help starting out or to discuss clay, considering joining [the discord server.](https://discord.gg/b4FTWkxdvT) For help starting out or to discuss clay, considering joining [the discord server.](https://discord.gg/b4FTWkxdvT)
## Summary
- [High Level Documentation](#high-level-documentation)
- [Building UI Hierarchies](#building-ui-hierarchies)
- [Configuring Layout and Styling UI Elements](#configuring-layout-and-styling-ui-elements)
- [Element IDs](#element-ids)
- [Mouse, Touch and Pointer Interactions](#mouse-touch-and-pointer-interactions)
- [Scrolling Elements](#scrolling-elements)
- [Floating Elements](#floating-elements-absolute-positioning)
- [Custom Elements](#laying-out-your-own-custom-elements)
- [Retained Mode Rendering](#retained-mode-rendering)
- [Visibility Culling](#visibility-culling)
- [Preprocessor Directives](#preprocessor-directives)
- [Bindings](#bindings-for-non-c)
- [Debug Tools](#debug-tools)
- [API](#api)
- [Naming Conventions](#naming-conventions)
- [Public Functions](#public-functions)
- [Lifecycle](#lifecycle-for-public-functions)
- [Clay_MinMemorySize](#clay_minmemorysize)
- [Clay_CreateArenaWithCapacityAndMemory](#clay_createarenawithcapacityandmemory)
- [Clay_SetMeasureTextFunction](#clay_setmeasuretextfunction)
- [Clay_SetMaxElementCount](clay_setmaxelementcount)
- [Clay_SetMaxMeasureTextCacheWordCount](#clay_setmaxmeasuretextcachewordcount)
- [Clay_Initialize](#clay_initialize)
- [Clay_SetLayoutDimensions](#clay_setlayoutdimensions)
- [Clay_SetPointerState](#clay_setpointerstate)
- [Clay_UpdateScrollContainers](#clay_updatescrollcontainers)
- [Clay_BeginLayout](#clay_beginlayout)
- [Clay_EndLayout](#clay_endlayout)
- [Clay_Hovered](#clay_hovered)
- [Clay_OnHover](#clay_onhover)
- [Clay_PointerOver](#clay_pointerover)
- [Clay_GetScrollContainerData](#clay_getscrollcontainerdata)
- [Clay_GetElementId](#clay_getelementid)
- [Element Macros](#element-macros)
- [CLAY](#clay-1)
- [CLAY_ID](#clay_id)
- [CLAY_IDI](#clay_idi)
- [CLAY_LAYOUT](#clay_layout)
- [CLAY_RECTANGLE](#clay_rectangle)
- [CLAY_TEXT](#clay_text)
- [CLAY_IMAGE](#clay_image)
- [CLAY_SCROLL](#clay_scroll)
- [CLAY_BORDER](#clay_border)
- [CLAY_FLOATING](#clay_floating)
- [CLAY_CUSTOM_ELEMENT](#clay_custom_element)
- [Data Structures & Defs](data-structures--definitions)
- [Clay_String](#clay_string)
- [Clay_ElementId](#clay_elementid)
- [Clay_RenderCommandArray](#clay_rendercommandarray)
- [Clay_RenderCommand](#clay_rendercommand)
- [Clay_ScrollContainerData](#clay_scrollcontainerdata)
- [Clay_ErrorHandler](#clay_errorhandler)
- [Clay_ErrorData](#clay_errordata)
## High Level Documentation ## High Level Documentation
### Building UI Hierarchies ### Building UI Hierarchies
@ -460,18 +516,24 @@ _The official Clay website with debug tooling visible_
**Each Frame** **Each Frame**
`Clay_SetLayoutDimensions` -> `Clay_SetPointerState` -> `Clay_UpdateScrollContainers` -> `Clay_BeginLayout` -> `CLAY() etc...` -> `Clay_EndLayout` `Clay_SetLayoutDimensions` -> `Clay_SetPointerState` -> `Clay_UpdateScrollContainers` -> `Clay_BeginLayout` -> `CLAY() etc...` -> `Clay_EndLayout`
---
### Clay_MinMemorySize ### Clay_MinMemorySize
`uint32_t Clay_MinMemorySize()` `uint32_t Clay_MinMemorySize()`
Returns the minimum amount of memory **in bytes** that clay needs to accomodate the current [CLAY_MAX_ELEMENT_COUNT](#preprocessor-directives). Returns the minimum amount of memory **in bytes** that clay needs to accomodate the current [CLAY_MAX_ELEMENT_COUNT](#preprocessor-directives).
---
### Clay_CreateArenaWithCapacityAndMemory ### Clay_CreateArenaWithCapacityAndMemory
`Clay_Arena Clay_CreateArenaWithCapacityAndMemory(uint32_t capacity, void *offset)` `Clay_Arena Clay_CreateArenaWithCapacityAndMemory(uint32_t capacity, void *offset)`
Creates a `Clay_Arena` struct with the given capacity and base memory pointer, which can be passed to [Clay_Initialize](#clay_initialize). Creates a `Clay_Arena` struct with the given capacity and base memory pointer, which can be passed to [Clay_Initialize](#clay_initialize).
---
### Clay_SetMeasureTextFunction ### Clay_SetMeasureTextFunction
`void Clay_SetMeasureTextFunction(Clay_Dimensions (*measureTextFunction)(Clay_String *text, Clay_TextElementConfig *config))` `void Clay_SetMeasureTextFunction(Clay_Dimensions (*measureTextFunction)(Clay_String *text, Clay_TextElementConfig *config))`
@ -482,6 +544,8 @@ Takes a pointer to a function that can be used to measure the `width, height` di
**Note 2: It is essential that this function is as fast as possible.** For text heavy use-cases this function is called many times, and despite the fact that clay caches text measurements internally, it can easily become the dominant overall layout cost if the provided function is slow. **This is on the hot path!** **Note 2: It is essential that this function is as fast as possible.** For text heavy use-cases this function is called many times, and despite the fact that clay caches text measurements internally, it can easily become the dominant overall layout cost if the provided function is slow. **This is on the hot path!**
---
### Clay_SetMaxElementCount ### Clay_SetMaxElementCount
`void Clay_SetMaxElementCount(uint32_t maxElementCount)` `void Clay_SetMaxElementCount(uint32_t maxElementCount)`
@ -490,6 +554,8 @@ Updates the internal maximum element count, allowing clay to allocate larger UI
**Note: You will need to reinitialize clay, after calling [Clay_MinMemorySize()](#clay_minmemorysize) to calculate updated memory requirements.** **Note: You will need to reinitialize clay, after calling [Clay_MinMemorySize()](#clay_minmemorysize) to calculate updated memory requirements.**
---
### Clay_SetMaxMeasureTextCacheWordCount ### Clay_SetMaxMeasureTextCacheWordCount
`void Clay_SetMaxMeasureTextCacheWordCount(uint32_t maxMeasureTextCacheWordCount)` `void Clay_SetMaxMeasureTextCacheWordCount(uint32_t maxMeasureTextCacheWordCount)`
@ -498,6 +564,8 @@ Updates the internal text measurement cache size, allowing clay to allocate more
**Note: You will need to reinitialize clay, after calling [Clay_MinMemorySize()](#clay_minmemorysize) to calculate updated memory requirements.** **Note: You will need to reinitialize clay, after calling [Clay_MinMemorySize()](#clay_minmemorysize) to calculate updated memory requirements.**
---
### Clay_Initialize ### Clay_Initialize
`void Clay_Initialize(Clay_Arena arena, Clay_Dimensions layoutDimensions, Clay_ErrorHandler errorHandler)` `void Clay_Initialize(Clay_Arena arena, Clay_Dimensions layoutDimensions, Clay_ErrorHandler errorHandler)`
@ -506,18 +574,24 @@ Initializes the internal memory mapping, sets the internal dimensions for layout
Reference: [Clay_Arena](#clay_createarenawithcapacityandmemory), [Clay_ErrorHandler](#clay_errorhandler) Reference: [Clay_Arena](#clay_createarenawithcapacityandmemory), [Clay_ErrorHandler](#clay_errorhandler)
---
### Clay_SetLayoutDimensions ### Clay_SetLayoutDimensions
`void Clay_SetLayoutDimensions(Clay_Dimensions dimensions)` `void Clay_SetLayoutDimensions(Clay_Dimensions dimensions)`
Sets the internal layout dimensions. Cheap enough to be called every frame with your screen dimensions to automatically respond to window resizing, etc. Sets the internal layout dimensions. Cheap enough to be called every frame with your screen dimensions to automatically respond to window resizing, etc.
---
### Clay_SetPointerState ### Clay_SetPointerState
`void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown)` `void Clay_SetPointerState(Clay_Vector2 position, bool isPointerDown)`
Sets the internal pointer position and state (i.e. current mouse / touch position) and recalculates overlap info, which is used for mouseover / click calculation (via [Clay_PointerOver](#clay_pointerover) and updating scroll containers with [Clay_UpdateScrollContainers](#clay_updatescrollcontainers). **isPointerDown should represent the current state this frame, e.g. it should be `true` for the entire duration the left mouse button is held down.** Clay has internal handling for detecting click / touch start & end. Sets the internal pointer position and state (i.e. current mouse / touch position) and recalculates overlap info, which is used for mouseover / click calculation (via [Clay_PointerOver](#clay_pointerover) and updating scroll containers with [Clay_UpdateScrollContainers](#clay_updatescrollcontainers). **isPointerDown should represent the current state this frame, e.g. it should be `true` for the entire duration the left mouse button is held down.** Clay has internal handling for detecting click / touch start & end.
---
### Clay_UpdateScrollContainers ### Clay_UpdateScrollContainers
`void Clay_UpdateScrollContainers(bool enableDragScrolling, Clay_Vector2 scrollDelta, float deltaTime)` `void Clay_UpdateScrollContainers(bool enableDragScrolling, Clay_Vector2 scrollDelta, float deltaTime)`
@ -528,24 +602,32 @@ Touch / drag scrolling only occurs if the `enableDragScrolling` parameter is `tr
`deltaTime` is the time **in seconds** since the last frame (e.g. 0.016 is **16 milliseconds**), and is used to normalize & smooth scrolling across different refresh rates. `deltaTime` is the time **in seconds** since the last frame (e.g. 0.016 is **16 milliseconds**), and is used to normalize & smooth scrolling across different refresh rates.
---
### Clay_BeginLayout ### Clay_BeginLayout
`void Clay_BeginLayout()` `void Clay_BeginLayout()`
Prepares clay to calculate a new layout. Called each frame / layout **before** any of the [Element Macros](#element-macros). Prepares clay to calculate a new layout. Called each frame / layout **before** any of the [Element Macros](#element-macros).
---
### Clay_EndLayout ### Clay_EndLayout
`Clay_RenderCommandArray Clay_EndLayout()` `Clay_RenderCommandArray Clay_EndLayout()`
Ends declaration of element macros and calculates the results of the current layout. Renders a [Clay_RenderCommandArray](#clay_rendercommandarray) containing the results of the layout calculation. Ends declaration of element macros and calculates the results of the current layout. Renders a [Clay_RenderCommandArray](#clay_rendercommandarray) containing the results of the layout calculation.
---
### Clay_Hovered ### Clay_Hovered
`bool Clay_Hovered()` `bool Clay_Hovered()`
Called **during** layout declaration, and returns `true` if the pointer position previously set with `Clay_SetPointerState` is inside the bounding box of the currently open element. Note: this is based on the element's position from the **last** frame. Called **during** layout declaration, and returns `true` if the pointer position previously set with `Clay_SetPointerState` is inside the bounding box of the currently open element. Note: this is based on the element's position from the **last** frame.
---
### Clay_OnHover ### Clay_OnHover
`void Clay_OnHover(void (*onHoverFunction)(Clay_ElementId elementId, Clay_PointerData pointerData, intptr_t userData), intptr_t userData)` `void Clay_OnHover(void (*onHoverFunction)(Clay_ElementId elementId, Clay_PointerData pointerData, intptr_t userData), intptr_t userData)`
@ -570,6 +652,8 @@ CLAY(CLAY_LAYOUT({ .padding = { 8, 8 }}), Clay_OnHover(HandleButtonInteraction,
} }
``` ```
---
### Clay_PointerOver ### Clay_PointerOver
`bool Clay_PointerOver(Clay_ElementId id)` `bool Clay_PointerOver(Clay_ElementId id)`
@ -582,6 +666,8 @@ Returns `true` if the pointer position previously set with `Clay_SetPointerState
Returns [Clay_ScrollContainerData](#clay_scrollcontainerdata) for the scroll container matching the provided ID. This function allows imperative manipulation of scroll position, allowing you to build things such as scroll bars, buttons that "jump" to somewhere in a scroll container, etc. Returns [Clay_ScrollContainerData](#clay_scrollcontainerdata) for the scroll container matching the provided ID. This function allows imperative manipulation of scroll position, allowing you to build things such as scroll bars, buttons that "jump" to somewhere in a scroll container, etc.
---
### Clay_GetElementId ### Clay_GetElementId
`Clay_ElementId Clay_GetElementId(Clay_String idString)` `Clay_ElementId Clay_GetElementId(Clay_String idString)`
@ -622,6 +708,8 @@ CLAY(CLAY_ID("Outer"), CLAY_LAYOUT({ .padding = {16, 16} })) {
} }
``` ```
---
### CLAY_ID ### CLAY_ID
**Usage** **Usage**
@ -656,12 +744,16 @@ if (buttonIsHovered && leftMouseButtonPressed) {
} }
``` ```
---
### CLAY_IDI() ### CLAY_IDI()
`Clay_ElementId CLAY_IDI(char *label, int index)` `Clay_ElementId CLAY_IDI(char *label, int index)`
An offset version of [CLAY_ID](#clay_id). Generates a [Clay_ElementId](#clay_elementid) string id from the provided `char *label`, combined with the `int index`. Used for generating ids for sequential elements (such as in a `for` loop) without having to construct dynamic strings at runtime. An offset version of [CLAY_ID](#clay_id). Generates a [Clay_ElementId](#clay_elementid) string id from the provided `char *label`, combined with the `int index`. Used for generating ids for sequential elements (such as in a `for` loop) without having to construct dynamic strings at runtime.
---
### CLAY_LAYOUT ### CLAY_LAYOUT
**Usage** **Usage**
@ -773,6 +865,8 @@ CLAY(CLAY_ID("Button"), CLAY_LAYOUT({ .layoutDirection = CLAY_TOP_TO_BOTTOM, .si
} }
``` ```
---
### CLAY_RECTANGLE ### CLAY_RECTANGLE
**Usage** **Usage**
@ -854,6 +948,8 @@ CLAY(
} }
``` ```
---
### CLAY_TEXT ### CLAY_TEXT
**Usage** **Usage**
@ -975,6 +1071,8 @@ Element is subject to [culling](#visibility-culling). Otherwise, multiple `Clay_
`Clay_RenderCommand.textContent` will be populated with a `Clay_String` _slice_ of the original string passed in (i.e. wrapping doesn't reallocate, it just returns a `Clay_String` pointing to the start of the new line with a `length`) `Clay_RenderCommand.textContent` will be populated with a `Clay_String` _slice_ of the original string passed in (i.e. wrapping doesn't reallocate, it just returns a `Clay_String` pointing to the start of the new line with a `length`)
---
### CLAY_IMAGE ### CLAY_IMAGE
**Usage** **Usage**
@ -1072,6 +1170,8 @@ Image *imageToRender = renderCommand->elementConfig.imageElementConfig->imageDat
Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_RenderCommand`s with `commandType = CLAY_RENDER_COMMAND_TYPE_IMAGE` will be created. The user will need to access `renderCommand->elementConfig.imageElementConfig->imageData` to retrieve image data referenced during layout creation. It's also up to the user to decide how / if they wish to blend `rectangleElementConfig->color` with the image. Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_RenderCommand`s with `commandType = CLAY_RENDER_COMMAND_TYPE_IMAGE` will be created. The user will need to access `renderCommand->elementConfig.imageElementConfig->imageData` to retrieve image data referenced during layout creation. It's also up to the user to decide how / if they wish to blend `rectangleElementConfig->color` with the image.
---
### CLAY_SCROLL ### CLAY_SCROLL
**Usage** **Usage**
@ -1131,6 +1231,8 @@ CLAY(CLAY_SCROLL(.vertical = true)) {
} }
``` ```
---
### CLAY_BORDER ### CLAY_BORDER
**Usage** **Usage**
@ -1248,6 +1350,8 @@ CLAY(
Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_RenderCommand` with `commandType = CLAY_RENDER_COMMAND_TYPE_BORDER` representing the container will be created. Element is subject to [culling](#visibility-culling). Otherwise, a single `Clay_RenderCommand` with `commandType = CLAY_RENDER_COMMAND_TYPE_BORDER` representing the container will be created.
Rendering of borders and rounded corners is left up to the user. See the provided [Raylib Renderer](https://github.com/nicbarker/clay/tree/main/renderers/raylib) for examples of how to draw borders using line and curve primitives. Rendering of borders and rounded corners is left up to the user. See the provided [Raylib Renderer](https://github.com/nicbarker/clay/tree/main/renderers/raylib) for examples of how to draw borders using line and curve primitives.
---
### CLAY_FLOATING ### CLAY_FLOATING
**Usage** **Usage**
@ -1459,6 +1563,8 @@ When using `.parentId`, the floating container can be declared anywhere after `B
`CLAY_FLOATING` elements will not generate any render commands. `CLAY_FLOATING` elements will not generate any render commands.
---
### CLAY_CUSTOM_ELEMENT ### CLAY_CUSTOM_ELEMENT
**Usage** **Usage**
@ -1585,6 +1691,8 @@ The number of characters in the string, _not including an optional null terminat
A pointer to the contents of the string. This data is not guaranteed to be null terminated, so if you are passing it to code that expects standard null terminated C strings, you will need to copy the data and append a null terminator. A pointer to the contents of the string. This data is not guaranteed to be null terminated, so if you are passing it to code that expects standard null terminated C strings, you will need to copy the data and append a null terminator.
---
### Clay_ElementId ### Clay_ElementId
```C ```C
@ -1622,6 +1730,7 @@ If this id was generated using [CLAY_IDI](#clay_idi), `.baseId` is the hash of t
Stores the original string that was passed in when [CLAY_ID](#clay_id) or [CLAY_IDI](#clay_idi) were called. Stores the original string that was passed in when [CLAY_ID](#clay_id) or [CLAY_IDI](#clay_idi) were called.
---
### Clay_RenderCommandArray ### Clay_RenderCommandArray
@ -1655,6 +1764,8 @@ Represents the total number of `Clay_RenderCommand` elements stored consecutivel
An array of [Clay_RenderCommand](#clay_rendercommand)s representing the calculated layout. If there was at least one render command, this array will contain elements from `.internalArray[0]` to `.internalArray[.length - 1]`. An array of [Clay_RenderCommand](#clay_rendercommand)s representing the calculated layout. If there was at least one render command, this array will contain elements from `.internalArray[0]` to `.internalArray[.length - 1]`.
---
### Clay_RenderCommand ### Clay_RenderCommand
```C ```C
@ -1721,6 +1832,8 @@ Only used if `.commandType == CLAY_RENDER_COMMAND_TYPE_TEXT`. A `Clay_String` co
The id that was originally used with the element macro that created this render command. See [CLAY_ID](#clay_id) for details. The id that was originally used with the element macro that created this render command. See [CLAY_ID](#clay_id) for details.
---
### Clay_ScrollContainerData ### Clay_ScrollContainerData
```C ```C
@ -1770,6 +1883,8 @@ Dimensions representing the inner width and height of the content _inside_ the s
The [Clay_ScrollElementConfig](#clay_scroll) for the matching scroll container element. The [Clay_ScrollElementConfig](#clay_scroll) for the matching scroll container element.
---
### Clay_PointerData ### Clay_PointerData
```C ```C

2
clay.h
View File

@ -134,7 +134,7 @@ CLAY__ALIGNMENT_STRUCT(bool);
CLAY__ALIGNMENT_STRUCT(uint8_t); CLAY__ALIGNMENT_STRUCT(uint8_t);
CLAY__ALIGNMENT_STRUCT(int32_t); CLAY__ALIGNMENT_STRUCT(int32_t);
#ifdef _MSC_VER #if defined(_MSC_VER) && !defined(__clang__)
#define CLAY_PACKED_ENUM __pragma(pack(push, 1)) enum __pragma(pack(pop)) #define CLAY_PACKED_ENUM __pragma(pack(push, 1)) enum __pragma(pack(pop))
#else #else
#define CLAY_PACKED_ENUM enum __attribute__((__packed__)) #define CLAY_PACKED_ENUM enum __attribute__((__packed__))

32
cmake/FindCairo.cmake Normal file
View File

@ -0,0 +1,32 @@
# Defines:
# CAIRO_FOUND - System has Cairo
# CAIRO_INCLUDE_DIRS - Cairo include directories
# CAIRO_LIBRARY - Cairo library
# Cairo::Cairo - Imported target
find_path(CAIRO_INCLUDE_DIRS
NAMES cairo/cairo.h
PATHS ${CAIRO_ROOT_DIR}
PATH_SUFFIXES include
)
find_library(CAIRO_LIBRARY
NAMES cairo
PATHS ${CAIRO_ROOT_DIR}
PATH_SUFFIXES lib lib64
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cairo
REQUIRED_VARS CAIRO_LIBRARY CAIRO_INCLUDE_DIRS
)
if(Cairo_FOUND AND NOT TARGET Cairo::Cairo)
add_library(Cairo::Cairo UNKNOWN IMPORTED)
set_target_properties(Cairo::Cairo PROPERTIES
IMPORTED_LOCATION "${CAIRO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CAIRO_INCLUDE_DIRS}"
)
endif()
mark_as_advanced(CAIRO_INCLUDE_DIRS CAIRO_LIBRARY)

View File

@ -2,13 +2,17 @@ cmake_minimum_required(VERSION 3.27)
project(clay_examples_cairo_pdf_rendering C) project(clay_examples_cairo_pdf_rendering C)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
add_executable(clay_examples_cairo_pdf_rendering main.c) add_executable(clay_examples_cairo_pdf_rendering main.c)
find_package(Cairo REQUIRED)
target_compile_options(clay_examples_cairo_pdf_rendering PUBLIC) target_compile_options(clay_examples_cairo_pdf_rendering PUBLIC)
target_include_directories(clay_examples_cairo_pdf_rendering PUBLIC .) target_include_directories(clay_examples_cairo_pdf_rendering PUBLIC . ${CAIRO_INCLUDE_DIRS})
target_link_libraries(clay_examples_cairo_pdf_rendering PUBLIC cairo)
target_link_libraries(clay_examples_cairo_pdf_rendering PUBLIC Cairo::Cairo)
set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror -Wno-error=missing-braces") set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror -Wno-error=missing-braces")
set(CMAKE_C_FLAGS_RELEASE "-O3") set(CMAKE_C_FLAGS_RELEASE "-O3")

View File

@ -8,5 +8,5 @@ add_executable(clay_examples_cpp_project_example main.cpp)
target_include_directories(clay_examples_cpp_project_example PUBLIC .) target_include_directories(clay_examples_cpp_project_example PUBLIC .)
set(CMAKE_C_FLAGS_DEBUG "-Werror -Wall -Wno-error=missing-braces") set(CMAKE_CXX_FLAGS_DEBUG "-Werror -Wall -Wno-error=missing-braces")
set(CMAKE_C_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELEASE "-O3")