-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
126 lines (98 loc) · 4.35 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#****************************************************************************#
# Copyright (C) 2016 Florent Hivert <[email protected]>, #
# #
# Distributed under the terms of the GNU General Public License (GPL) #
# #
# This code is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# General Public License for more details. #
# #
# The full text of the GPL is available at: #
# #
# http://www.gnu.org/licenses/ #
#****************************************************************************#
cmake_minimum_required(VERSION 2.8)
#####################
# Project description
project(HPCombi)
set(DESCRIPTION "High Performance Combinatorics in C++ using vector instructions"
CACHE STRING "Project description.")
set(VERSION_MAJOR 0 CACHE STRING "Project major version number.")
set(VERSION_MINOR 0 CACHE STRING "Project minor version number.")
set(VERSION_PATCH 3 CACHE STRING "Project patch version number.")
mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH)
message(STATUS "**** Build type = ${CMAKE_BUILD_TYPE}")
# set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_BUILD_TYPE Debug)
# set(CMAKE_VERBOSE_MAKEFILE 1)
################################
# General compiler configuration
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF) # -std=c++11 instead of -std=gnu++11
add_definitions(-DHPCOMBI_HAVE_CONFIG)
message(STATUS "*** Compiler id is ${CMAKE_CXX_COMPILER_ID}")
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
# Workaround of CMAKE bug https://stackoverflow.com/questions/47213356/
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
add_compile_options( -std=c++11 -Wall -g -pg)
endif ( )
###################
# Project Structure
# add_subdirectory(src)
add_subdirectory(examples)
add_subdirectory(benchmark)
add_subdirectory(doc)
include_directories(
${CMAKE_SOURCE_DIR}/include
${PROJECT_BINARY_DIR})
#########
# Testing
IF (BUILD_TESTING)
include(CTest)
enable_testing ()
add_subdirectory(tests)
ENDIF(BUILD_TESTING)
#####################
# config.h file stuff
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/HPCombi-config.h)
configure_file(${CMAKE_SOURCE_DIR}/VERSION.in ${CMAKE_BINARY_DIR}/VERSION)
set(AUTOGENERATED_WARNING "WARNING: THIS IS A CMAKE AUTO-GENERATED FILE.")
####################
# Installation
set(install_misc README.md LICENSE list_intrin.txt)
foreach(f ${install_misc})
install (FILES ${CMAKE_SOURCE_DIR}/${f}
DESTINATION share/${CMAKE_PROJECT_NAME})
endforeach(f)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION DESTINATION ".")
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/HPCombi-config.h
DESTINATION include/${CMAKE_PROJECT_NAME})
install (
DIRECTORY ${CMAKE_SOURCE_DIR}/include/
DESTINATION include/${CMAKE_PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp")
###################
# pkgconfig stuff
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hpcombi.pc.in
# ${CMAKE_CURRENT_BINARY_DIR}/hpcombi.pc @ONLY)
#################
# Packing stuff
#
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${DESCRIPTION}")
set(CPACK_PACKAGE_VENDOR "Florent Hivert <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
set(CPACK_GENERATOR "TGZ")
SET(CPACK_PACKAGE_FILE_NAME
"HPCombi-${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
include(CPack)
########################
# Custom target for TAGS
if (UNIX)
add_custom_target(tags etags --members --declarations `find ${CMAKE_SOURCE_DIR}/ -name *.cpp -or -name *.hpp -or -name *.c -or -name *.h` -o ${CMAKE_SOURCE_DIR}/TAGS)
add_custom_target(etags DEPENDS tags)
endif (UNIX)