Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
15860274
Commit
15860274
authored
Jul 05, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/build-tweaks' of
https://github.com/mavam/libcppa
into unstable
parents
9e36f2e3
594c4f2a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
267 additions
and
41 deletions
+267
-41
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+30
-2
configure
configure
+234
-0
mk_dual_build.sh
mk_dual_build.sh
+0
-39
unit_testing/CMakeLists.txt
unit_testing/CMakeLists.txt
+2
-0
No files found.
.gitignore
View file @
15860274
...
...
@@ -12,3 +12,4 @@ libcppa.pc
bin/*
build/*
lib/*
Makefile
CMakeLists.txt
View file @
15860274
cmake_minimum_required
(
VERSION 2.4
)
project
(
cppa CXX
)
# Prohibit in-source builds.
if
(
"
${
CMAKE_SOURCE_DIR
}
"
STREQUAL
"
${
CMAKE_BINARY_DIR
}
"
)
message
(
FATAL_ERROR
"In-source builds are not allowed. Please use "
"./configure to choose a build directory and "
"initialize the build configuration."
)
endif
()
set
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11 -Wextra -Wall -pedantic"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"-O0 -g"
)
set
(
CMAKE_CXX_FLAGS_MINSIZEREL
"-Os"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O4"
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O2 -g"
)
if
(
ENABLE_DEBUG
)
set
(
CMAKE_BUILD_TYPE Debug
)
add_definitions
(
"-DCPPA_DEBUG"
)
endif
()
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"GNU"
)
execute_process
(
COMMAND
${
CMAKE_CXX_COMPILER
}
-dumpversion
OUTPUT_VARIABLE GCC_VERSION
)
if
(
NOT
(
GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7
))
message
(
FATAL_ERROR
"
${
PROJECT_NAME
}
requires g++ 4.7 or greater."
)
endif
()
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-stdlib=libc++"
)
else
()
message
(
FATAL_ERROR
"Your C++ compiler does not support C++11."
)
endif
()
set
(
LIBCPPA_SRC
src/abstract_tuple.cpp
...
...
@@ -116,12 +143,12 @@ install(TARGETS libcppa LIBRARY DESTINATION lib)
# install includes
install
(
DIRECTORY cppa/ DESTINATION include/cppa
FILES_MATCHING PATTERN
"*.hpp"
)
# uninstall target
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake_uninstall.cmake.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target
(
uninstall
COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake
)
...
...
@@ -154,6 +181,7 @@ else ()
set
(
EXECUTABLE_OUTPUT_PATH
${
CMAKE_SOURCE_DIR
}
/bin CACHE PATH
"Single directory for all executables"
)
endif
()
enable_testing
()
add_subdirectory
(
unit_testing
)
add_subdirectory
(
examples
)
add_subdirectory
(
benchmarks
)
...
...
configure
0 → 100755
View file @
15860274
#!/bin/sh
# Convenience wrapper for easily viewing/setting options that
# the project's CMake scripts will recognize.
# check for `cmake` command
type
cmake
>
/dev/null 2>&1
||
{
echo
"
\
This package requires CMake, please install it first, then you may
use this configure script to access CMake equivalent functionality.
\
"
>
&2
;
exit
1
;
}
command
=
"
$0
$*
"
sourcedir
=
"
$(
cd
"
$(
dirname
"
$0
"
)
"
&&
pwd
)
"
usage
=
"
\
Usage:
$0
[OPTION]... [VAR=VALUE]...
Build Options:
--builddir=DIR place build files in directory [build]
--generator=GENERATOR CMake generator to use (see cmake --help)
--with-clang=FILE path to clang++ executable
--with-gcc=FILE path to g++ executable
--bin-dir=DIR executable directory [build/bin]
--lib-dir=DIR library directory [build/lib]
--dual-build build both with gcc and clang
Installation Directories:
--prefix=PREFIX installation directory [/usr/local]
Optional Features:
--enable-debug compile in debugging mode
--enable-perftools use Google perftools
Required Packages in Non-Standard Locations:
--with-boost=PATH path to Boost install root
Influential Environment Variables (only on first invocation
per build directory):
CXX C++ compiler command
CXXFLAGS C++ compiler flags
"
# Appends a CMake cache entry definition to the CMakeCacheEntries variable.
# $1 is the cache entry variable name
# $2 is the cache entry variable type
# $3 is the cache entry variable value
append_cache_entry
()
{
CMakeCacheEntries
=
"
$CMakeCacheEntries
-D
$1
:
$2
=
$3
"
}
# Creates a build directory via CMake.
# $1 is the path to a compiler executable.
# $2 is the suffix of the build directory.
# $3 is the executable output path.
# $4 is the library output path.
# $5 is the CMake generator.
configure
()
{
CMakeCacheEntries
=
""
echo
"-------------------------------------------------"
if
[
-n
"
$1
"
]
;
then
append_cache_entry CMAKE_CXX_COMPILER FILEPATH
$1
echo
"compiler:
$1
"
else
echo
"compiler: system default"
fi
if
[
-n
"
$2
"
]
;
then
workdir
=
"
$builddir
-
$2
"
else
workdir
=
$builddir
fi
workdirs
=
"
$workdirs
$workdir
"
echo
"build directory:
$workdir
"
if
[
-n
"
$3
"
]
;
then
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH
$3
echo
"executable output directory:
$3
"
else
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH
"
$workdir
/bin"
echo
"executable output directory:
$workdir
/bin"
fi
if
[
-n
"
$4
"
]
;
then
append_cache_entry LIBRARY_OUTPUT_PATH PATH
$4
echo
"library output directory:
$4
"
else
append_cache_entry LIBRARY_OUTPUT_PATH PATH
"
$workdir
/lib"
echo
"library output directory:
$workdir
/lib"
fi
echo
"-------------------------------------------------"
if
[
-d
$workdir
]
;
then
# If a build directory exists, check if it has a CMake cache.
if
[
-f
$workdir
/CMakeCache.txt
]
;
then
# If the CMake cache exists, delete it so that this configuration
# is not tainted by a previous one.
rm
-f
$workdir
/CMakeCache.txt
fi
else
mkdir
-p
$workdir
fi
cd
$workdir
if
[
-n
"
$5
"
]
;
then
cmake
-G
"
$5
"
$CMakeCacheEntries
$sourcedir
else
cmake
$CMakeCacheEntries
$sourcedir
fi
echo
"# This is the command used to configure this build"
>
config.status
echo
$command
>>
config.status
chmod
u+x config.status
}
# Set defaults.
builddir
=
"
$sourcedir
/build"
CMakeCacheEntries
=
""
append_cache_entry CMAKE_INSTALL_PREFIX PATH /usr/local
append_cache_entry ENABLE_DEBUG BOOL
false
# Parse arguments.
while
[
$#
-ne
0
]
;
do
case
"
$1
"
in
-
*
=
*
)
optarg
=
`
echo
"
$1
"
|
sed
's/[-_a-zA-Z0-9]*=//'
`
;;
*
)
optarg
=
;;
esac
case
"
$1
"
in
--help
|
-h
)
echo
"
${
usage
}
"
1>&2
exit
1
;;
--builddir
=
*
)
builddir
=
$optarg
;;
--generator
=
*
)
CMakeGenerator
=
"
$optarg
"
;;
--prefix
=
*
)
append_cache_entry CMAKE_INSTALL_PREFIX PATH
$optarg
;;
--enable-debug
)
append_cache_entry ENABLE_DEBUG BOOL
true
;;
--with-boost
=
*
)
append_cache_entry BOOST_ROOT PATH
$optarg
;;
--with-clang
=
*
)
clang
=
$optarg
;;
--with-gcc
=
*
)
gcc
=
$optarg
;;
--bin-dir
=
*
)
bindir
=
$optarg
;;
--lib-dir
=
*
)
libdir
=
$optarg
;;
--dual-build
)
dualbuild
=
1
;;
*
)
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
exit
1
;;
esac
shift
done
if
[
-n
"
$dualbuild
"
]
;
then
# Use what we got in $PATH if --with-clang or --with-gcc is not specified.
if
[
-z
"
$clang
"
]
;
then
clang
=
clang++
fi
if
[
-z
"
$gcc
"
]
;
then
gcc
=
g++
fi
for
i
in
gcc clang
;
do
compiler
=
"
$(
eval echo
\$
$i
)
"
configure
$compiler
$i
""
""
$CMakeGenerator
done
else
# Prefer Clang to GCC.
if
[
-n
"
$clang
"
]
;
then
compiler
=
$clang
elif
[
-n
"
$gcc
"
]
;
then
compiler
=
$gcc
fi
configure
$compiler
""
$bindir
$libdir
$CMakeGenerator
fi
echo
"DIRS :=
$workdirs
\n
"
>
$sourcedir
/Makefile
read
-d
''
makefile
<<
"
EOT
"
all: configured
@for i in
$(
DIRS
)
; do
$(
MAKE
)
-C
$$
i
$@
; done
configured:
@for i in
$(
DIRS
)
; do
\\
test -d
$$
i ||
\\
( echo "Error: No build directory found. Did you run configure?" && exit 1 );
\\
test -e
$$
i/Makefile ||
\\
( echo "Error: No Makefile in build directory found. Did you run configure?" && exit 1 );
\\
done
test: configured
@for i in
$(
DIRS
)
; do
$(
MAKE
)
-C
$$
i
$@
; done
install:
@for i in
$(
DIRS
)
; do
$(
MAKE
)
-C
$$
i
$@
; done
uninstall: configured
@for i in
$(
DIRS
)
; do
$(
MAKE
)
-C
$$
i
$@
; done
clean: configured
@for i in
$(
DIRS
)
; do
$(
MAKE
)
-C
$$
i
$@
; done
distclean:
rm -rf
$(
DIRS
)
Makefile
.PHONY: all configured test install uninstall clean distclean
EOT
echo
"
$makefile
"
>>
$sourcedir
/Makefile
mk_dual_build.sh
deleted
100755 → 0
View file @
9e36f2e3
#!/bin/bash
if
test
"$#"
!=
"2"
;
then
echo
"usage:
$0
[path_to_clang++] [path_to_g++]"
exit
fi
echo
"using clang:
$1
"
echo
"using gcc:
$2
"
rm
-rf
clang_build
rm
-r
gcc_build
topDir
=
$PWD
mkdir
clang_build
cd
clang_build
cmake ..
-DCMAKE_CXX_COMPILER
=
"
$1
"
-DCMAKE_CXX_FLAGS
=
"-stdlib=libc++ -DCPPA_DEBUG -pedantic -Wall -Wextra -Werror"
-DEXECUTABLE_OUTPUT_PATH
=
"
$topDir
/clang_bin/"
-DLIBRARY_OUTPUT_PATH
=
"
$topDir
/clang_lib"
cd
..
mkdir
gcc_build
cd
gcc_build
cmake ..
-DCMAKE_CXX_COMPILER
=
"
$2
"
-DCMAKE_CXX_FLAGS
=
"-DCPPA_DEBUG -pedantic -Wall -Wextra -Werror"
-DEXECUTABLE_OUTPUT_PATH
=
"
$topDir
/gcc_bin/"
-DLIBRARY_OUTPUT_PATH
=
"
$topDir
/gcc_lib"
cd
..
exec
>
Makefile
printf
"all:
\n
"
printf
"
\t
make -C gcc_build
\n
"
printf
"
\t
make -C clang_build
\n
"
printf
"
\n
"
printf
"clean:
\n
"
printf
"
\t
make clean -C gcc_build
\n
"
printf
"
\t
make clean -C clang_build
\n
"
printf
"
\n
"
printf
"test:
\n
"
printf
"
\t
export DYLD_LIBRARY_PATH=
$topDir
/gcc_lib
\n
"
printf
"
\t
./gcc_bin/unit_tests
\n
"
printf
"
\t
export DYLD_LIBRARY_PATH=
$topDir
/clang_lib
\n
"
printf
"
\t
./clang_bin/unit_tests
\n
"
unit_testing/CMakeLists.txt
View file @
15860274
...
...
@@ -37,3 +37,5 @@ include_directories(. ${cppa_INCLUDE} ${Boost_INCLUDE_DIRS})
set
(
EXAMPLE_LIBS
${
CMAKE_DL_LIBS
}
${
CPPA_LIBRARY
}
${
Boost_THREAD_LIBRARY
}
)
target_link_libraries
(
unit_tests
${
EXAMPLE_LIBS
}
)
add_test
(
unit_tests
${
EXECUTABLE_OUTPUT_PATH
}
/unit_tests
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment