Configure and Build
Select build options through the curses menu, then build and install:
make menu
make build
make install INSTALL_PREFIX=/opt/sgl
The package installs public headers, the sgl-core library, pkg-config metadata, and a CMake package. A direct CMake consumer can use:
find_package(sgl-core-package CONFIG REQUIRED)
target_link_libraries(application PRIVATE sgl-core::sgl-core)
Include and Link
Application code normally needs only:
Public API for memory, image processing, queues, and worker threads.
sgl-fixed_point.h and sgl-compiler.h are low-level support headers for code that intentionally shares SGL's arithmetic or compiler abstractions.
Runtime Lifecycle
SGL allocations come from one caller-owned process-wide pool. The pool's backing array must remain alive and unchanged until deinitialization succeeds. Objects must be destroyed in reverse order before detaching the pool.
#define APP_SGL_POOL_BYTES (8U * 1024U * 1024U)
{
app_sgl_pool,
#if defined(SGL_CFG_HAS_THREAD)
4U,
"sgl-app");
}
}
#endif
#if defined(SGL_CFG_HAS_THREAD)
}
#endif
}
return result;
}
sgl_result_t sgl_memory_pool_initialize(void *memory, sgl_size_t size)
Registers the process-wide SGL memory pool.
sgl_result_t sgl_memory_pool_deinitialize(void)
Detaches the caller-owned memory pool.
#define SGL_NULL
Null pointer constant for public SGL interfaces.
unsigned long sgl_size_t
Unsigned type used for object sizes and byte counts.
unsigned char sgl_uint8_t
Unsigned integer with exactly 8 value bits.
sgl_result_t sgl_threadpool_destroy(sgl_threadpool_t *pool)
Stops workers and destroys a thread pool.
sgl_threadpool_t * sgl_threadpool_create(sgl_size_t num_threads, sgl_size_t max_routine_lists, const char *base_name)
Creates a worker-thread pool.
struct sgl_threadpool sgl_threadpool_t
Opaque synchronous worker-thread pool.
sgl_result_t
Result codes returned by SGL operations.
@ SGL_FAILURE
Operation failed without a more specific code.
@ SGL_SUCCESS
Operation completed successfully.
@ SGL_ERROR_MEMORY_ALLOCATION
The configured SGL memory pool could not satisfy an allocation.
#define SGL_THREADPOOL_DEFAULT_MAX_ROUTINE_LISTS
Default maximum routine-list count accepted by sgl_threadpool_create().
Error Handling
Image functions return sgl_result_t. Treat every value other than SGL_SUCCESS as a failed operation. Pointer-returning creation functions report invalid input and allocation failure as SGL_NULL. Size-query functions return zero for invalid or overflowing geometry.