8 Commits

Author SHA1 Message Date
acbbbc4436 bump version to 0.2.1
All checks were successful
CI / build (push) Successful in 13s
2026-03-16 11:21:33 +01:00
6cb9b4584c fix: export namespaced target
All checks were successful
CI / build (pull_request) Successful in 13s
CI / build (push) Successful in 13s
2026-03-16 11:11:05 +01:00
3ef3035cb5 Merge pull request 'release: release v0.2.0' (#12) from release/0.2.0 into main
All checks were successful
CI / build (push) Successful in 13s
Reviewed-on: #12
2026-03-15 02:24:09 +01:00
80a9457876 bump version to 0.2.0
All checks were successful
CI / build (push) Successful in 13s
CI / build (pull_request) Successful in 13s
2026-03-15 02:23:34 +01:00
9c33df5256 feat: update README.md
All checks were successful
CI / build (push) Successful in 13s
CI / build (pull_request) Successful in 12s
2026-03-15 02:17:57 +01:00
0279742c0e fix: only build tests if top level
All checks were successful
CI / build (pull_request) Successful in 13s
CI / build (push) Successful in 12s
2026-03-15 02:08:37 +01:00
4d9fd00784 fix: small improvements in the CMakeLists.txt
All checks were successful
CI / build (pull_request) Successful in 12s
CI / build (push) Successful in 13s
2026-03-15 01:11:50 +01:00
e9df33520a feat: add cmake config for building and installing
All checks were successful
CI / build (push) Successful in 13s
Reviewed-on: #8
2026-03-15 00:52:26 +01:00
8 changed files with 111 additions and 18 deletions

View File

@@ -1,34 +1,60 @@
cmake_minimum_required(VERSION 3.10)
project(curtle VERSION 0.1.1 LANGUAGES C)
project(curtle VERSION 0.2.1 LANGUAGES C)
add_library(curtle
src/vector.c
)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
add_library(curtle STATIC src/vector.c)
add_library(curtle::curtle ALIAS curtle)
target_include_directories(curtle
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
find_library(MATH_LIB m)
if (MATH_LIB)
target_link_libraries(curtle PUBLIC ${MATH_LIB})
endif ()
target_link_libraries(curtle PUBLIC m)
install(TARGETS curtle
EXPORT curtleTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(DIRECTORY include/ DESTINATION include)
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
add_subdirectory(libs/unity)
install(EXPORT curtleTargets
FILE curtleTargets.cmake
NAMESPACE curtle::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/curtle
)
enable_testing()
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/curtleConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
add_executable(test_vector tests/test_vector.c)
target_link_libraries(test_vector PRIVATE curtle Unity)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/curtleConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/curtle
)
add_test(NAME vector_test COMMAND test_vector)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/curtleConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/curtleConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/curtle
)
if(${PROJECT_IS_TOP_LEVEL})
enable_testing()
add_subdirectory(tests)
endif()

5
Config.cmake.in Normal file
View File

@@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/curtleTargets.cmake")
check_required_components(curtle)

View File

@@ -1,3 +1,57 @@
![Logo](https://git.lowearthorbit.de/attachments/89a7215a-33ac-4284-a3c5-5647167802c3)
# curtle
Curtle is a smart turtle that helps you with math tasks.
curtle is a simple open source cross platform math library for C.
## Roadmap
The goal of curtle is to provide an easy to use and easy to integrate math library. If you are interested in specific features please reach out to me!
- add much math tooling
- provide easy install via package managers etc.
## Features
- Basic operations on 2D Vectors
- Basic operations on 3D Vectors
## Installation
Clone the repository:
```
git clone https://git.lowearthorbit.de/lowearthorbit/curtle.git
cd curtle
```
You can build and install the library using cmake:
```
mkdir build && cd build
cmake ..
sudo cmake --install .
```
## Usage/Examples
Once installed, you can use curtle with CMake:
```CMake
find_package(curtle REQUIRED)
add_executable(myapp main.c)
target_link_libraries(myapp PRIVATE curtle::curtle)
```
Example in C
```C
#include "curtle/curtle.h"
int main(void) {
struct vec2 a = { 1.0, 1.0 };
printf("%f", vec2_len(a)); // Prints sqrt(2)
}
```
## Authors
- [@lowearthorbit](https://git.lowearthorbit.de/lowearthorbit)

8
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.10)
add_subdirectory(unity)
add_executable(test_vector test_vector.c)
target_link_libraries(test_vector PRIVATE curtle Unity)
add_test(NAME vector_test COMMAND test_vector)