-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
365 lines (320 loc) · 14.7 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
PROJECT(hpm VERSION 0.9.1 LANGUAGES C)
# build shared/dynamic library option
OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
OPTION(HPM_BUILD_TEST "Build Test Suite" OFF)
IF(NOT BUILD_SHARED_LIBS)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
SET(LINK_SEARCH_START_STATIC TRUE)
ENDIF()
#TODO rename to BUILD_WITH_SINGLE_LIBRARY
OPTION(BUILD_WITH_SINGLE_LIBRARY "Build a single library binary file" ON)
OPTION(BUILD_WITH_INSTALL "Add Install Targets" ON)
OPTION(BUILD_WITH_DOCS "Generate Docs" OFF)
OPTION(BUILD_WTIH_DISTRIBUTION "Generate distribution" OFF)
OPTION(HPM_OPT_BUILD_PACKAGES "Build Package" OFF)
# hpm version setup.
SET(HPM_VERSION_MAJOR 0)
SET(HPM_VERSION_MINOR 9)
SET(HPM_VERSION_REVISION 0)
SET(HPM_VERSION_STATE rc)
SET(HPM_VERSION ${HPM_VERSION_MAJOR}.${HPM_VERSION_MINOR}${HPM_VERSION_STATE}${HPM_VERSION_REVISION} )
# Set version preprocessor macros.
MESSAGE(STATUS "Version ${HPM_VERSION}")
# Check if compile single library.
IF(BUILD_WITH_SINGLE_LIBRARY)
MESSAGE(STATUS "Single Library Mode.")
ADD_COMPILE_DEFINITIONS(HPM_USE_SINGLE_LIBRARY=1)
ELSE()
MESSAGE(STATUS "Individual SIMD Libraries Mode.")
ENDIF()
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
SET(LIBHPM_COMPONENT "libhpm${HPM_VERSION_MAJOR}.${HPM_VERSION_MINOR}.${HPM_VERSION_REVISION}" )
SET(LIBHPM-DEV_COMPONENT "libhpm${HPM_VERSION_MAJOR}.${HPM_VERSION_MINOR}.${HPM_VERSION_REVISION}-dev" )
SET(CPACK_COMPONENTS_ALL ${LIBHPM_COMPONENT} ${LIBHPM-DEV_COMPONENT} hpm-dev)
# GCC compiler options.
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
ADD_DEFINITIONS(-fPIC)
# Compiling language standard.
ADD_DEFINITIONS(-std=c11)
ADD_DEFINITIONS(-w -Werror -rdynamic)
# Check build target.
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
MESSAGE(STATUS "Compile for release.")
ADD_DEFINITIONS(-DNDEBUG -O2)
SET(CMAKE_RELEASE TRUE)
SET(SIMD_FLAGS "-ftree-vectorize -ftree-slp-vectorize -ftree-vectorizer-verbose=10 -fopt-info-vec-optimized -DHPM_INTERNAL_IMP")
ELSEIF( CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(STATUS "Compile for debug.")
ADD_DEFINITIONS(-D_DEBUG)
ADD_DEFINITIONS(-g3 -O0)
SET(CMAKE_DEBUG TRUE)
SET(SIMD_FLAGS "-ftree-vectorize -ftree-slp-vectorize -ftree-vectorizer-verbose=10 -fopt-info-vec-optimized -DHPM_INTERNAL_IMP")
ENDIF()
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
# Compiling language standard.
ADD_DEFINITIONS(-w -fPIC -rdynamic)
ADD_DEFINITIONS(-std=c11)
# Check build target.
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
MESSAGE(STATUS "Compile for release.")
ADD_DEFINITIONS(-DNDEBUG -O2)
SET(CMAKE_RELEASE TRUE)
SET(SIMD_FLAGS "-loop-vectorize")
ELSEIF( CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(STATUS "Compile for debug.")
ADD_DEFINITIONS(-D_DEBUG)
ADD_DEFINITIONS(-g3 -O0)
SET(CMAKE_DEBUG TRUE)
SET(SIMD_FLAGS "-loop-vectorize")
ENDIF()
#
SET(SIMD_FLAGS "${SIMD_FLAGS}")
ELSEIF(MSVC)
# Enable multi-core complication with MSVC
ADD_DEFINITIONS(/MP)
ADD_DEFINITIONS(/DHPM_INTERNAL_IMP=1)
# Check build target.
IF (CMAKE_BUILD_TYPE STREQUAL "Release")
MESSAGE(STATUS "Compile for release.")
ADD_DEFINITIONS(/DNDEBUG /O2)
SET(CMAKE_RELEASE TRUE)
ELSEIF( CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(STATUS "Compile for debug.")
ADD_DEFINITIONS(/D_DEBUG)
ADD_DEFINITIONS(/Od)
SET(CMAKE_DEBUG TRUE)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "No supported compiler")
ENDIF()
# Source files.
FILE (GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
FILE (GLOB basecore ${CMAKE_CURRENT_SOURCE_DIR}/src/base/*
${CMAKE_CURRENT_SOURCE_DIR}/src/utility.c)
FILE (GLOB nosimdsource ${CMAKE_CURRENT_SOURCE_DIR}/src/nosimd/* )
FILE (GLOB all_sse_source ${CMAKE_CURRENT_SOURCE_DIR}/src/sse/*)
FILE (GLOB avx_source ${CMAKE_CURRENT_SOURCE_DIR}/src/avx/*)
FILE (GLOB neon_source ${CMAKE_CURRENT_SOURCE_DIR}/src/neon/*)
# Set specific target compile flag options.
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
SET(HPM_FLAGS "-DHPM_INTERNAL=1 -DHPM_ENTRY=1")
SET(SIMD_TARGET_FLAGS " -DHPM_INTERNAL_IMP=1")
SET(SIMD_FLAGS_NO "-mno-abm -DHPM_SIMD_PREFIX=1" )
SET(SIMD_FLAGS_SSE "-msse -DHPM_SSE_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE2 "-msse2 -DHPM_SSE2_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE3 "-msse3 -DHPM_SSE3_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE41 "-msse4.1 -DHPM_SSE41_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE42 "-msse4.2 -DHPM_SSE42_SIMD_PREFIX=1")
SET(SIMD_FLAGS_AVX "-mavx -DHPM_AVX_SIMD_PREFIX=1 ")
SET(SIMD_FLAGS_AVX2 "-mavx2 -DHPM_AVX2_SIMD_PREFIX=1 ")
SET(SIMD_FLAGS_NEON "-mfpu=neon -DHPM_NEON_SIMD_PREFIX=1 -DHPM_ARM_NEON=1")
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
SET(HPM_FLAGS "/DHPM_INTERNAL=1 /DHPM_ENTRY=1")
SET(SIMD_TARGET_FLAGS "/DHPM_INTERNAL_IMP=1")
SET(SIMD_FLAGS_NO " /DHPM_SIMD_PREFIX=1" )
SET(SIMD_FLAGS_SSE "/arch:SSE /DHPM_SSE_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE2 "/arch:SSE2 /DHPM_SSE2_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE3 "/arch:SSE3 /DHPM_SSE3_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE41 "/arch:SSE4.1 /DHPM_SSE41_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE42 "/arch:SSE4.2 /DHPM_SSE42_SIMD_PREFIX=1")
SET(SIMD_FLAGS_AVX "/arch:AVX /DHPM_AVX_SIMD_PREFIX=1")
SET(SIMD_FLAGS_AVX2 "/arch:AVX2 /DHPM_AVX2_SIMD_PREFIX=1 ")
SET(SIMD_FLAGS_NEON "/DHPM_NEON_SIMD_PREFIX=1 ") # TODO add -mfpu=neon
ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
SET(HPM_FLAGS "-DHPM_INTERNAL=1 -DHPM_ENTRY=1")
SET(SIMD_TARGET_FLAGS " -DHPM_INTERNAL_IMP=1")
SET(SIMD_FLAGS_NO " -DHPM_SIMD_PREFIX=1" )
SET(SIMD_FLAGS_SSE "-msse -DHPM_SSE_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE2 "-msse2 -DHPM_SSE2_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE3 "-msse3 -DHPM_SSE3_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE41 "-msse4.1 -DHPM_SSE41_SIMD_PREFIX=1")
SET(SIMD_FLAGS_SSE42 "-msse4.2 -DHPM_SSE42_SIMD_PREFIX=1")
SET(SIMD_FLAGS_AVX "-mavx -DHPM_AVX_SIMD_PREFIX=1")
SET(SIMD_FLAGS_AVX2 "-mavx2 -DHPM_AVX2_SIMD_PREFIX=1")
SET(SIMD_FLAGS_NEON "-mfpu=neon -DHPM_NEON_SIMD_PREFIX=1 -DHPM_ARM_NEON=1")
ELSE()
MESSAGE(FATAL_ERROR "No supported Compiler")
ENDIF()
IF(BUILD_WITH_SINGLE_LIBRARY)
SET(TARGET_LIB_EXPORT OBJECT)
ELSE()
IF(BUILD_SHARED_LIBS)
SET(TARGET_LIB_EXPORT SHARED)
ELSE()
SET(TARGET_LIB_EXPORT STATIC)
ENDIF()
ENDIF()
# X86 and amd64 CPU architecture.
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
# Target for AVX2
ADD_LIBRARY(hpmavx2 ${TARGET_LIB_EXPORT} ${avx_source} ${basecore})
SET_TARGET_PROPERTIES(hpmavx2 PROPERTIES COMPILE_FLAGS "${SIMD_FLAGS} ${SIMD_FLAGS_AVX2} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmavx2 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmavx2 m)
# Target for AVX
ADD_LIBRARY(hpmavx ${TARGET_LIB_EXPORT} ${avx_source} ${basecore})
SET_TARGET_PROPERTIES(hpmavx PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS} ${SIMD_FLAGS_AVX} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmavx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmavx m)
# Target for SSE
ADD_LIBRARY(hpmsse ${TARGET_LIB_EXPORT} ${basecore} ${all_sse_source})
SET_TARGET_PROPERTIES(hpmsse PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS} ${SIMD_FLAGS_SSE} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmsse PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmsse m)
# Target for SSE2
ADD_LIBRARY(hpmsse2 ${TARGET_LIB_EXPORT} ${basecore} ${all_sse_source})
SET_TARGET_PROPERTIES(hpmsse2 PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS} ${SIMD_FLAGS_SSE2} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmsse2 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmsse2 m)
# Target for SSE3
ADD_LIBRARY(hpmsse3 ${TARGET_LIB_EXPORT} ${basecore} ${all_sse_source})
SET_TARGET_PROPERTIES(hpmsse3 PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS} ${SIMD_FLAGS_SSE3} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmsse3 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmsse3 m)
# Target for SSE4.1
ADD_LIBRARY(hpmsse41 ${TARGET_LIB_EXPORT} ${basecore} ${all_sse_source})
SET_TARGET_PROPERTIES(hpmsse41 PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS} ${SIMD_FLAGS_SSE41} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmsse41 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmsse41 m)
# Target for SSE4.2
ADD_LIBRARY(hpmsse42 ${TARGET_LIB_EXPORT} ${basecore} ${all_sse_source})
SET_TARGET_PROPERTIES(hpmsse42 PROPERTIES COMPILE_FLAGS "${SIMD_FLAGS} ${SIMD_FLAGS_SSE42} ${SIMD_TARGET_FLAGS}")
TARGET_INCLUDE_DIRECTORIES(hpmsse42 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmsse42 m)
ENDIF()
# Check for NEON support.
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "(arm)|(arm64)")
# Target for NEON
# SIMD extension support.
ADD_LIBRARY(hpmneon ${TARGET_LIB_EXPORT} ${basecore} ${neon_source}) # Will resolve the NEON specific implementation later.
SET_TARGET_PROPERTIES(hpmneon PROPERTIES COMPILE_FLAGS " ${SIMD_FLAGS_NEON} ${SIMD_TARGET_FLAGS}" ) #-funsafe-math-optimizations
ENDIF()
# Target with no SIMD extension requirements.
ADD_LIBRARY(hpmnosimd ${TARGET_LIB_EXPORT} ${basecore} ${nosimdsource})
SET_TARGET_PROPERTIES(hpmnosimd PROPERTIES COMPILE_FLAGS "${NOSIMD_FLAGS} ${SIMD_FLAGS_NO} ${SIMD_TARGET_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES(hpmnosimd PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> )
TARGET_LINK_LIBRARIES(hpmnosimd m)
# Main library target for initializing the library. The Hpm library is always a shared library.
IF(BUILD_WITH_SINGLE_LIBRARY)
ADD_LIBRARY(hpm SHARED ${CMAKE_CURRENT_SOURCE_DIR}/src/hpm.c $<TARGET_OBJECTS:hpmnosimd>
$<TARGET_OBJECTS:hpmsse42> $<TARGET_OBJECTS:hpmsse41> $<TARGET_OBJECTS:hpmsse> $<TARGET_OBJECTS:hpmsse2> $<TARGET_OBJECTS:hpmsse3>
$<TARGET_OBJECTS:hpmavx> $<TARGET_OBJECTS:hpmavx2>)
TARGET_LINK_LIBRARIES(hpm m dl)
ELSE()
TARGET_LINK_LIBRARIES(hpm m dl)
ENDIF()
TARGET_COMPILE_DEFINITIONS(hpm PRIVATE HPM_MAJOR_VERSION=${HPM_VERSION_MAJOR})
TARGET_COMPILE_DEFINITIONS(hpm PRIVATE HPM_MINOR_VERSION=${HPM_VERSION_MINOR})
TARGET_COMPILE_DEFINITIONS(hpm PRIVATE HPM_REVISION_VERSION=${HPM_VERSION_REVISION})
TARGET_COMPILE_DEFINITIONS(hpm PRIVATE HPM_STATE_VERSION=${HPM_VERSION_STATE})
TARGET_COMPILE_DEFINITIONS(hpm PRIVATE HPM_STR_VERSION="${HPM_VERSION}")
# Set common hpm properties
SET_TARGET_PROPERTIES(hpm PROPERTIES COMPILE_FLAGS " ${HPM_FLAGS}" )
TARGET_INCLUDE_DIRECTORIES (hpm PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
IF(BUILD_WITH_INSTALL)
# Non specific SIMD targets.
INSTALL (FILES ${headers} DESTINATION include/hpm)
# Add the install targets
INSTALL (TARGETS hpm DESTINATION lib)
IF(NOT BUILD_WITH_SINGLE_LIBRARY)
# Install each individual SIMD library extensions.
INSTALL (TARGETS hpmnosimd DESTINATION lib)
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
#INSTALL (TARGETS hpmavx512 DESTINATION lib)
INSTALL (TARGETS hpmavx2 DESTINATION lib)
INSTALL (TARGETS hpmavx DESTINATION lib)
INSTALL (TARGETS hpmsse DESTINATION lib)
INSTALL (TARGETS hpmsse2 DESTINATION lib)
INSTALL (TARGETS hpmsse3 DESTINATION lib)
INSTALL (TARGETS hpmsse41 DESTINATION lib)
INSTALL (TARGETS hpmsse42 DESTINATION lib)
ENDIF()
# Install NEON SIMD extension if on an ARM platform.
IF(__arm__)
INSTALL (TARGETS hpmneon DESTINATION lib)
ENDIF()
ENDIF()
ENDIF()
# Invoke cmake file from the test directory.
IF(HPM_BUILD_TEST)
ENABLE_TESTING()
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/test)
ENDIF()
IF(BUILD_WITH_DOCS)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/docs)
ENDIF()
# Create distrubtion archive file.
IF( UNIX )
IF(BUILD_WTIH_DISTRIBUTION)
SET( TARGETDIR "${PROJECT_NAME}-${HPM_VERSION}")
ADD_CUSTOM_TARGET( distribution
COMMAND mkdir -p ${TARGETDIR}
COMMAND mkdir -p ${TARGETDIR}/test
COMMAND mkdir -p ${TARGETDIR}/test/glbunny
COMMAND mkdir -p ${TARGETDIR}/test/hpmassert
COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/LICENSE
${CMAKE_CURRENT_SOURCE_DIR}/README.md
${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test/hpmassert/inlcude
${CMAKE_CURRENT_SOURCE_DIR}/test/hpmassert/src
${CMAKE_CURRENT_SOURCE_DIR}/test/hpmassert/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test/glbunny/inlcude
${CMAKE_CURRENT_SOURCE_DIR}/test/glbunny/src
${CMAKE_CURRENT_SOURCE_DIR}/test/glbunny/CMakeLists.txt ${TARGETDIR}
COMMAND tar cf - ${TARGETDIR} | gzip -c > ${TARGETDIR}.tar.gz
COMMAND rm -r ${TARGETDIR} )
ENDIF()
ENDIF()
#HPM_OPT_BUILD_PACKAGES
IF(CMAKE_CPACK_COMMAND AND UNIX AND HPM_OPT_BUILD_PACKAGES)
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "valdemar lindberg") #required
# Packing information
SET(CPACK_PACKAGE_NAME "hpm${HPM_VERSION_MAJOR}.${HPM_VERSION_MINOR}")
SET(CPACK_PACKAGE_CONTACT "" CACHE STRING "Package maintainer and PGP signer.")
SET(CPACK_PACKAGE_VENDOR "https://github.com/voldien/hpm")
SET(CPACK_PACKAGE_DISPLAY_NAME "hpm ${HPM_VERSION_MAJOR}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY " - Hpm 3D math library")
SET(CPACK_PACKAGE_VERSION "${HPM_VERSION_MAJOR}.${HPM_VERSION_MINOR}" )
SET(CPACK_PACKAGE_VERSION_MAJOR "${HPM_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${HPM_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${HPM_VERSION_REVISION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "hpm${HPM_VERSION_MINOR}.${HPM_VERSION_MINOR}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
STRING(TOUPPER ${LIBHPM_COMPONENT} "LIBHPM_COMPONENT_UPPER")
STRING(TOUPPER ${LIBHPM-DEV_COMPONENT} "LIBHPM-DEV_COMPONENT_UPPER")
SET(CPACK_COMPONENT_${LIBHPM_COMPONENT_UPPER}_DISPLAY_NAME "libraries")
SET(CPACK_COMPONENT_${LIBHPM-DEV_COMPONENT_UPPER}_DISPLAY_NAME "common headers and installs")
SET(CPACK_COMPONENT_${LIBHPM-DEV_COMPONENT_UPPER}_DEPENDS "${LIBHPM_COMPONENT}" )
SET(CPACK_COMPONENT_HPM-DEV_DISPLAY_NAME "${CPACK_COMPONENT_${LIBHPM-DEV_COMPONENT}_DISPLAY_NAME}" )
SET(CPACK_COMPONENT_HPM-DEV_DEPENDS "${LIBHPM-DEV_COMPONENT}" )
SET(CPACK_DEBIAN_BUILD_DEPENDS debhelper cmake zlib1g-dev pkg-config)
# debian
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
SET(CPACK_DEBIAN_CMAKE_OPTIONS "-DBUILD_WITH_DOCS=OFF -DBUILD_TEST=OFF")
SET(CPACK_DEBIAN_PACKAGE_SECTION "libs" )
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_COMPONENTS_ALL}")
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS)
SET(cPACK_DEBIAN_PACKAGE_NAME "hpm")
SET(CPACK_DEBIAN_PACKAGE_REMOVE_SOURCE_FILES workspaces test docs obj packaging)
SET(CPACK_DEBIAN_PACKAGE_SOURCE_COPY svn export --force)
SET(CPACK_DEBIAN_CHANGELOG)
SET(DPUT_HOST "" CACHE STRING "PPA repository to upload the debian sources")
INCLUDE(DebSourcePPA)
INCLUDE(CPack)
ENDIF()