forked from objectcomputing/mFAST
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flags to build tests, examples and packages
- Loading branch information
Vladimir Karnushin
committed
Dec 26, 2016
1 parent
94f42de
commit 353e7c9
Showing
1 changed file
with
41 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,16 @@ | |
cmake_minimum_required(VERSION 2.8.11) | ||
project (mFAST CXX) | ||
|
||
# options to build tests, examples and packages | ||
option(BUILD_TESTS "Build tests" ON) | ||
option(BUILD_EXAMPLES "Build examples" ON) | ||
option(BUILD_PACKAGES "Build packages" ON) | ||
|
||
# debug build by default | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE) | ||
endif(NOT CMAKE_BUILD_TYPE) | ||
|
||
if(POLICY CMP0054) | ||
cmake_policy(SET CMP0054 OLD) | ||
endif() | ||
|
@@ -17,10 +27,6 @@ set(MFAST_PATCH_VERSION 0) | |
set(MFAST_VERSION ${MFAST_MAJOR_VERSION}.${MFAST_MINOR_VERSION}.${MFAST_PATCH_VERSION}) | ||
set(MFAST_SOVERSION ${MFAST_MAJOR_VERSION}.${MFAST_MINOR_VERSION}) | ||
|
||
set(CPACK_PACKAGE_VERSION ${MFAST_VERSION}) | ||
set(CPACK_PACKAGE_NAME "mfast") | ||
|
||
include(CPack) | ||
include(SetInstallPaths) | ||
include(Emscripten) | ||
include(SetCXXStandard) | ||
|
@@ -30,6 +36,30 @@ include(SetupCoverage) | |
# flag to enable building shared/dynamic library | ||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "build shared/dynamic library") | ||
|
||
if(BUILD_PACKAGES) | ||
# Build deb package by default | ||
if(NOT CPACK_GENERATOR) | ||
set(CPACK_GENERATOR "DEB" CACHE STRING "List of generators.") | ||
endif(NOT CPACK_GENERATOR) | ||
|
||
if(CUSTOM_INSTALL_PREFIX) | ||
set(CMAKE_INSTALL_PREFIX ${CUSTOM_INSTALL_PREFIX} CACHE STRING "Custom installation prefix.") | ||
set(CPACK_SET_DESTDIR true) | ||
set(CPACK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||
endif(CUSTOM_INSTALL_PREFIX) | ||
|
||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A FAST (FIX Adapted for STreaming) encoder/decoder") | ||
set(CPACK_PACKAGE_NAME "mfast") | ||
set(CPACK_PACKAGE_VERSION ${MFAST_VERSION}) | ||
set(CPACK_PACKAGE_VENDOR "Object Computing, Inc.") | ||
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Huang-Ming Huang") | ||
set(CPACK_DEBIAN_PACKAGE_SECTION "devel") | ||
|
||
include(CPack) | ||
|
||
endif(BUILD_PACKAGES) | ||
|
||
find_package(Boost 1.56.0 REQUIRED) | ||
include_directories(${Boost_INCLUDE_DIR}) | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2) | ||
|
@@ -48,33 +78,31 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | |
add_subdirectory (src) | ||
include(FastTypeGenTarget) | ||
|
||
enable_testing() | ||
add_subdirectory (tests) | ||
if(BUILD_TESTS) | ||
enable_testing() | ||
add_subdirectory (tests) | ||
endif(BUILD_TESTS) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
set(MFAST_LIBRARIES "${MFAST_SHARED_LIBRARIES}") | ||
else (BUILD_SHARED_LIBS) | ||
set(MFAST_LIBRARIES "${MFAST_STATIC_LIBRARIES}") | ||
endif (BUILD_SHARED_LIBS) | ||
|
||
add_subdirectory (examples) | ||
|
||
if(BUILD_EXAMPLES) | ||
add_subdirectory (examples) | ||
endif(BUILD_EXAMPLES) | ||
|
||
# Setting up dist target | ||
# =============================== | ||
|
||
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${MFAST_VERSION}) | ||
add_custom_target(dist | ||
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | ||
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) | ||
|
||
|
||
include(GenProjectConfig) | ||
|
||
file(GLOB schema_files "${CMAKE_CURRENT_SOURCE_DIR}/schema/*.*") | ||
install(FILES | ||
${schema_files} | ||
DESTINATION ${INSTALL_DATA_DIR}/mfast) | ||
|
||
|