2016-01-18 14:16:13 +01:00
|
|
|
# Copyright (C) 2015-2016 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.
|
2015-07-28 19:03:46 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
cmake_minimum_required (VERSION 2.8)
|
2015-07-28 22:44:28 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
project (Criterion C)
|
2015-07-30 13:09:18 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
set (MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.cmake/Modules")
|
|
|
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MODULE_DIR})
|
2015-11-27 15:53:10 +01:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
if (POLICY CMP0054)
|
|
|
|
# http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html
|
|
|
|
# This is here to allow conditions to be passed as function parameters
|
|
|
|
cmake_policy (SET CMP0054 OLD)
|
2015-09-06 07:23:21 -07:00
|
|
|
endif ()
|
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
# Initialization
|
2015-09-04 02:47:06 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
include (Options)
|
|
|
|
include (Properties)
|
|
|
|
include (Submodules)
|
|
|
|
include (Capabilities)
|
|
|
|
include (Subprojects)
|
|
|
|
include (PackageUtils)
|
|
|
|
|
|
|
|
cr_add_subproject (csptr PATH dependencies/libcsptr CMAKE)
|
|
|
|
cr_add_subproject (dyncall_s PATH dependencies/dyncall CMAKE IF THEORIES)
|
|
|
|
|
|
|
|
cr_add_subproject (nanomsg
|
|
|
|
PATH dependencies/nanomsg-patched
|
|
|
|
OPTS "-DNN_TESTS=OFF"
|
2016-01-18 21:55:22 +01:00
|
|
|
GENERATOR "Visual Studio 14 2015"
|
2016-01-18 14:16:13 +01:00
|
|
|
CMAKE
|
2016-01-18 17:23:31 +01:00
|
|
|
IF WIN32 AND NOT CYGWIN
|
2016-01-18 14:16:13 +01:00
|
|
|
)
|
|
|
|
cr_add_subproject (nanomsg
|
|
|
|
PATH dependencies/nanomsg-patched
|
|
|
|
AUTOTOOLS
|
|
|
|
PARALLELIZE
|
2016-01-18 17:23:31 +01:00
|
|
|
IF NOT WIN32 OR CYGWIN
|
2015-10-10 03:12:32 +02:00
|
|
|
)
|
2015-09-04 02:47:06 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
cr_add_subproject (wingetopt PATH dependencies/wingetopt CMAKE IF MSVC)
|
2015-12-09 17:11:11 +01:00
|
|
|
|
2015-09-04 02:47:06 +02:00
|
|
|
include_directories(
|
2015-09-26 00:22:21 +02:00
|
|
|
dependencies/valgrind/include/
|
2015-10-11 13:21:23 +01:00
|
|
|
dependencies/klib/
|
2015-12-09 17:11:11 +01:00
|
|
|
dependencies/nanopb/
|
2015-09-04 02:47:06 +02:00
|
|
|
)
|
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
# Coverage
|
2015-07-30 13:09:18 +02:00
|
|
|
|
|
|
|
if (COVERALLS)
|
|
|
|
include(Coveralls)
|
|
|
|
coveralls_turn_on_coverage()
|
|
|
|
endif()
|
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
# I18N
|
2015-11-27 15:53:10 +01:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
if (I18N AND GETTEXT_FOUND AND LIBINTL_LIB_FOUND)
|
|
|
|
include(GettextTranslate)
|
|
|
|
add_subdirectory(po)
|
2015-07-31 07:44:32 +02:00
|
|
|
endif ()
|
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
# Project
|
2015-07-31 12:01:02 +02:00
|
|
|
|
2015-09-04 02:47:06 +02:00
|
|
|
include_directories(include src)
|
2016-01-18 14:16:13 +01:00
|
|
|
add_subdirectory (src)
|
|
|
|
|
|
|
|
cr_add_library(criterion SHARED
|
|
|
|
SOURCES ${SOURCE_FILES}
|
|
|
|
HEADERS ${INTERFACE_FILES}
|
|
|
|
COMPONENT dev
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_SOVERSION}
|
2015-12-29 13:07:37 -08:00
|
|
|
)
|
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
cr_link_subproject(criterion csptr STATIC)
|
|
|
|
cr_link_subproject(criterion nanomsg STATIC)
|
|
|
|
cr_link_subproject(criterion dyncall_s STATIC)
|
|
|
|
cr_link_subproject(criterion wingetopt STATIC)
|
2015-11-27 15:53:10 +01:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
cr_link_libraries(criterion pthread IF NOT WIN32)
|
|
|
|
cr_link_libraries(criterion anl IF NOT WIN32 AND NOT APPLE)
|
|
|
|
cr_link_libraries(criterion rt IF HAVE_CLOCK_GETTIME)
|
2016-01-15 13:17:09 +01:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
cr_link_package(criterion PCRE)
|
|
|
|
cr_link_package(criterion LIBINTL)
|
2015-07-31 08:02:09 +02:00
|
|
|
|
2015-07-30 13:09:18 +02:00
|
|
|
if (COVERALLS)
|
|
|
|
coveralls_setup("${SOURCE_FILES}" ${COVERALLS_UPLOAD})
|
2015-09-09 19:19:58 +02:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
add_custom_target(gcov
|
2015-09-04 05:11:06 +02:00
|
|
|
"${CMAKE_COMMAND}"
|
|
|
|
-DSOURCE_FILES="${SOURCE_FILES}"
|
|
|
|
-DCOV_PATH="${CMAKE_CURRENT_BINARY_DIR}"
|
|
|
|
-P "${CMAKE_MODULE_PATH}/Gcov.cmake"
|
2016-01-18 14:16:13 +01:00
|
|
|
)
|
|
|
|
endif()
|
2015-09-04 04:52:44 +02:00
|
|
|
|
2015-09-22 00:16:45 +02:00
|
|
|
if (CTESTS)
|
2016-01-18 14:16:13 +01:00
|
|
|
enable_testing()
|
|
|
|
add_custom_target(criterion_tests)
|
|
|
|
add_subdirectory(samples)
|
|
|
|
add_subdirectory(test)
|
2015-09-21 23:26:47 +02:00
|
|
|
endif ()
|
2015-11-28 14:26:08 +01:00
|
|
|
|
2016-01-18 14:16:13 +01:00
|
|
|
if (UPLOAD_DEB)
|
|
|
|
include (DebUpload)
|
2015-11-28 14:26:08 +01:00
|
|
|
endif ()
|