mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-12 13:28:07 +00:00
Compare commits
3 Commits
4da2961d24
...
9c5e1142a5
Author | SHA1 | Date | |
---|---|---|---|
|
9c5e1142a5 | ||
|
951d785deb | ||
|
5c01540234 |
@ -788,7 +788,7 @@ if (buttonIsHovered && leftMouseButtonPressed) {
|
|||||||
|
|
||||||
### CLAY_IDI()
|
### CLAY_IDI()
|
||||||
|
|
||||||
`Clay_ElementId CLAY_IDI(char *label, int index)`
|
`Clay_ElementId CLAY_IDI(char *label, int32_t 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.
|
||||||
|
|
||||||
@ -835,7 +835,7 @@ for (int i = 0; i < headerButtons.length; i++) {
|
|||||||
|
|
||||||
### CLAY_IDI_LOCAL()
|
### CLAY_IDI_LOCAL()
|
||||||
|
|
||||||
`Clay_ElementId CLAY_IDI_LOCAL(char *label, int index)`
|
`Clay_ElementId CLAY_IDI_LOCAL(char *label, int32_t index)`
|
||||||
|
|
||||||
An offset version of [CLAY_ID_LOCAL](#clay_local_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_LOCAL](#clay_local_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.
|
||||||
|
|
||||||
|
@ -2,10 +2,32 @@ cmake_minimum_required(VERSION 3.27)
|
|||||||
project(clay_official_website C)
|
project(clay_official_website C)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
set(CMAKE_C_COMPILER clang)
|
||||||
|
|
||||||
|
# Specify WebAssembly as target
|
||||||
|
set(CMAKE_C_FLAGS
|
||||||
|
"${CMAKE_C_FLAGS} -Wall -Werror -Os -DCLAY_WASM -mbulk-memory --target=wasm32 -nostdlib"
|
||||||
|
)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS
|
||||||
|
"${CMAKE_EXE_LINKER_FLAGS} -Wl,--strip-all,--export-dynamic,--no-entry,--export=__heap_base,--export=ACTIVE_RENDERER_INDEX,--initial-memory=6553600"
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(clay_official_website main.c)
|
add_executable(clay_official_website main.c)
|
||||||
|
|
||||||
target_compile_options(clay_official_website PUBLIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=missing-braces)
|
target_compile_options(clay_official_website PUBLIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=missing-braces)
|
||||||
target_include_directories(clay_official_website PUBLIC .)
|
target_include_directories(clay_official_website PUBLIC .)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
# Adjust WebAssembly output binary name
|
||||||
|
set_target_properties(clay_official_website PROPERTIES
|
||||||
|
OUTPUT_NAME index.wasm
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/clay
|
||||||
|
)
|
||||||
|
|
||||||
|
# Custom commands to copy additional resources
|
||||||
|
add_custom_command(TARGET clay_official_website POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/index.html ${CMAKE_BINARY_DIR}/clay/index.html
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/fonts ${CMAKE_BINARY_DIR}/clay/fonts
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/images ${CMAKE_BINARY_DIR}/clay/images
|
||||||
|
)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||||
|
Loading…
Reference in New Issue
Block a user