root / src / CMakeLists.txt @ 9f38e25a
History | View | Annotate | Download (4.2 kB)
1 |
# Copyright 2014 GRNET S.A. All rights reserved. |
---|---|
2 |
# |
3 |
# Redistribution and use in source and binary forms, with or |
4 |
# without modification, are permitted provided that the following |
5 |
# conditions are met: |
6 |
# |
7 |
# 1. Redistributions of source code must retain the above |
8 |
# copyright notice, this list of conditions and the following |
9 |
# disclaimer. |
10 |
# |
11 |
# 2. Redistributions in binary form must reproduce the above |
12 |
# copyright notice, this list of conditions and the following |
13 |
# disclaimer in the documentation and/or other materials |
14 |
# provided with the distribution. |
15 |
# |
16 |
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
17 |
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 |
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
20 |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
23 |
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
24 |
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
26 |
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
27 |
# POSSIBILITY OF SUCH DAMAGE. |
28 |
# |
29 |
# The views and conclusions contained in the software and |
30 |
# documentation are those of the authors and should not be |
31 |
# interpreted as representing official policies, either expressed |
32 |
# or implied, of GRNET S.A. |
33 |
|
34 |
cmake_minimum_required(VERSION 2.8) |
35 |
|
36 |
project (xseg_lib) |
37 |
|
38 |
SET(OUT ${CMAKE_CURRENT_BINARY_DIR}/libxseg.map) |
39 |
SET(EXPORTS ${CMAKE_CURRENT_SOURCE_DIR}/exports/xseg_exports.h |
40 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xq_exports.h |
41 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xbinheap_exports.h |
42 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xcache_exports.h |
43 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xpool_exports.h |
44 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xhash_exports.h |
45 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xheap_exports.h |
46 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xobj_exports.h |
47 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xwaitq_exports.h |
48 |
${CMAKE_CURRENT_SOURCE_DIR}/exports/xworkq_exports.h |
49 |
) |
50 |
SET(CMD cat ${EXPORTS} | ${CMAKE_CURRENT_SOURCE_DIR}/exports/make_symbol_map.sh > ${OUT}) |
51 |
|
52 |
ADD_CUSTOM_COMMAND( OUTPUT ${OUT} |
53 |
COMMAND ${CMD} |
54 |
# The following should be ${doxyfile} only but it |
55 |
# will break the dependency. |
56 |
# The optimal solution would be creating a |
57 |
# custom_command for ${doxyfile} generation |
58 |
# but I still have to figure out how... |
59 |
# MAIN_DEPENDENCY ${doxyfile} ${doxyfile_in} |
60 |
# DEPENDS xseg_lib ${OUT} |
61 |
COMMENT "Generating libxseg map") |
62 |
|
63 |
#ADD_CUSTOM_TARGET( libmap DEPENDS ${out} ) |
64 |
ADD_CUSTOM_TARGET( libmap DEPENDS ${OUT} ) |
65 |
#ADD_CUSTOM_TARGET( libmap ) |
66 |
|
67 |
|
68 |
set(CMAKE_C_FLAGS "-O2 -finline -march=nocona -Wall -std=gnu99 -pedantic -g -rdynamic -DVAL_OVERLOAD -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libxseg.map") |
69 |
#add_subdirectory(exports) |
70 |
|
71 |
|
72 |
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/xseg/version.h.in |
73 |
${CMAKE_CURRENT_BINARY_DIR}/include/xseg/version.h) |
74 |
|
75 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
76 |
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) |
77 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
78 |
set(xseg_srcs xseg.c initialize.c xseg_posix.c xseg_pthread.c xseg_posixfd.c |
79 |
xseg_user.c xtypes/xcache.c xtypes/xbinheap.c xtypes/xhash.c |
80 |
xtypes/xheap.c xtypes/xobj.c xtypes/xpool.c xtypes/xq.c xtypes/xwaitq.c |
81 |
xtypes/xworkq.c) |
82 |
add_library(xseg SHARED ${xseg_srcs}) |
83 |
target_link_libraries(xseg rt pthread dl) |
84 |
|
85 |
add_executable(xseg-tool xseg-tool.c) |
86 |
target_link_libraries(xseg-tool xseg) |
87 |
|
88 |
ADD_DEPENDENCIES(xseg libmap) |
89 |
SET_TARGET_PROPERTIES( |
90 |
xseg |
91 |
PROPERTIES |
92 |
SOVERSION ${MAJOR} |
93 |
VERSION ${MAJOR}.${MINOR} |
94 |
) |
95 |
|
96 |
SET_TARGET_PROPERTIES( |
97 |
xseg-tool |
98 |
PROPERTIES |
99 |
OUTPUT_NAME xseg |
100 |
) |
101 |
|
102 |
INSTALL_TARGETS(/lib xseg) |
103 |
INSTALL_TARGETS(/bin xseg-tool) |
104 |
#INSTALL_FILES(/include ) |
105 |
INSTALL(DIRECTORY include DESTINATION /usr FILES_MATCHING PATTERN "*.h") |
106 |
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include DESTINATION /usr) |
107 |
#install(FILES libxseg0.so DESTINATION $DESTDIR/usr/lib/) |
108 |
#install(FILES libxseg0.so.${MAJOR} DESTINATION $DESTDIR/usr/lib/) |
109 |
#install(FILES libxseg0.so.${MAJOR}.${MINOR} DESTINATION $DESTDIR/usr/lib/) |