diff --git a/.cmake/Modules/FindLibcsptr.cmake b/.cmake/Modules/FindLibcsptr.cmake new file mode 100644 index 0000000..cd5e52e --- /dev/null +++ b/.cmake/Modules/FindLibcsptr.cmake @@ -0,0 +1,31 @@ +# Copyright (C) 2015 Franklin "Snaipe" Mathieu. +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the LICENSE file distributed with Criterion. + +# - Find libcsptr +# Find the native libcsptr headers and libraries. +# +# CSPTR_INCLUDE_DIRS - where to find smart_ptr.h, etc. +# CSPTR_LIBRARIES - List of libraries when using libcsptr. +# CSPTR_FOUND - True if libcsptr has been found. + +# Look for the header file. +FIND_PATH(CSPTR_INCLUDE_DIR csptr/smart_ptr.h PATH_SUFFIXES csptr) + +# Look for the library. +FIND_LIBRARY(CSPTR_LIBRARY NAMES csptr) + +# Handle the QUIETLY and REQUIRED arguments and set CSPTR_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CSPTR DEFAULT_MSG CSPTR_LIBRARY CSPTR_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(CSPTR_FOUND) + SET(CSPTR_LIBRARIES ${CSPTR_LIBRARY}) + SET(CSPTR_INCLUDE_DIRS ${CSPTR_INCLUDE_DIR}) +ELSE(CSPTR_FOUND) + SET(CSPTR_LIBRARIES) + SET(CSPTR_INCLUDE_DIRS) +ENDIF(CSPTR_FOUND) + +MARK_AS_ADVANCED(CSPTR_INCLUDE_DIRS CSPTR_LIBRARIES) diff --git a/.cmake/Modules/FindPCRE.cmake b/.cmake/Modules/FindPCRE.cmake new file mode 100644 index 0000000..dbbd60a --- /dev/null +++ b/.cmake/Modules/FindPCRE.cmake @@ -0,0 +1,37 @@ +# Copyright (C) 2007-2009 LuaDist. +# Created by Peter Kapec +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the COPYRIGHT file distributed with LuaDist. +# Note: +# Searching headers and libraries is very simple and is NOT as powerful as scripts +# distributed with CMake, because LuaDist defines directories to search for. +# Everyone is encouraged to contact the author with improvements. Maybe this file +# becomes part of CMake distribution sometimes. + +# - Find pcre +# Find the native PCRE headers and libraries. +# +# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + +# Look for the header file. +FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) + +# Look for the library. +FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) + +# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(PCRE_FOUND) + SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) + SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) +ELSE(PCRE_FOUND) + SET(PCRE_LIBRARIES) + SET(PCRE_INCLUDE_DIRS) +ENDIF(PCRE_FOUND) + +MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES) diff --git a/.cmake/Modules/GettextTranslate.cmake b/.cmake/Modules/GettextTranslate.cmake new file mode 100644 index 0000000..553b13d --- /dev/null +++ b/.cmake/Modules/GettextTranslate.cmake @@ -0,0 +1,285 @@ +# Copyright (c) 2012, Jarryd Beck +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + + +# This module creates build rules for updating translation files made +# with gettext +# In your top level CMakeLists.txt, do +# include(GettextTranslate) +# then in any po directory where you want things to be translated, write +# GettextTranslate() +# +# This module also finds the gettext binaries. If these are in a non-standard +# location, you can define the following variables to provide paths to search +# in +# GettextTranslate_BINARIES --- a path in which to look for every program +# GettextTranslate_XGETTEXT --- the xgettext program +# GettextTranslate_MSGINIT --- the msginit program +# GettextTranslate_MSGFILTER --- the msgfilter program +# GettextTranslate_MSGCONV --- the msgconv program +# GettextTranslate_MSGMERGE --- the msgmerge program +# GettextTranslate_MSGFMT --- the msgfmt program +# these are searched first before $PATH, so set this if you have your own +# version that overrides the system version +# +# it reads variables from Makevars, one of the most important being DOMAIN +# it reads the languages to generate from LINGUAS +# +# it adds the following targets +# update-po +# update-gmo +# ${DOMAIN}-pot.update +# generate-${DOMAIN}-${lang}-po +# generate-${DOMAIN}-${lang}-gmo +# +# where ${DOMAIN} is the DOMAIN variable read from Makevars +# and ${lang} is each language mentioned in LINGUAS +# +# if you want update-gmo to be added to the "all" target, then define the +# variable GettextTranslate_ALL before including this file +# +# by default, the gmo files are built in the source directory. If you want +# them to be built in the binary directory, then define the variable +# GettextTranslate_GMO_BINARY + + + +# add the update-po and update-gmo targets, the actual files that need to +# depend on this will be added as we go + +if (DEFINED GettextTranslate_ALL) + set(_addToALL "ALL") +endif() + +add_custom_target(update-po) +add_custom_target(update-gmo ${_addToALL}) + +#look for all the programs +#xgettext, msginit, msgfilter, msgconv, msgmerge, msgfmt + +function(REQUIRE_BINARY binname varname) + if (defined ${${varname}-NOTFOUND}) + message(FATAL_ERROR "Could not find " binname) + endif() +endfunction() + +find_program(GettextTranslate_XGETTEXT_EXECUTABLE xgettext + HINTS ${GettextTranslate_XGETTEXT} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(xgettext GettextTranslate_XGETTEXT_EXECUTABLE) + +find_program(GettextTranslate_MSGINIT_EXECUTABLE msginit + HINTS ${GettextTranslate_MSGINIT} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(msginit GettextTranslate_MSGINIT_EXECUTABLE) + +find_program(GettextTranslate_MSGFILTER_EXECUTABLE msgfilter + HINTS ${GettextTranslate_MSGFILTER} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(msgfilter GettextTranslate_MSGFILTER_EXECUTABLE) + +find_program(GettextTranslate_MSGCONV_EXECUTABLE msgconv + HINTS ${GettextTranslate_MSGCONV} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(msgconv GettextTranslate_MSGCONV_EXECUTABLE) + +find_program(GettextTranslate_MSGMERGE_EXECUTABLE msgmerge + HINTS ${GettextTranslate_MSGMERGE} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(msgmerge GettextTranslate_MSGMERGE_EXECUTABLE) + +find_program(GettextTranslate_MSGFMT_EXECUTABLE msgfmt + HINTS ${GettextTranslate_MSGFMT} ${GettextTranslate_BINARIES} +) +REQUIRE_BINARY(msgfmt GettextTranslate_MSGFMT_EXECUTABLE) + +mark_as_advanced( + GettextTranslate_MSGCONV_EXECUTABLE + GettextTranslate_MSGFILTER_EXECUTABLE + GettextTranslate_MSGFMT_EXECUTABLE + GettextTranslate_MSGINIT_EXECUTABLE + GettextTranslate_MSGMERGE_EXECUTABLE + GettextTranslate_XGETTEXT_EXECUTABLE +) + +macro(GettextTranslate) + + if(GettextTranslate_GMO_BINARY) + set (GMO_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) + else() + set (GMO_BUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in) + message(FATAL_ERROR "There is no POTFILES.in in + ${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Makevars) + message(FATAL_ERROR "There is no Makevars in ${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/Makevars makevars + REGEX "^[^=]+=(.*)$" + ) + + foreach(makevar ${makevars}) + string(REGEX REPLACE "^([^= ]+) =[ ]?(.*)$" "\\1" MAKEVAR_KEY ${makevar}) + string(REGEX REPLACE "^([^= ]+) =[ ]?(.*)$" "\\2" + MAKEVAR_${MAKEVAR_KEY} ${makevar}) + endforeach() + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in + ${CMAKE_CURRENT_BINARY_DIR}/POTFILES + COPYONLY + ) + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LINGUAS + ${CMAKE_CURRENT_BINARY_DIR}/LINGUAS + COPYONLY + ) + + #set the directory to not clean + #set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + # PROPERTY CLEAN_NO_CUSTOM true) + + file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in potfiles + REGEX "^[^#].*" + ) + + foreach(potfile ${potfiles}) + list(APPEND source_translatable + ${CMAKE_CURRENT_SOURCE_DIR}/${MAKEVAR_top_builddir}/${potfile}) + endforeach() + + set(TEMPLATE_FILE ${MAKEVAR_DOMAIN}.pot) + set(TEMPLATE_FILE_ABS ${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_FILE}) + string(REGEX MATCHALL "[^ ]+" XGETTEXT_OPTS ${MAKEVAR_XGETTEXT_OPTIONS}) + #add_custom_target(${MAKEVAR_DOMAIN}.pot-update DEPENDS + # ${TEMPLATE_FILE_ABS} + #) + + add_custom_target(${MAKEVAR_DOMAIN}.pot-update + COMMAND ${GettextTranslate_XGETTEXT_EXECUTABLE} ${XGETTEXT_OPTS} + -o ${TEMPLATE_FILE_ABS} + --default-domain=${MAKEVAR_DOMAIN} + --add-comments=TRANSLATORS: + --copyright-holder=${MAKEVAR_COPYRIGHT_HOLDER} + --msgid-bugs-address="${MAKEVAR_MSGID_BUGS_ADDRESS}" + --directory=${MAKEVAR_top_builddir} + --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES + --package-version=${VERSION} + --package-name=${CMAKE_PROJECT_NAME} + DEPENDS ${source_translatable} + ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + #add_custom_command(OUTPUT ${TEMPLATE_FILE_ABS} + # COMMAND ${GettextTranslate_XGETTEXT_EXECUTABLE} ${XGETTEXT_OPTS} + # -o ${TEMPLATE_FILE_ABS} + # --default-domain=${MAKEVAR_DOMAIN} + # --add-comments=TRANSLATORS: + # --copyright-holder=${MAKEVAR_COPYRIGHT_HOLDER} + # --msgid-bugs-address="${MAKEVAR_MSGID_BUGS_ADDRESS}" + # --directory=${MAKEVAR_top_builddir} + # --files-from=${CMAKE_CURRENT_BINARY_DIR}/POTFILES + # --package-version=${VERSION} + # --package-name=${CMAKE_PROJECT_NAME} + # DEPENDS ${source_translatable} + # ${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in + # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + #) + + #add_dependencies(update-po ${MAKEVAR_DOMAIN}.pot-update) + + file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/LINGUAS LINGUAS + REGEX "^[^#].*") + string(REGEX MATCHALL "[^ ]+" languages ${LINGUAS}) + + foreach(lang ${languages}) + set(PO_FILE_NAME "${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po") + set(GMO_FILE_NAME "${GMO_BUILD_DIR}/${lang}.gmo") + set(PO_TARGET "generate-${MAKEVAR_DOMAIN}-${lang}-po") + set(GMO_TARGET "generate-${MAKEVAR_DOMAIN}-${lang}-gmo") + list(APPEND po_files ${PO_TARGET}) + list(APPEND gmo_files ${GMO_TARGET}) + + if(${lang} MATCHES "en@(.*)quot") + + add_custom_command(OUTPUT ${lang}.insert-header + COMMAND + sed -e "'/^#/d'" -e 's/HEADER/${lang}.header/g' + ${CMAKE_CURRENT_SOURCE_DIR}/insert-header.sin > ${lang}.insert-header + ) + + #generate the en@quot files + add_custom_target(${PO_TARGET} + COMMAND + ${GettextTranslate_MSGINIT_EXECUTABLE} -i ${TEMPLATE_FILE_ABS} + --no-translator -l ${lang} + -o - 2>/dev/null + | sed -f ${CMAKE_CURRENT_BINARY_DIR}/${lang}.insert-header + | ${GettextTranslate_MSGCONV_EXECUTABLE} -t UTF-8 + | ${GettextTranslate_MSGFILTER_EXECUTABLE} sed -f + ${CMAKE_CURRENT_SOURCE_DIR}/`echo ${lang} + | sed -e 's/.*@//'`.sed 2>/dev/null > + ${PO_FILE_NAME} + DEPENDS ${lang}.insert-header ${TEMPLATE_FILE_ABS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + else() + + add_custom_target(${PO_TARGET} + COMMAND ${GettextTranslate_MSGMERGE_EXECUTABLE} --lang=${lang} + ${PO_FILE_NAME} ${TEMPLATE_FILE_ABS} + -o ${PO_FILE_NAME}.new + COMMAND mv ${PO_FILE_NAME}.new ${PO_FILE_NAME} + DEPENDS ${TEMPLATE_FILE_ABS} + ) + + endif() + + add_custom_target(${GMO_TARGET} + COMMAND ${GettextTranslate_MSGFMT_EXECUTABLE} -c --statistics --verbose + -o ${GMO_FILE_NAME} ${PO_FILE_NAME} + DEPENDS ${PO_TARGET} + ) + + add_dependencies(${PO_TARGET} ${MAKEVAR_DOMAIN}.pot-update) + + install(FILES ${GMO_FILE_NAME} DESTINATION + ${LOCALEDIR}/${lang}/LC_MESSAGES + RENAME ${MAKEVAR_DOMAIN}.mo + ) + + endforeach() + + add_dependencies(update-po ${po_files}) + add_dependencies(update-gmo ${gmo_files}) + +#string(REGEX MATCH "^[^=]+=(.*)$" parsed_variables ${makevars}) + +endmacro() diff --git a/.cmake/Modules/uninstall.cmake b/.cmake/Modules/uninstall.cmake new file mode 100644 index 0000000..e5ed88e --- /dev/null +++ b/.cmake/Modules/uninstall.cmake @@ -0,0 +1,23 @@ +set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") + +if(NOT EXISTS ${MANIFEST}) +message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'") +endif() + +file(STRINGS ${MANIFEST} files) +foreach(file ${files}) +if(EXISTS ${file}) +message(STATUS "Removing file: '${file}'") + +exec_program( +${CMAKE_COMMAND} ARGS "-E remove ${file}" +OUTPUT_VARIABLE stdout +RETURN_VALUE result +) +if(NOT "${result}" STREQUAL 0) +message(FATAL_ERROR "Failed to remove file: '${file}'.") +endif() +else() +MESSAGE(STATUS "File '${file}' does not exist.") +endif() +endforeach(file) diff --git a/.gitignore b/.gitignore index f9e0c45..48d1edb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,11 +14,12 @@ !HEADER !ChangeLog -!Makefile.am -!configure.ac -!autogen.sh +!CMakeLists.txt +!.cmake/* +!src/config.h.in src/config.h +build *~ *.swp diff --git a/.travis.yml b/.travis.yml index 3b19d71..20a0717 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,12 @@ compiler: before_install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get -qq update - - sudo apt-get -qq install -y check gcc-4.9 gettext autopoint + - sudo apt-get -qq install -y check gcc-4.9 gettext cmake - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90 - sudo pip install cpp-coveralls - .ci/install-libcsptr.sh --prefix=/usr script: - - ./autogen.sh && ./configure --enable-gcov CFLAGS="-g -O0" && make && make -C samples check + - mkdir -p build && cd $_ && cmake .. && make && make -C samples test after_success: - coveralls --gcov gcov-4.9 --exclude samples --exclude dependencies --gcov-options '\-lp' -b . after_failure: diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7e2d919 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,100 @@ +cmake_minimum_required(VERSION 3.2.2) +cmake_policy(SET CMP0048 NEW) + +project(Criterion VERSION 1.2.2) + +set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) +set(GettextTranslate_ALL) +set(GettextTranslate_GMO_BINARY) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/.cmake/Modules/") + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -g -std=gnu11") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-no-undefined") + +find_package(Gettext) +if (GETTEXT_FOUND) + include(GettextTranslate) + add_subdirectory(po) + set(ENABLE_NLS 1) +endif () + +include(CheckLibraryExists) +CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) + +find_package(PCRE) +find_package(Libcsptr) + +configure_file( + "${CMAKE_SOURCE_DIR}/src/config.h.in" + "${CMAKE_SOURCE_DIR}/src/config.h" +) + +set(SOURCE_FILES + src/abort.c + src/abort.h + src/event.c + src/event.h + src/report.c + src/report.h + src/runner.c + src/runner.h + src/process.c + src/process.h + src/stats.c + src/stats.h + src/log/logging.c + src/log/tap.c + src/log/normal.c + src/options.c + src/timer.c + src/timer.h + src/i18n.c + src/i18n.h + src/ordered-set.c + src/posix-compat.c + src/extmatch.c + src/extmatch.h + src/main.c +) + +set(INTERFACE_FILES + include/criterion/assert.h + include/criterion/abort.h + include/criterion/common.h + include/criterion/criterion.h + include/criterion/event.h + include/criterion/hooks.h + include/criterion/logging.h + include/criterion/types.h + include/criterion/options.h + include/criterion/ordered-set.h + include/criterion/stats.h +) + +enable_testing() + +add_subdirectory(samples) + +include_directories(include src) +add_library(criterion SHARED ${SOURCE_FILES} ${INTERFACE_FILES}) + +link_directories(/usr/lib) + +target_link_libraries(criterion csptr) + +if (HAVE_CLOCK_GETTIME) + target_link_libraries(criterion rt) +endif() + +if (PCRE_FOUND) + target_link_libraries(criterion pcre) +endif() + +install(FILES ${INTERFACE_FILES} DESTINATION include/criterion) +install(TARGETS criterion + LIBRARY DESTINATION lib +) + +add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake" +) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 02b5f23..0000000 --- a/Makefile.am +++ /dev/null @@ -1,75 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 -AM_CPPFLAGS = -DLOCALEDIR='"$(localedir)"' -SUBDIRS = po samples - -lib_LTLIBRARIES = libcriterion.la - -WARNINGS = -Wall -Wextra \ - -Wno-unused-result - -libcriterion_la_CFLAGS = \ - $(WARNINGS) \ - -std=gnu11 \ - -I$(top_srcdir)/src/ \ - -I$(top_srcdir)/include/ \ - $(COVERAGE_CFLAGS) - -libcriterion_la_LDFLAGS = $(COVERAGE_LDFLAGS) -no-undefined -version-info 1:0:0 -libcriterion_la_LIBADD = -lpcre - -EXTRA_DIST = config.rpath LICENSE - -subdirincludedir = $(includedir)/criterion/ -subdirinclude_HEADERS = \ - include/criterion/assert.h \ - include/criterion/abort.h \ - include/criterion/common.h \ - include/criterion/criterion.h \ - include/criterion/event.h \ - include/criterion/hooks.h \ - include/criterion/logging.h \ - include/criterion/types.h \ - include/criterion/options.h \ - include/criterion/ordered-set.h \ - include/criterion/stats.h - -libcriterion_la_SOURCES = \ - src/abort.c \ - src/abort.h \ - src/event.c \ - src/event.h \ - src/report.c \ - src/report.h \ - src/runner.c \ - src/runner.h \ - src/process.c \ - src/process.h \ - src/stats.c \ - src/stats.h \ - src/log/logging.c \ - src/log/tap.c \ - src/log/normal.c \ - src/options.c \ - src/timer.c \ - src/timer.h \ - src/i18n.c \ - src/i18n.h \ - src/ordered-set.c \ - src/posix-compat.c \ - src/extmatch.c \ - src/extmatch.h \ - src/main.c - -TARGET = $(PACKAGE)-$(VERSION) - -package: all - rm -Rf $(TARGET) - mkdir -p $(TARGET) - cp -Rf .libs $(TARGET)/lib/ - rm -f $(TARGET)/lib/libcriterion.la - cp -f libcriterion.la $(TARGET)/lib - cp -Rf include $(TARGET) - tar -cvjf $(TARGET).tar.bz2 $(TARGET) - -clean-local: - rm -Rf $(TARGET) $(TARGET).tar.bz2 diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 886e91f..0000000 --- a/autogen.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -git submodule update --init --recursive -autopoint -autoreconf -i diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 4d9b7a0..0000000 --- a/configure.ac +++ /dev/null @@ -1,50 +0,0 @@ -AC_PREREQ([2.60]) - -AC_INIT([criterion], [1.2.1], [], [criterion], [franklinmathieu@gmail.com]) -AC_CONFIG_SRCDIR([src/runner.c]) - -LT_PREREQ([2.2.4]) -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip foreign subdir-objects parallel-tests color-tests]) -LT_INIT([disable-static]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_PROG_CC -AM_PROG_CC_C_O - -AC_PROG_LIBTOOL -AC_PROG_INSTALL -AC_PROG_LN_S - -AC_PROG_MAKE_SET -AC_SUBST([LIBTOOL_DEPS]) - -AC_CHECK_LIB([csptr], [smalloc], [], [AC_MSG_ERROR([Could not find libcsptr dependency. \ - Please go to https://github.com/Snaipe/c-smart-pointers.git \ - and follow the installation instructions.])]) - -enable_rt_tests="no" -AC_CHECK_LIB([rt], [clock_gettime], [enable_rt_tests="yes"]) - -AM_CONDITIONAL([ENABLE_RT_TESTS], [test "x$enable_rt_tests" != "xno"]) - -AC_CHECK_LIB([pcre], [pcre_compile], [AC_DEFINE([HAVE_PCRE], [1], [Define to 1 if you have the `pcre` library (-lpcre)])]) - -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION([0.18]) - -AC_ARG_ENABLE([gcov], - [AS_HELP_STRING([--enable-gcov], - [Compile the project with converage enabled])], - [COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" - COVERAGE_LDFLAGS="-lgcov" - AC_SUBST([COVERAGE_CFLAGS]) - AC_SUBST([COVERAGE_LDFLAGS]) - ], - []) - -AC_CONFIG_HEADERS([src/config.h]) -AC_CONFIG_FILES([Makefile samples/Makefile po/Makefile.in]) - -AC_OUTPUT diff --git a/m4/.keep b/m4/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..892654a --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +GettextTranslate() diff --git a/po/Makevars b/po/Makevars index 70daf30..036417c 100644 --- a/po/Makevars +++ b/po/Makevars @@ -1,7 +1,7 @@ # Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) +DOMAIN = Criterion # These two variables depend on the location of this directory. subdir = po diff --git a/po/fr.po b/po/fr.po index f9627f7..7727e40 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: criterion 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-30 12:07+0200\n" +"POT-Creation-Date: 2015-07-28 22:17+0200\n" "PO-Revision-Date: 2015-04-03 17:58+0200\n" "Last-Translator: \n" "Language-Team: French\n" diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt new file mode 100644 index 0000000..42aee2d --- /dev/null +++ b/samples/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.1) +project(criterion_samples) + +set(CMAKE_C_FLAGS "-std=c99 -Wall -Wextra -pedantic") + +include_directories(../include) + +set(SAMPLES + signal + report + suites + fixtures + asserts + more-suites + long-messages + description + other-crashes + simple +) + +set(SCRIPTS + tap_test + early_exit + verbose + list + pattern + fail_fast + help +) + +foreach(sample ${SAMPLES}) + add_executable(${sample} ${sample}.c) + target_link_libraries(${sample} criterion) + add_test(${sample} ${sample}) + set_property(TEST ${sample} PROPERTY + ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1" + ) +endforeach() + +foreach(script ${SCRIPTS}) + add_test(${script} ${CMAKE_CURRENT_LIST_DIR}/tests/${script}.sh) +endforeach() diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..194430a --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,10 @@ +#ifndef CONFIG_H_IN_ +# define CONFIG_H_IN_ + +#cmakedefine ENABLE_NLS @ENABLE_NLS@ + +# define LOCALEDIR "${LOCALEDIR}" +# define PACKAGE "${PROJECT_NAME}" +# define VERSION "${PROJECT_VERSION}" + +#endif /* !CONFIG_H_IN_ */