Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

/.idea
/.vs
/cmake-build-release-mingw
42 changes: 42 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.10)
project(TinyPrintfTests)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O3 -g")

# set(RUNNER "valgrind")

add_executable(test_printf test/printf.c tinyprintf.c)
add_executable(test_sprintf test/sprintf.c tinyprintf.c)

add_library(tinyprintf_minimal OBJECT tinyprintf.c)
target_compile_definitions(tinyprintf_minimal PRIVATE
TINYPRINTF_DEFINE_TFP_PRINTF=0
TINYPRINTF_DEFINE_TFP_SPRINTF=0
TINYPRINTF_OVERRIDE_LIBC=0
)

add_library(tinyprintf_only_tfp_printf OBJECT tinyprintf.c)
target_compile_definitions(tinyprintf_only_tfp_printf PRIVATE
TINYPRINTF_DEFINE_TFP_PRINTF=1
TINYPRINTF_DEFINE_TFP_SPRINTF=0
TINYPRINTF_OVERRIDE_LIBC=0
)

add_library(tinyprintf_only_tfp_sprintf OBJECT tinyprintf.c)
target_compile_definitions(tinyprintf_only_tfp_sprintf PRIVATE
TINYPRINTF_DEFINE_TFP_PRINTF=0
TINYPRINTF_DEFINE_TFP_SPRINTF=1
TINYPRINTF_OVERRIDE_LIBC=0
)

target_link_libraries(test_printf PRIVATE tinyprintf_minimal)
target_link_libraries(test_sprintf PRIVATE tinyprintf_minimal)

add_custom_target(runtests
COMMAND ${RUNNER} $<TARGET_FILE:test_printf> || exit $$?
COMMAND ${RUNNER} $<TARGET_FILE:test_sprintf> || exit $$?
)

add_custom_target(cleanup
COMMAND ${CMAKE_COMMAND} -E remove -f test/printf test/sprintf
)
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Copyright (C) 2004,2012 Kustaa Nyholm
Licenses: LGPL 2.1 or later (see LICENSE.LGPL-2.1)
or BSD-new (see LICENSE.BSD-new)

"You are free to use the LGPL license [...] or the BSD license"
"You are free to use the LGPL license [...] or the BSD license"
Loading