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
ab31da2d
Commit
ab31da2d
authored
Apr 13, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-write configure script for new CMake scaffold
parent
f0be589e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
220 additions
and
362 deletions
+220
-362
configure
configure
+220
-362
No files found.
configure
View file @
ab31da2d
#!/bin/sh
#!/bin/sh
# Convenience wrapper for easily viewing/setting options that
set
-e
# the project's CMake scripts will recognize.
command
=
"
$0
$*
"
# Convenience wrapper for easily setting options that the project's CMake
dirname_0
=
`
dirname
$0
`
# scripts will recognize.
sourcedir
=
`
cd
$dirname_0
&&
pwd
`
Command
=
"
$0
$*
"
CommandDirname
=
`
dirname
$0
`
SourceDir
=
`
cd
$CommandDirname
&&
pwd
`
usage
=
"
\
usage
=
"
\
Usage:
$0
[OPTION]... [VAR=VALUE]...
Usage:
Build Options:
$0
[--<variable>=<value>...]
--cmake=PATH set a custom path to the CMake binary
--generator=GENERATOR set CMake generator (see cmake --help)
--build-type=TYPE set CMake build type [RelWithDebInfo]:
- Debug: debugging flags enabled
- MinSizeRel: minimal output size
- Release: optimizations on, debugging off
- RelWithDebInfo: release flags plus debugging
--extra-flags=STRING additional compiler flags (sets CMAKE_CXX_FLAGS)
--build-dir=DIR place build files in directory [build]
--bin-dir=DIR executable directory [build/bin]
--lib-dir=DIR library directory [build/lib]
--with-clang=FILE path to clang++ executable
--with-gcc=FILE path to g++ executable
--with-qt-prefix=PATH prefix path for Qt5 cmake modules
--with-openssl=PATH path to OpenSSL library and headers
--dual-build build using both gcc and clang
--build-static build as static library
--static-runtime build with static C++ runtime
--no-compiler-check disable compiler version check
--no-auto-libc++ do not automatically enable libc++ for Clang
--no-exceptions do not catch exceptions in CAF
--force-no-exceptions build CAF with '-fno-exceptions'
--warnings-as-errors build with '-Werror'
Optional Targets:
General CMake options:
--with-qt-examples build Qt example(s)
--with-protobuf-examples build Google Protobuf example(s)
Installation Directories:
--cmake=PATH set a custom path to the CMake binary
--prefix=PREFIX installation directory [/usr/local]
--build-dir=PATH set build directory [build]
--build-type=STRING set build type of single-configuration generators
--generator=STRING set CMake generator (see cmake --help)
--cxx-flags=STRING set CMAKE_CXX_FLAGS when running CMake
--prefix=PATH set installation directory
Remove Standard Features (even if all dependencies are available):
Debugging options:
--no-memory-management build without memory management
--no-examples build without examples
--no-curl-examples build without libcurl examples
--no-unit-tests build without unit tests
--no-openssl build without OpenSSL module
--no-tools build without CAF tools such as caf-run
--no-io build without I/O module
--no-summary do not print configuration before building
--libs-only sets no-examples, no-tools and no-unit-tests
--core-only same as libs-only but also adds sets
no-openssl, and no-io
Debugging:
--log-level=STRING build with debugging output, possible values:
--with-runtime-checks build with requirement checks at runtime
--with-log-level=LVL build with debugging output, possible values:
- ERROR
- ERROR
- WARNING
- WARNING
- INFO
- INFO
- DEBUG
- DEBUG
- TRACE
- TRACE
--with-sanitizers=LIST build with this list of sanitizers enabled
--sanitizers=STRING build with this list of sanitizers enabled
--with-actor-profiler enables the (experimental) actor_profiler API
Convenience options:
Convenience options:
--dev-mode sets --build-type=debug, --no-examples,
--dev-mode shortcut for passing:
--no-tools, --with-runtime-checks,
--build-type=Debug
--log-level=trace, and
--log-level=TRACE
--with-sanitizers=address,undefined
--sanitizers=address,undefined
--disable-examples
--disable-tools
--enable-utility-targets
--enable-runtime-checks
Flags (use --enable-<name> to activate and --disable-<name> to deactivate):
shared-libs build shared library targets [ON]
export-compile-commands write JSON compile commands database [ON]
prefer-pthread-flag prefer -pthread flag if available [ON]
curl-examples build examples with libcurl [OFF]
protobuf-examples build examples with Google Protobuf [OFF]
qt5-examples build examples with the Qt5 framework [OFF]
runtime-checks build CAF with extra runtime assertions [OFF]
utility-targets include targets like consistency-check [OFF]
actor-profiler enable experimental proiler API [OFF]
examples build small programs showcasing CAF features [ON]
io-module build networking I/O module [ON]
testing build unit test suites [ON]
tools build utility programs such as caf-run [ON]
with-exceptions build CAF with support for exceptions [ON]
Influential Environment Variables (only on first invocation):
Influential Environment Variables (only on first invocation):
CXX C++ compiler command
CXX C++ compiler command
CXXFLAGS C++ compiler flags (overrides defaults)
CXXFLAGS Additional C++ compiler flags
LDFLAGS Additional linker flags
LDFLAGS Additional linker flags
CMAKE_GENERATOR Selects a custom generator
CMAKE_GENERATOR Selects a custom generator
iOS Build Options (should be used with XCode generator):
--sysroot=DIR set system root for Clang
- iphoneos: for iOS device
- iphonesimulator: for iOS simulator
--ios-min-ver=VERSION set the ios deployment target version
"
"
# Appends a CMake cache entry definition to the CMakeCacheEntries variable.
# Appends a CMake cache entry definition to the CMakeCacheEntries variable.
# $1 is the cache entry variable name
# $1: variable name
# $2 is the cache entry variable type
# $2: CMake type
# $3 is the cache entry variable value
# $3: value
append_cache_entry
()
append_cache_entry
()
{
{
case
"
$3
"
in
case
"
$3
"
in
*
\
*
)
*
\
*
)
# string contains whitespace
# string contains whitespace
...
@@ -103,108 +85,52 @@ append_cache_entry ()
...
@@ -103,108 +85,52 @@ append_cache_entry ()
esac
esac
}
}
#
Creates a build directory via CMak
e.
#
Appends a BOOL cache entry to the CMakeCacheEntries variabl
e.
# $1
is the path to a compiler executable.
# $1
: flag name
# $2
is the suffix of the build directory.
# $2
: value (ON or OFF)
# $3 is the executable output path.
set_build_flag
()
{
# $4 is the library output path.
FlagName
=
''
# $5 is the CMake generator.
case
"
$1
"
in
configure
()
shared-libs
)
FlagName
=
'BUILD_SHARED_LIBS'
;;
{
export-compile-commands
)
FlagName
=
'CMAKE_EXPORT_COMPILE_COMMANDS'
;;
prefer-pthread-flag
)
FlagName
=
'THREADS_PREFER_PTHREAD_FLAG'
;;
CMakeCacheEntries
=
$CMakeDefaultCache
curl-examples
)
FlagName
=
'CAF_ENABLE_CURL_EXAMPLES'
;;
protobuf-examples
)
FlagName
=
'CAF_ENABLE_PROTOBUF_EXAMPLES'
;;
if
[
-n
"
$1
"
]
;
then
qt5-examples
)
FlagName
=
'CAF_ENABLE_QT5_EXAMPLES'
;;
append_cache_entry CMAKE_CXX_COMPILER FILEPATH
$1
runtime-checks
)
FlagName
=
'CAF_ENABLE_RUNTIME_CHECKS'
;;
fi
utility-targets
)
FlagName
=
'CAF_ENABLE_UTILITY_TARGETS'
;;
actor-profiler
)
FlagName
=
'CAF_ENABLE_ACTOR_PROFILER'
;;
case
"
$builddir
"
in
examples
)
FlagName
=
'CAF_ENABLE_EXAMPLES'
;;
/
*
)
io-module
)
FlagName
=
'CAF_ENABLE_IO_MODULE'
;;
#absolute path given
testing
)
FlagName
=
'CAF_ENABLE_TESTING'
;;
absolute_builddir
=
"
$builddir
"
tools
)
FlagName
=
'CAF_ENABLE_TOOLS'
;;
;;
with-exceptions
)
FlagName
=
'CAF_ENABLE_WITH_EXCEPTIONS'
;;
*
)
*
)
# relative path given; convert to absolute path
echo
"Invalid flag '
$1
'. Try
$0
--help to see available options."
absolute_builddir
=
"
$PWD
/
$builddir
"
exit
1
;;
;;
esac
esac
echo
"append_cache_entry
$FlagName
BOOL
$2
"
if
[
-n
"
$2
"
]
;
then
append_cache_entry
$FlagName
BOOL
$2
workdir
=
"
$absolute_builddir
-
$2
"
else
workdir
=
"
$absolute_builddir
"
fi
workdirs
=
"
$workdirs
$workdir
"
if
[
-n
"
$3
"
]
;
then
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH
"
$3
"
else
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH
"
$workdir
/bin"
fi
if
[
-n
"
$4
"
]
;
then
append_cache_entry LIBRARY_OUTPUT_PATH PATH
"
$4
"
else
append_cache_entry LIBRARY_OUTPUT_PATH PATH
"
$workdir
/lib"
fi
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
"
$CMakeCommand
"
-G
"
$5
"
$CMakeCacheEntries
"
$sourcedir
"
else
"
$CMakeCommand
"
$CMakeCacheEntries
"
$sourcedir
"
fi
printf
"#!/bin/sh
\n\n
"
>
config.status
printf
"# Switch to the source of this build directory.
\n
"
>>
config.status
printf
"cd
\"
$sourcedir
\"\n\n
"
>>
config.status
printf
"# Invoke the command to configure this build.
\n
"
>>
config.status
if
[
-n
"
$CC
"
]
;
then
printf
"CC=
\"
%s
\"\n
"
"
$CC
"
>>
config.status
fi
if
[
-n
"
$CXX
"
]
;
then
printf
"CXX=
\"
%s
\"\n
"
"
$CXX
"
>>
config.status
fi
if
[
-n
"
$CXXFLAGS
"
]
;
then
printf
"CXXFLAGS=
\"
%s
\"\n
"
"
$CXXFLAGS
"
>>
config.status
fi
if
[
-n
"
$LDFLAGS
"
]
;
then
printf
"LDFLAGS=
\"
%s
\"\n
"
"
$LDFLAGS
"
>>
config.status
fi
echo
$command
>>
config.status
chmod
u+x config.status
}
}
# Set defaults.
# Set defaults.
builddir
=
"
$sourced
ir
/build"
CMakeBuildDir
=
"
$SourceD
ir
/build"
CMakeCacheEntries
=
""
CMakeCacheEntries
=
""
append_cache_entry CMAKE_INSTALL_PREFIX PATH /usr/local
append_cache_entry CAF_ENABLE_RUNTIME_CHECKS BOOL
false
# parse custom environment variable to initialize CMakeGenerator
# Parse user input.
if
[
-n
"
$CMAKE_GENERATOR
"
]
;
then
CMakeGenerator
=
"
$CMAKE_GENERATOR
"
fi
# Parse arguments.
while
[
$#
-ne
0
]
;
do
while
[
$#
-ne
0
]
;
do
# Fetch the option argument.
case
"
$1
"
in
case
"
$1
"
in
-
*
=
*
)
optarg
=
`
echo
"
$1
"
|
sed
's/[-_a-zA-Z0-9]*=//'
`
;;
--
*
=
*
)
optarg
=
`
echo
"
$1
"
|
sed
's/[-_a-zA-Z0-9]*=//'
`
;;
*
)
optarg
=
;;
--enable-
*
)
optarg
=
`
echo
"
$1
"
|
sed
's/--enable-//'
`
;;
--disable-
*
)
optarg
=
`
echo
"
$1
"
|
sed
's/--disable-//'
`
;;
*
)
echo
"Invalid syntax '
$1
'. Try
$0
--help to see available options."
exit
1
;;
esac
esac
# Consume current input.
case
"
$1
"
in
case
"
$1
"
in
--help
|
-h
)
--help
|
-h
)
echo
"
${
usage
}
"
1>&2
echo
"
${
usage
}
"
1>&2
...
@@ -213,139 +139,55 @@ while [ $# -ne 0 ]; do
...
@@ -213,139 +139,55 @@ while [ $# -ne 0 ]; do
--cmake
=
*
)
--cmake
=
*
)
CMakeCommand
=
"
$optarg
"
CMakeCommand
=
"
$optarg
"
;;
;;
--build-dir
=
*
)
CMakeBuildDir
=
"
$optarg
"
;;
--generator
=
*
)
--generator
=
*
)
CMakeGenerator
=
"
$optarg
"
CMakeGenerator
=
"
$optarg
"
;;
;;
--prefix
=
*
)
append_cache_entry CMAKE_INSTALL_PREFIX PATH
"
$optarg
"
;;
--with-runtime-checks
)
append_cache_entry CAF_ENABLE_RUNTIME_CHECKS BOOL
yes
;;
--with-sanitizers
=
*
)
append_cache_entry CAF_SANITIZERS STRING
"
$optarg
"
;;
--with-actor-profiler
)
append_cache_entry CAF_ENABLE_ACTOR_PROFILER BOOL
yes
;;
--no-memory-management
)
append_cache_entry CAF_NO_MEM_MANAGEMENT BOOL
yes
;;
--no-compiler-check
)
append_cache_entry CAF_NO_COMPILER_CHECK BOOL
yes
;;
--no-auto-libc
++
)
append_cache_entry CAF_NO_AUTO_LIBCPP BOOL
yes
;;
--no-exceptions
)
append_cache_entry CAF_NO_EXCEPTIONS BOOL
yes
;;
--force-no-exceptions
)
append_cache_entry CAF_NO_EXCEPTIONS BOOL
yes
append_cache_entry CAF_FORCE_NO_EXCEPTIONS BOOL
yes
;;
--sysroot
=
*
)
append_cache_entry CAF_OSX_SYSROOT PATH
"
$optarg
"
;;
--ios-min-ver
=
*
)
append_cache_entry CMAKE_OSX_ARCHITECTURES STRING
"
\$
(ARCHS_STANDARD_32_64_BIT)"
append_cache_entry CAF_IOS_DEPLOYMENT_TARGET STRING
"
$optarg
"
;;
--with-log-level
=
*
)
append_cache_entry CAF_LOG_LEVEL STRING
"
$optarg
"
;;
--with-clang
=
*
)
clang
=
"
$optarg
"
;;
--with-gcc
=
*
)
gcc
=
"
$optarg
"
;;
--with-qt-prefix
=
*
)
append_cache_entry CAF_QT_PREFIX_PATH STRING
"
$optarg
"
;;
--with-openssl
=
*
)
append_cache_entry OPENSSL_ROOT_DIR PATH
"
$optarg
"
;;
--build-type
=
*
)
--build-type
=
*
)
append_cache_entry CMAKE_BUILD_TYPE STRING
"
$optarg
"
CMakeBuildType
=
"
$optarg
"
;;
;;
--extra
-flags
=
*
)
--cxx
-flags
=
*
)
append_cache_entry CMAKE_CXX_FLAGS STRING
"
$optarg
"
append_cache_entry CMAKE_CXX_FLAGS STRING
"
$optarg
"
;;
;;
--build-dir
=
*
)
--prefix
=
*
)
builddir
=
"
$optarg
"
append_cache_entry CMAKE_INSTALL_PREFIX PATH
"
$optarg
"
;;
--bin-dir
=
*
)
bindir
=
"
$optarg
"
;;
--lib-dir
=
*
)
libdir
=
"
$optarg
"
;;
--dual-build
)
dualbuild
=
1
;;
--no-examples
)
append_cache_entry CAF_NO_EXAMPLES BOOL
yes
;;
--with-qt-examples
)
append_cache_entry CAF_BUILD_QT_EXAMPLES BOOL
yes
;;
--with-protobuf-examples
)
append_cache_entry CAF_BUILD_PROTOBUF_EXAMPLES BOOL
yes
;;
--no-curl-examples
)
append_cache_entry CAF_NO_CURL_EXAMPLES BOOL
yes
;;
--no-unit-tests
)
append_cache_entry CAF_NO_UNIT_TESTS BOOL
yes
;;
--no-openssl
)
append_cache_entry CAF_NO_OPENSSL BOOL
yes
;;
--build-static
)
append_cache_entry BUILD_SHARED_LIBS BOOL no
;;
--static-runtime
)
append_cache_entry CAF_BUILD_STATIC_RUNTIME BOOL
yes
;;
--no-tools
)
append_cache_entry CAF_NO_TOOLS BOOL
yes
;;
;;
--no-io
)
--log-level
=
*
)
append_cache_entry CAF_NO_IO BOOL
yes
append_cache_entry CAF_LOG_LEVEL STRING
"
$optarg
"
;;
;;
--no-summary
)
--sanitizers
=
*
)
append_cache_entry CAF_NO_SUMMARY BOOL
yes
append_cache_entry CAF_SANITIZERS STRING
"
$optarg
"
;;
;;
--libs-only
)
--dev-mode
)
for
var
in
CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS
;
do
append_cache_entry CAF_LOG_LEVEL STRING
"
$optarg
"
append_cache_entry
$var
BOOL
yes
CMakeBuildType
=
'Debug'
done
append_cache_entry CAF_LOG_LEVEL STRING
'TRACE'
append_cache_entry CAF_SANITIZERS STRING
'address,undefined'
set_build_flag examples OFF
set_build_flag tools OFF
set_build_flag utility-targets ON
set_build_flag runtime-checks ON
;;
;;
--core-only
)
--enable-
*
)
for
var
in
CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS CAF_NO_IO CAF_NO_OPENSSL
;
do
set_build_flag
$optarg
ON
append_cache_entry
$var
BOOL
yes
done
;;
;;
--dev-mode
)
--disable-
*
)
for
var
in
CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_ENABLE_RUNTIME_CHECKS
;
do
set_build_flag
$optarg
OFF
append_cache_entry
$var
BOOL
yes
done
append_cache_entry CMAKE_BUILD_TYPE STRING Debug
append_cache_entry CAF_LOG_LEVEL STRING TRACE
append_cache_entry CAF_SANITIZERS STRING address,undefined
;;
;;
*
)
*
)
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
exit
1
exit
1
;;
;;
esac
esac
# Get next input.
shift
shift
done
done
# Check for `cmake` command.
# Check for `cmake` command.
if
[
-z
"
$CMakeCommand
"
]
;
then
if
[
-z
"
$CMakeCommand
"
]
;
then
# prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL)
# Prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL).
if
command
-v
cmake3
>
/dev/null 2>&1
;
then
if
command
-v
cmake3
>
/dev/null 2>&1
;
then
CMakeCommand
=
"cmake3"
CMakeCommand
=
"cmake3"
elif
command
-v
cmake
>
/dev/null 2>&1
;
then
elif
command
-v
cmake
>
/dev/null 2>&1
;
then
...
@@ -354,34 +196,50 @@ if [ -z "$CMakeCommand" ]; then
...
@@ -354,34 +196,50 @@ if [ -z "$CMakeCommand" ]; then
echo
"This package requires CMake, please install it first."
echo
"This package requires CMake, please install it first."
echo
"Then you may use this script to configure the CMake build."
echo
"Then you may use this script to configure the CMake build."
echo
"Note: pass --cmake=PATH to use cmake in non-standard locations."
echo
"Note: pass --cmake=PATH to use cmake in non-standard locations."
exit
1
;
exit
1
fi
fi
fi
fi
# At this point we save the global CMake variables so that configure() can
# Make sure the build directory is an absolute path.
# later use them.
case
"
$CMakeBuildDir
"
in
CMakeDefaultCache
=
$CMakeCacheEntries
/
*
)
CMakeAbsoluteBuildDir
=
"
$CMakeBuildDir
"
;;
*
)
CMakeAbsoluteBuildDir
=
"
$PWD
/
$CMakeBuildDir
"
;;
esac
if
[
-n
"
$dualbuild
"
]
;
then
# If a build directory exists, delete any existing cache to have a clean build.
# Use what we got in $PATH if --with-clang or --with-gcc is not specified.
if
[
-d
"
$CMakeAbsoluteBuildDir
"
]
;
then
if
[
-z
"
$clang
"
]
;
then
if
[
-f
"
$CMakeAbsoluteBuildDir
/CMakeCache.txt"
]
;
then
clang
=
clang++
rm
-f
"
$CMakeAbsoluteBuildDir
/CMakeCache.txt"
fi
if
[
-z
"
$gcc
"
]
;
then
gcc
=
g++
fi
fi
else
mkdir
-p
"
$CMakeAbsoluteBuildDir
"
fi
for
i
in
gcc clang
;
do
# Run CMake.
eval
"compiler=
\$
$i
"
cd
"
$CMakeAbsoluteBuildDir
"
configure
$compiler
$i
""
""
$CMakeGenerator
if
[
-n
"
$CMakeGenerator
"
]
;
then
done
"
$CMakeCommand
"
-G
"
$CMakeGenerator
"
$CMakeCacheEntries
"
$SourceDir
"
else
else
# Prefer Clang to GCC.
"
$CMakeCommand
"
$CMakeCacheEntries
"
$SourceDir
"
if
[
-n
"
$clang
"
]
;
then
fi
compiler
=
$clang
elif
[
-n
"
$gcc
"
]
;
then
compiler
=
$gcc
fi
configure
"
$compiler
"
""
"
$bindir
"
"
$libdir
"
"
$CMakeGenerator
"
# Generate a config.status file that allows re-running a clean build.
printf
"#!/bin/sh
\n\n
"
>
config.status
printf
"# Switch to the source of this build directory.
\n
"
>>
config.status
printf
"cd
\"
%s
\"\n\n
"
"
$CMakeAbsoluteBuildDir
"
>>
config.status
printf
"# Invoke the command to configure this build.
\n
"
>>
config.status
if
[
-n
"
$CXX
"
]
;
then
printf
"CXX=
\"
%s
\"\n
"
"
$CXX
"
>>
config.status
fi
if
[
-n
"
$CXXFLAGS
"
]
;
then
printf
"CXXFLAGS=
\"
%s
\"\n
"
"
$CXXFLAGS
"
>>
config.status
fi
if
[
-n
"
$LDFLAGS
"
]
;
then
printf
"LDFLAGS=
\"
%s
\"\n
"
"
$LDFLAGS
"
>>
config.status
fi
fi
echo
$Command
>>
config.status
chmod
u+x config.status
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