Switched build system to cmake
This commit is contained in:
parent
dd5e4eea23
commit
e48bd7c037
10 changed files with 492 additions and 132 deletions
285
.cmake/Modules/FindGettext.cmake
Normal file
285
.cmake/Modules/FindGettext.cmake
Normal file
|
@ -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()
|
31
.cmake/Modules/FindLibcsptr.cmake
Normal file
31
.cmake/Modules/FindLibcsptr.cmake
Normal file
|
@ -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)
|
37
.cmake/Modules/FindPCRE.cmake
Normal file
37
.cmake/Modules/FindPCRE.cmake
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Copyright (C) 2007-2009 LuaDist.
|
||||
# Created by Peter Kapec <kapecp@gmail.com>
|
||||
# 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)
|
23
.cmake/Modules/uninstall.cmake
Normal file
23
.cmake/Modules/uninstall.cmake
Normal file
|
@ -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)
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -14,9 +14,8 @@
|
|||
!HEADER
|
||||
!ChangeLog
|
||||
|
||||
!Makefile.am
|
||||
!configure.ac
|
||||
!autogen.sh
|
||||
!CMakeLists.txt
|
||||
!.cmake/*
|
||||
|
||||
src/config.h
|
||||
|
||||
|
|
90
CMakeLists.txt
Normal file
90
CMakeLists.txt
Normal file
|
@ -0,0 +1,90 @@
|
|||
cmake_minimum_required(VERSION 3.2.2)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
|
||||
project(Criterion VERSION 1.2.2)
|
||||
|
||||
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")
|
||||
|
||||
include(CheckLibraryExists)
|
||||
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
||||
|
||||
find_package(PCRE)
|
||||
find_package(Gettext REQUIRED)
|
||||
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
|
||||
)
|
||||
|
||||
add_subdirectory(samples)
|
||||
#add_subdirectory(po)
|
||||
|
||||
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/insight)
|
||||
install(TARGETS criterion
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake"
|
||||
)
|
75
Makefile.am
75
Makefile.am
|
@ -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
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
git submodule update --init --recursive
|
||||
autopoint
|
||||
autoreconf -i
|
50
configure.ac
50
configure.ac
|
@ -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
|
24
samples/CMakeLists.txt
Normal file
24
samples/CMakeLists.txt
Normal file
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
)
|
||||
|
||||
foreach(sample ${SAMPLES})
|
||||
add_executable(${sample} ${sample}.c)
|
||||
target_link_libraries(${sample} criterion)
|
||||
endforeach()
|
Loading…
Add table
Reference in a new issue