Skip to content

Commit 1efba62

Browse files
committed
[Dev] The random generation project now fully works (with ComBase as a dependency).
1 parent dfd6d94 commit 1efba62

17 files changed

+2317
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tmp/
2+
/build
3+
/randgen/config/randgen-paths.hpp
4+
/test/randgen/*_utfresults.xml
5+

CMakeLists.txt

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#
2+
cmake_minimum_required (VERSION 2.6)
3+
4+
##
5+
# CMake macros for the project
6+
include (config/project_config_embeddable.cmake)
7+
8+
##
9+
# Project info
10+
set_project_names (randgen RandGen)
11+
set_project_brief ("C++ Random Generation")
12+
set_project_versions (99 99 99)
13+
14+
##
15+
# Project options
16+
# The parameters are:
17+
# * whether or not the documentation must be built and installed
18+
set_project_options (on on)
19+
20+
21+
#####################################
22+
## Packaging ##
23+
#####################################
24+
#
25+
packaging_init (${PROJECT_NAME})
26+
packaging_set_summary (
27+
"${PROJECT_NAME} is part of the showcase platform for C++ projects.
28+
29+
The random generation (in short, 'randgen') project contains a mere random
30+
generator, which makes use of the basic C++ class specified within the
31+
'combase' project.
32+
That simple component/project shows an example of how to import another
33+
component. For instance, CMake imports are showcased.")
34+
packaging_set_contact ("Denis Arnaud <denis_arnaud - at - users dot sourceforge dot net>")
35+
packaging_set_vendor ("Denis Arnaud")
36+
37+
#
38+
packaging_set_other_options (TBZ2 "TBZ2;TGZ")
39+
40+
41+
########################################
42+
## Dependencies ##
43+
########################################
44+
#
45+
get_external_libs (git "boost 1.41" combase)
46+
47+
48+
##############################################
49+
## Build, Install, Export ##
50+
##############################################
51+
##
52+
# Initialise the building process
53+
init_build ()
54+
55+
##
56+
# Sub-modules
57+
add_modules (${PROJECT_NAME})
58+
59+
##
60+
# For other projects to use RandGen, install a few helpers for standard
61+
# build/packaging systems: CMake, GNU Autotools (M4), pkgconfig/pc, randgen-config
62+
install_dev_helper_files ()
63+
64+
65+
#####################################
66+
## Tests ##
67+
#####################################
68+
##
69+
# Initialise the unit test process
70+
init_test ()
71+
72+
##
73+
# Test suites
74+
add_test_suite (${PROJECT_NAME})
75+
76+
77+
#######################################
78+
## Overall Status ##
79+
#######################################
80+
display_status ()
81+
82+
83+
#######################################
84+
## CMake Cache Storage ##
85+
#######################################
86+
store_in_cache ()

COPYING

Lines changed: 504 additions & 0 deletions
Large diffs are not rendered by default.

README

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
Summary:
3+
--------
24
That project is part of the showcase platform for C++ projects.
35

46
The random generation (in short, 'randgen') project contains a mere random
@@ -10,3 +12,45 @@ component. For instance, CMake imports are showcased.
1012
That component/project is, in turn, needed by the "main" projects/components.
1113

1214

15+
Building the library and test binary from Git repository:
16+
---------------------------------------------------------
17+
The Sourceforge Git repository may be cloned as following:
18+
git clone ssh://github.com/cpp-projects-showcase/randgen randgengit
19+
cd randgengit
20+
git checkout trunk
21+
22+
Then, you need the following packages (Fedora/RedHat/CentOS names here,
23+
but names may vary according to distributions):
24+
* cmake
25+
* gcc-c++
26+
* boost-devel
27+
* combase-devel
28+
* rpm-build (optional)
29+
30+
31+
Building the library and test binary from the tarball:
32+
------------------------------------------------------
33+
The latest stable source tarball (randgen*.tar.gz or .bz2) can be found here:
34+
https://github.com/cpp-projects-showcase/randgen/downloads
35+
36+
Then, as usual:
37+
* To configure the project, type something like:
38+
mkdir build && cd build
39+
cmake -DCMAKE_INSTALL_PREFIX=/home/user/dev/deliveries/randgen-99.99.99 \
40+
-DWITH_COMBASE_PREFIX=/home/user/dev/deliveries/combase-stable \
41+
-DCMAKE_BUILD_TYPE:STRING=Debug -DENABLE_TEST:BOOL=ON ..
42+
* To build the project, type:
43+
make
44+
* To test the project, type:
45+
make check
46+
* To install the library (librandgen*.so*), just type:
47+
make install
48+
* To package the source files, type:
49+
make dist
50+
* To package the binary:
51+
make package
52+
* To check the installation:
53+
/home/user/dev/deliveries/randgen-99.99.99/bin/randgen-config --help
54+
55+
56+
(Denis Arnaud, January 2012)

config/FindBoostWrapper.cmake

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# That file is just a wrapper around the standard Fedora/RedHat FindBoost.cmake
2+
# script. Indeed, that latter does not do version comparison. So, we just
3+
# use here standard CMake mechanism to enforce the Boost required version.
4+
#
5+
# Moreover, on EPEL 5, Boost-1.41 is available in non-standard directories
6+
# (since the standard Boost version is 1.33 for RedHat/CentOS/EPEL 5).
7+
# cmake should therefore be invoked with the following options:
8+
# -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
9+
# -DBOOST_INCLUDEDIR=/usr/include/boost141 \
10+
# -DBoost_ADDITIONAL_VERSIONS="1.41 1.41.0"
11+
#
12+
set (Boost_HUMAN_VERSION
13+
${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION})
14+
message (STATUS "Found Boost version: ${Boost_HUMAN_VERSION}")
15+
16+
# Check the version requirement only
17+
include (FindPackageHandleStandardArgs)
18+
if (${CMAKE_VERSION} VERSION_GREATER 2.8.1)
19+
find_package_handle_standard_args (BoostWrapper
20+
REQUIRED_VARS Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS
21+
VERSION_VAR Boost_HUMAN_VERSION)
22+
else (${CMAKE_VERSION} VERSION_GREATER 2.8.1)
23+
find_package_handle_standard_args (BoostWrapper
24+
DEFAULT_MSG Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS)
25+
endif (${CMAKE_VERSION} VERSION_GREATER 2.8.1)
26+
27+
if (BOOSTWRAPPER_FOUND)
28+
mark_as_advanced (BOOSTWRAPPER_FOUND Boost_HUMAN_VERSION)
29+
else (BOOSTWRAPPER_FOUND)
30+
message (FATAL_ERROR "Could not find the Boost libraries! Please install the development-libraries and headers (e.g., 'boost-devel' for Fedora/RedHat).")
31+
endif (BOOSTWRAPPER_FOUND)
32+

config/FindGit.cmake

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
set (Git_FOUND FALSE)
3+
4+
find_program (Git_EXECUTABLE git DOC "git command line client")
5+
mark_as_advanced (Git_EXECUTABLE)
6+
7+
if (Git_EXECUTABLE)
8+
set (Git_FOUND TRUE)
9+
10+
macro (Git_WC_INFO dir prefix)
11+
execute_process (COMMAND ${Git_EXECUTABLE} rev-list -n 1 HEAD
12+
WORKING_DIRECTORY ${dir}
13+
ERROR_VARIABLE Git_error
14+
OUTPUT_VARIABLE ${prefix}_WC_REVISION_HASH
15+
OUTPUT_STRIP_TRAILING_WHITESPACE)
16+
if (NOT ${Git_error} EQUAL 0)
17+
message (STATUS
18+
"Command \"${Git_EXECUTBALE} rev-list -n 1 HEAD\" in directory ${dir} failed with output:\n${Git_error}")
19+
else (NOT ${Git_error} EQUAL 0)
20+
execute_process (COMMAND ${Git_EXECUTABLE}
21+
name-rev ${${prefix}_WC_REVISION_HASH}
22+
WORKING_DIRECTORY ${dir}
23+
OUTPUT_VARIABLE ${prefix}_WC_REVISION_NAME
24+
OUTPUT_STRIP_TRAILING_WHITESPACE)
25+
endif (NOT ${Git_error} EQUAL 0)
26+
endmacro (Git_WC_INFO)
27+
endif (Git_EXECUTABLE)
28+
29+
if (NOT Git_FOUND)
30+
if (NOT Git_FIND_QUIETLY)
31+
message (STATUS "Git was not found")
32+
else (NOT Git_FIND_QUIETLY)
33+
if (Git_FIND_REQUIRED)
34+
message (FATAL_ERROR "Git was not found")
35+
endif (Git_FIND_REQUIRED)
36+
endif (NOT Git_FIND_QUIETLY)
37+
endif (NOT Git_FOUND)

config/devhelpers.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
##
2+
# For the other developers to use that project (${PROJECT_NAME})
3+
#
4+
5+
# Configure helper (e.g., to easily retrieve the version and compilation flags)
6+
set (CFG_SCRIPT ${PROJECT_NAME}-config)
7+
set (CFG_SCRIPT_PATH bin)
8+
9+
# (Debian) Packaging helper
10+
set (PKGCFG_SCRIPT ${PROJECT_NAME}.pc)
11+
set (PKGCFG_SCRIPT_PATH ${LIBDIR}/pkgconfig)
12+
13+
# GNU Autotools helper (M4 macro file)
14+
set (M4_MACROFILE ${PROJECT_NAME}.m4)
15+
set (M4_MACROFILE_PATH share/aclocal)
16+
17+
# Convert the developer script utilities (basically, just replace
18+
# the @<variable>@ variables)
19+
configure_file (${CFG_SCRIPT}.in ${CFG_SCRIPT} @ONLY)
20+
configure_file (${PKGCFG_SCRIPT}.in ${PKGCFG_SCRIPT} @ONLY)
21+
configure_file (${M4_MACROFILE}.in ${M4_MACROFILE} @ONLY)
22+
23+
#
24+
add_custom_target (devhelpers ALL DEPENDS)
25+
add_dependencies (devhelpers ${CFG_SCRIPT})
26+
add_dependencies (devhelpers ${PKGCFG_SCRIPT})
27+
add_dependencies (devhelpers ${M4_MACROFILE})

0 commit comments

Comments
 (0)