Skip to content

Commit eaa37a6

Browse files
committed
Update zproject generation
1 parent e024e62 commit eaa37a6

29 files changed

+1046
-188
lines changed

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This is a skeleton created by zproject.
2+
# You can add hand-written code here.
3+
# disables auto CRLF conversion for all files; create the file correctly and it will be allright
4+
* -text

CMakeLists.txt

+104-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3-
# Please refer to the README for information about making permanent changes. #
3+
# Read the zproject/README.md for information about making permanent changes. #
44
################################################################################
55

66
########################################################################
@@ -12,6 +12,12 @@ enable_language(C)
1212
enable_testing()
1313

1414
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
15+
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
16+
# Select flags
17+
SET(CMAKE_C_FLAGS_RELEASE "-O3")
18+
19+
# Will be used to add flags to pkg-config useful when apps want to statically link
20+
set(pkg_config_libs_private "")
1521

1622
########################################################################
1723
# options
@@ -80,6 +86,7 @@ find_package(libzmq REQUIRED)
8086
IF (LIBZMQ_FOUND)
8187
include_directories(${LIBZMQ_INCLUDE_DIRS})
8288
list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES})
89+
set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq")
8390
ELSE (LIBZMQ_FOUND)
8491
message( FATAL_ERROR "libzmq not found." )
8592
ENDIF (LIBZMQ_FOUND)
@@ -91,6 +98,7 @@ find_package(czmq REQUIRED)
9198
IF (CZMQ_FOUND)
9299
include_directories(${CZMQ_INCLUDE_DIRS})
93100
list(APPEND MORE_LIBRARIES ${CZMQ_LIBRARIES})
101+
set(pkg_config_libs_private "${pkg_config_libs_private} -lczmq")
94102
ELSE (CZMQ_FOUND)
95103
message( FATAL_ERROR "czmq not found." )
96104
ENDIF (CZMQ_FOUND)
@@ -102,6 +110,7 @@ find_package(zyre REQUIRED)
102110
IF (ZYRE_FOUND)
103111
include_directories(${ZYRE_INCLUDE_DIRS})
104112
list(APPEND MORE_LIBRARIES ${ZYRE_LIBRARIES})
113+
set(pkg_config_libs_private "${pkg_config_libs_private} -lzyre")
105114
ELSE (ZYRE_FOUND)
106115
message( FATAL_ERROR "zyre not found." )
107116
ENDIF (ZYRE_FOUND)
@@ -142,16 +151,22 @@ IF (ENABLE_DRAFTS)
142151
)
143152
ENDIF (ENABLE_DRAFTS)
144153

154+
IF (ENABLE_DRAFTS)
155+
list (APPEND glar_sources
156+
src/glar_private_selftest.c
157+
)
158+
ENDIF (ENABLE_DRAFTS)
159+
145160
source_group("Source Files" FILES ${glar_sources})
146161
if (NOT DEFINED BUILD_SHARED_LIBS)
147162
SET(BUILD_SHARED_LIBS ON)
148163
endif()
149164
add_library(glar ${glar_sources})
150165
set_target_properties(glar
151-
PROPERTIES DEFINE_SYMBOL "LIBGLAR_EXPORTS"
166+
PROPERTIES DEFINE_SYMBOL "GLAR_EXPORTS"
152167
)
153-
set_target_properties(glar
154-
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${SOURCE_DIR}/src"
168+
set_target_properties (glar
169+
PROPERTIES SOVERSION "0.0.0"
155170
)
156171
target_link_libraries(glar
157172
${ZEROMQ_LIBRARIES} ${MORE_LIBRARIES}
@@ -201,9 +216,8 @@ target_link_libraries(
201216
${ZYRE_LIBRARIES}
202217
${OPTIONAL_LIBRARIES}
203218
)
204-
set_target_properties(
205-
glard
206-
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SOURCE_DIR}/src"
219+
install(TARGETS glard
220+
RUNTIME DESTINATION bin
207221
)
208222
add_executable(
209223
glar_selftest
@@ -217,16 +231,19 @@ target_link_libraries(
217231
${ZYRE_LIBRARIES}
218232
${OPTIONAL_LIBRARIES}
219233
)
220-
set_target_properties(
221-
glar_selftest
222-
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SOURCE_DIR}/src"
223-
)
224234

225235
########################################################################
226236
# tests
227237
########################################################################
228-
set(CLASSTEST_TIMEOUT 5 CACHE STRING "Timeout of the selftest of a class")
229-
set(TOTAL_TIMEOUT 20 CACHE STRING "Timout of the total testsuite")
238+
set(CLASSTEST_TIMEOUT 60 CACHE STRING "Timeout of the selftest of a class")
239+
set(TOTAL_TIMEOUT 600 CACHE STRING "Timout of the total testsuite")
240+
241+
if(UNIX)
242+
find_program(MEMORYCHECK_COMMAND valgrind)
243+
set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-reachable=yes
244+
--error-exitcode=1
245+
--suppressions=src/.valgrind.supp")
246+
endif()
230247

231248
set(TEST_CLASSES
232249
)
@@ -239,6 +256,12 @@ IF (ENABLE_DRAFTS)
239256
)
240257
ENDIF (ENABLE_DRAFTS)
241258

259+
IF (ENABLE_DRAFTS)
260+
list (APPEND TEST_CLASSES
261+
private_classes
262+
)
263+
ENDIF (ENABLE_DRAFTS)
264+
242265
foreach(TEST_CLASS ${TEST_CLASSES})
243266
add_test(
244267
NAME ${TEST_CLASS}
@@ -250,14 +273,79 @@ foreach(TEST_CLASS ${TEST_CLASSES})
250273
)
251274
endforeach(TEST_CLASS)
252275

276+
include(CTest)
277+
278+
########################################################################
279+
# cleanup
280+
########################################################################
281+
add_custom_target (distclean @echo Cleaning for source distribution)
282+
283+
set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt
284+
${CMAKE_BINARY_DIR}/cmake_install.cmake
285+
${CMAKE_BINARY_DIR}/Makefile
286+
${CMAKE_BINARY_DIR}/CMakeFiles
287+
${CMAKE_BINARY_DIR}/CTestTestfile.cmake
288+
${CMAKE_BINARY_DIR}/DartConfiguration.tcl
289+
${CMAKE_BINARY_DIR}/Testing
290+
${CMAKE_BINARY_DIR}/compile_commands.json
291+
${CMAKE_BINARY_DIR}/src/platform.h
292+
${CMAKE_BINARY_DIR}/src/libglar.pc
293+
${CMAKE_BINARY_DIR}/src/libglar.so
294+
${CMAKE_BINARY_DIR}/src/glar150_selftest
295+
${CMAKE_BINARY_DIR}/src/glard
296+
${CMAKE_BINARY_DIR}/src/glar_selftest
297+
)
298+
299+
add_custom_command(
300+
DEPENDS clean
301+
COMMENT "distribution clean"
302+
COMMAND rm
303+
ARGS -rf CMakeTmp ${cmake_generated}
304+
TARGET distclean
305+
)
253306

254307
########################################################################
255308
# summary
256309
########################################################################
257-
message (STATUS "*** Version number: ${VERSION}")
258-
message (STATUS "*** Install target: ${CMAKE_INSTALL_PREFIX}")
310+
message ("")
311+
message (STATUS "******************* Configuration Summary *******************")
312+
message (STATUS "General:")
313+
message (STATUS " Version : ${VERSION}")
314+
message (STATUS " System : ${CMAKE_SYSTEM_NAME}")
315+
message (STATUS " C compiler : ${CMAKE_C_COMPILER}")
316+
message (STATUS " Debug C flags : ${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS}")
317+
message (STATUS " Release C flags : ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS}")
318+
message (STATUS " Build type : ${CMAKE_BUILD_TYPE}")
319+
IF (ENABLE_DRAFTS)
320+
message (STATUS " Draft API : Yes")
321+
ELSE (ENABLE_DRAFTS)
322+
message (STATUS " Draft API : No")
323+
ENDIF (ENABLE_DRAFTS)
324+
message (STATUS "")
325+
message (STATUS "Dependencies:")
326+
include(FeatureSummary)
327+
feature_summary (WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
328+
message (STATUS "")
329+
message (STATUS "Install:")
330+
message (STATUS " Install prefix :" "${CMAKE_INSTALL_PREFIX}")
331+
message (STATUS "")
332+
message (STATUS "************************* Options ***************************")
333+
message (STATUS "Options:")
334+
message (STATUS " Use the Draft API (default = yes):")
335+
message (STATUS " -DENABLE-DRAFTS=[yes|no]")
336+
message (STATUS "")
337+
message (STATUS "*************************************************************")
338+
message (STATUS "Configuration complete! Now procced with:")
339+
message (STATUS " 'make' compile the project")
340+
message (STATUS " 'make test' run the project's selftest")
341+
message (STATUS " 'make install' install the project to ${CMAKE_INSTALL_PREFIX}")
342+
message (STATUS "")
343+
message (STATUS "Further options are:")
344+
message (STATUS " 'ctest -T memcheck' run the project's selftest with")
345+
message (STATUS " valgrind to check for memory leaks")
346+
message (STATUS "")
259347

260348
################################################################################
261349
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
262-
# Please refer to the README for information about making permanent changes. #
350+
# Read the zproject/README.md for information about making permanent changes. #
263351
################################################################################

Findczmq.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3-
# Please refer to the README for information about making permanent changes. #
3+
# Read the zproject/README.md for information about making permanent changes. #
44
################################################################################
55

66
if (NOT MSVC)
@@ -10,6 +10,8 @@ if (NOT MSVC)
1010
pkg_check_modules(PC_CZMQ "libczmq")
1111
endif (NOT PC_CZMQ_FOUND)
1212
if (PC_CZMQ_FOUND)
13+
# add CFLAGS from pkg-config file, e.g. draft api.
14+
add_definitions(${PC_CZMQ_CFLAGS} ${PC_CZMQ_CFLAGS_OTHER})
1315
# some libraries install the headers is a subdirectory of the include dir
1416
# returned by pkg-config, so use a wildcard match to improve chances of finding
1517
# headers and SOs.
@@ -43,5 +45,5 @@ mark_as_advanced(
4345

4446
################################################################################
4547
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
46-
# Please refer to the README for information about making permanent changes. #
48+
# Read the zproject/README.md for information about making permanent changes. #
4749
################################################################################

Findlibzmq.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3-
# Please refer to the README for information about making permanent changes. #
3+
# Read the zproject/README.md for information about making permanent changes. #
44
################################################################################
55

66
if (NOT MSVC)
@@ -10,6 +10,8 @@ if (NOT MSVC)
1010
pkg_check_modules(PC_LIBZMQ "libzmq")
1111
endif (NOT PC_LIBZMQ_FOUND)
1212
if (PC_LIBZMQ_FOUND)
13+
# add CFLAGS from pkg-config file, e.g. draft api.
14+
add_definitions(${PC_LIBZMQ_CFLAGS} ${PC_LIBZMQ_CFLAGS_OTHER})
1315
# some libraries install the headers is a subdirectory of the include dir
1416
# returned by pkg-config, so use a wildcard match to improve chances of finding
1517
# headers and SOs.
@@ -43,5 +45,5 @@ mark_as_advanced(
4345

4446
################################################################################
4547
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
46-
# Please refer to the README for information about making permanent changes. #
48+
# Read the zproject/README.md for information about making permanent changes. #
4749
################################################################################

Findzyre.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3-
# Please refer to the README for information about making permanent changes. #
3+
# Read the zproject/README.md for information about making permanent changes. #
44
################################################################################
55

66
if (NOT MSVC)
@@ -10,6 +10,8 @@ if (NOT MSVC)
1010
pkg_check_modules(PC_ZYRE "libzyre")
1111
endif (NOT PC_ZYRE_FOUND)
1212
if (PC_ZYRE_FOUND)
13+
# add CFLAGS from pkg-config file, e.g. draft api.
14+
add_definitions(${PC_ZYRE_CFLAGS} ${PC_ZYRE_CFLAGS_OTHER})
1315
# some libraries install the headers is a subdirectory of the include dir
1416
# returned by pkg-config, so use a wildcard match to improve chances of finding
1517
# headers and SOs.
@@ -43,5 +45,5 @@ mark_as_advanced(
4345

4446
################################################################################
4547
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
46-
# Please refer to the README for information about making permanent changes. #
48+
# Read the zproject/README.md for information about making permanent changes. #
4749
################################################################################

Makefile.am

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
################################################################################
22
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
3-
# Please refer to the README for information about making permanent changes. #
3+
# Read the zproject/README.md for information about making permanent changes. #
44
################################################################################
55

6+
DISTCHECK_CONFIGURE_FLAGS = \
7+
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
8+
69
ACLOCAL_AMFLAGS = -I config
710

811
AM_CFLAGS = \
@@ -25,8 +28,21 @@ noinst_PROGRAMS =
2528
check_PROGRAMS =
2629
noinst_LTLIBRARIES =
2730
TESTS =
28-
29-
EXTRA_DIST = \
31+
# Prepare variables that can be populated (appended) in generated Makefiles or
32+
# manually maintained src/Makemodules-local.am
33+
EXTRA_DIST =
34+
CLEANFILES =
35+
DISTCLEANFILES =
36+
37+
if ENABLE_DIST_CMAKEFILES
38+
EXTRA_DIST += \
39+
Findlibzmq.cmake \
40+
Findczmq.cmake \
41+
Findzyre.cmake \
42+
CMakeLists.txt
43+
endif
44+
45+
EXTRA_DIST += \
3046
src/glard_init.sh \
3147
src/rc.local \
3248
README.md \
@@ -36,5 +52,5 @@ include $(srcdir)/src/Makemodule.am
3652

3753
################################################################################
3854
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
39-
# Please refer to the README for information about making permanent changes. #
55+
# Read the zproject/README.md for information about making permanent changes. #
4056
################################################################################

autogen.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
################################################################################
33
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
4-
# Please refer to the README for information about making permanent changes. #
4+
# Read the zproject/README.md for information about making permanent changes. #
55
################################################################################
66

77
# Script to generate all required files from fresh git checkout.
@@ -43,5 +43,5 @@ fi
4343

4444
################################################################################
4545
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
46-
# Please refer to the README for information about making permanent changes. #
46+
# Read the zproject/README.md for information about making permanent changes. #
4747
################################################################################

0 commit comments

Comments
 (0)