Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
430bedea
Commit
430bedea
authored
Feb 17, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CMake scaffold
parent
bd147156
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
843 additions
and
0 deletions
+843
-0
CMakeLists.txt
CMakeLists.txt
+439
-0
cmake/FindCAF.cmake
cmake/FindCAF.cmake
+121
-0
cmake/cmake_uninstall.cmake.in
cmake/cmake_uninstall.cmake.in
+24
-0
cmake/get_compiler_version.cpp
cmake/get_compiler_version.cpp
+17
-0
cmake/incubator-test.cpp
cmake/incubator-test.cpp
+1
-0
configure
configure
+241
-0
No files found.
CMakeLists.txt
0 → 100644
View file @
430bedea
# -- project setup -------------------------------------------------------------
cmake_minimum_required
(
VERSION 2.8.12
)
project
(
caf_incubator C CXX
)
# -- CMake includes for C/C++ features -----------------------------------------
include
(
CheckCSourceCompiles
)
include
(
CheckCSourceRuns
)
# -- set useful CMake options --------------------------------------------------
# Be nice to VIM users and Clang tools.
set
(
CMAKE_EXPORT_COMPILE_COMMANDS 1
)
# Silence policy CMP0042 warning by enabling RPATH explicitly.
if
(
APPLE AND NOT DEFINED CMAKE_MACOSX_RPATH
)
set
(
CMAKE_MACOSX_RPATH true
)
endif
()
# -- helper targets ------------------------------------------------------------
# Simplifies re-running configuration setup.
add_custom_target
(
configure COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/config.status
)
# -- check for static builds ---------------------------------------------------
# Shared libs are currently not supported on Windows.
if
(
WIN32 AND NOT CAF_BUILD_STATIC_ONLY
)
message
(
STATUS
"CAF currently only supports static-only builds on Windows"
)
set
(
CAF_BUILD_STATIC_ONLY yes
)
endif
()
if
(
CAF_BUILD_STATIC_RUNTIME
)
set
(
flags_configs
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL
)
foreach
(
flags
${
flags_configs
}
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
if
(
NOT
${
flags
}
MATCHES
"-static-libstdc
\\
+
\\
+"
)
set
(
${
flags
}
"
${${
flags
}}
-static-libstdc++"
)
endif
()
if
(
NOT
${
flags
}
MATCHES
"-static-libgcc"
)
set
(
${
flags
}
"
${${
flags
}}
-static-libgcc"
)
endif
()
elseif
(
MSVC
)
if
(
${
flags
}
MATCHES
"/MD"
)
string
(
REGEX REPLACE
"/MD"
"/MT"
${
flags
}
"
${${
flags
}}
"
)
endif
()
endif
()
endforeach
()
else
()
set
(
CAF_BUILD_STATIC_RUNTIME no
)
endif
()
# -- utility functions ---------------------------------------------------------
# Appends `str` to the variable named `var` with a whitespace as separator.
# Suppresses a leading whitespace if the variable is empty and does nothing if
# `str` is empty.
function
(
build_string var str
)
if
(
NOT str STREQUAL
""
)
if
(
"
${${
var
}}
"
STREQUAL
""
)
set
(
"
${
var
}
"
"
${
str
}
"
PARENT_SCOPE
)
else
()
set
(
"
${
var
}
"
"
${${
var
}}
${
str
}
"
PARENT_SCOPE
)
endif
()
endif
()
endfunction
(
build_string
)
# Forces `var` to 'no' if the content of the variables evaluates to false.
function
(
pretty_no var
)
if
(
NOT
"
${${
var
}}
"
)
set
(
"
${
var
}
"
no PARENT_SCOPE
)
endif
()
endfunction
(
pretty_no
)
# Forces `var` to 'yes' if the content of the variables evaluates to false.
function
(
pretty_yes var
)
if
(
"
${${
var
}}
"
)
set
(
"
${
var
}
"
yes PARENT_SCOPE
)
endif
()
endfunction
(
pretty_yes
)
# -- binary and library path setup ---------------------------------------------
# Prohibit in-source builds.
if
(
CMAKE_CURRENT_SOURCE_DIR STREQUAL
"
${
CMAKE_CURRENT_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 module path appropriately.
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
# Set binary output path if not defined by user.
if
(
EXECUTABLE_OUTPUT_PATH STREQUAL
""
)
set
(
EXECUTABLE_OUTPUT_PATH
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin"
)
endif
()
# Set library output path if not defined by user, but always set library output
# path to binary output path for Xcode projects.
if
(
CMAKE_GENERATOR STREQUAL
"Xcode"
)
set
(
LIBRARY_OUTPUT_PATH
"
${
EXECUTABLE_OUTPUT_PATH
}
"
)
elseif
(
LIBRARY_OUTPUT_PATH STREQUAL
""
)
set
(
LIBRARY_OUTPUT_PATH
"
${
CMAKE_CURRENT_BINARY_DIR
}
/lib"
)
endif
()
# -- get dependencies ----------------------------------------------------------
find_package
(
CAF COMPONENTS core io test
)
# -- compiler setup ------------------------------------------------------------
# Check for g++ >= 4.8 or clang++ > = 3.2.
if
(
NOT WIN32 AND NOT CAF_NO_COMPILER_CHECK AND NOT CMAKE_CROSSCOMPILING
)
try_run
(
ProgramResult
CompilationSucceeded
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/get_compiler_version.cpp"
RUN_OUTPUT_VARIABLE CompilerVersion
)
if
(
NOT CompilationSucceeded OR NOT ProgramResult EQUAL 0
)
message
(
FATAL_ERROR
"Cannot determine compiler version"
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
if
(
CompilerVersion VERSION_GREATER 4.7
)
message
(
STATUS
"Found g++ version
${
CompilerVersion
}
"
)
else
()
message
(
FATAL_ERROR
"g++ >= 4.8 required (found:
${
CompilerVersion
}
)"
)
endif
()
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
if
(
CompilerVersion VERSION_GREATER 3.1
)
message
(
STATUS
"Found clang++ version
${
CompilerVersion
}
"
)
else
()
message
(
FATAL_ERROR
"clang++ >= 3.2 required (found:
${
CompilerVersion
}
)"
)
endif
()
else
()
message
(
FATAL_ERROR
"Your C++ compiler does not support C++11 "
"or is not supported"
)
endif
()
endif
()
# Enable a ton of warnings if --more-clang-warnings is used.
if
(
CAF_MORE_WARNINGS
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
set
(
WFLAGS
"-Weverything -Wno-c++98-compat -Wno-padded "
"-Wno-documentation-unknown-command -Wno-exit-time-destructors "
"-Wno-global-constructors -Wno-missing-prototypes "
"-Wno-c++98-compat-pedantic -Wno-unused-member-function "
"-Wno-unused-const-variable -Wno-switch-enum "
"-Wno-abstract-vbase-init -Wno-shadow "
"-Wno-missing-noreturn -Wno-covered-switch-default"
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
set
(
WFLAGS
"-Waddress -Wall -Warray-bounds "
"-Wattributes -Wbuiltin-macro-redefined -Wcast-align "
"-Wcast-qual -Wchar-subscripts -Wclobbered -Wcomment "
"-Wconversion -Wconversion-null -Wcoverage-mismatch "
"-Wcpp -Wdelete-non-virtual-dtor -Wdeprecated "
"-Wdeprecated-declarations -Wdiv-by-zero -Wdouble-promotion "
"-Wempty-body -Wendif-labels -Wenum-compare -Wextra "
"-Wfloat-equal -Wformat -Wfree-nonheap-object "
"-Wignored-qualifiers -Winit-self "
"-Winline -Wint-to-pointer-cast -Winvalid-memory-model "
"-Winvalid-offsetof -Wlogical-op -Wmain -Wmaybe-uninitialized "
"-Wmissing-braces -Wmultichar "
"-Wnarrowing -Wnoexcept -Wnon-template-friend "
"-Wnon-virtual-dtor -Wnonnull -Woverflow "
"-Woverlength-strings -Wparentheses "
"-Wpmf-conversions -Wpointer-arith -Wreorder "
"-Wreturn-type -Wsequence-point "
"-Wsign-compare -Wswitch -Wtype-limits -Wundef "
"-Wuninitialized -Wunused -Wvla -Wwrite-strings"
)
endif
()
# convert CMake list to a single string, erasing the ";" separators
string
(
REPLACE
";"
""
WFLAGS_STR
${
WFLAGS
}
)
build_string
(
"EXTRA_FLAGS"
"
${
WFLAGS_STR
}
"
)
endif
()
# Add -stdlib=libc++ when using Clang if possible.
if
(
NOT CAF_NO_AUTO_LIBCPP AND CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
set
(
CXXFLAGS_BACKUP
"
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -stdlib=libc++"
)
try_run
(
ProgramResult
CompilationSucceeded
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/get_compiler_version.cpp"
RUN_OUTPUT_VARIABLE CompilerVersion
)
if
(
NOT CompilationSucceeded OR NOT ProgramResult EQUAL 0
)
message
(
STATUS
"Use clang with GCC's libstdc++"
)
else
()
message
(
STATUS
"Automatically added '-stdlib=libc++' flag "
"(set CAF_NO_AUTO_LIBCPP to suppress this)"
)
build_string
(
"EXTRA_FLAGS"
"-stdlib=libc++"
)
endif
()
# restore CXX flags
set
(
CMAKE_CXX_FLAGS
"
${
CXXFLAGS_BACKUP
}
"
)
endif
()
# Enable ASAN if requested by the user.
if
(
CAF_ENABLE_ADDRESS_SANITIZER AND NOT WIN32
)
# check whether address sanitizer is available
set
(
CXXFLAGS_BACKUP
"
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"-fsanitize=address -fno-omit-frame-pointer"
)
try_run
(
ProgramResult
CompilationSucceeded
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/get_compiler_version.cpp"
)
if
(
NOT CompilationSucceeded
)
message
(
FATAL_ERROR
"ASAN not available on selected compiler"
)
else
()
message
(
STATUS
"Enable Address Sanitizer"
)
build_string
(
"EXTRA_FLAGS"
"-fsanitize=address -fno-omit-frame-pointer"
)
endif
()
# restore CXX flags
set
(
CMAKE_CXX_FLAGS
"
${
CXXFLAGS_BACKUP
}
"
)
endif
()
# -pthread is ignored on MacOSX but required on other platforms
if
(
NOT APPLE AND NOT WIN32
)
build_string
(
"EXTRA_FLAGS"
"-pthread"
)
endif
()
# -fPIC generates warnings on MinGW and Cygwin plus extra setup steps needed on MinGW
if
(
MINGW
)
add_definitions
(
-D_WIN32_WINNT=0x0600
)
add_definitions
(
-DWIN32
)
include
(
GenerateExportHeader
)
list
(
APPEND CAF_EXTRA_LDFLAGS -lws2_32 -liphlpapi -lpsapi
)
# build static to avoid runtime dependencies to GCC libraries
build_string
(
"EXTRA_FLAGS"
"-static"
)
elseif
(
CYGWIN
)
build_string
(
"EXTRA_FLAGS"
"-U__STRICT_ANSI__"
)
else
()
build_string
(
"EXTRA_FLAGS"
"-fPIC"
)
endif
()
# Add Windows-specific linker flags.
if
(
WIN32
)
list
(
APPEND CAF_EXTRA_LDFLAGS ws2_32 iphlpapi
)
endif
()
# Support macOS/iOS-specific magic.
if
(
CAF_OSX_SYSROOT
)
set
(
CMAKE_OSX_SYSROOT
"
${
CAF_OSX_SYSROOT
}
"
)
endif
()
# Add iOS target if requested by user.
if
(
CAF_IOS_DEPLOYMENT_TARGET
)
if
(
CAF_OSX_SYSROOT STREQUAL
"iphonesimulator"
)
build_string
(
"EXTRA_FLAGS"
"-mios-simulator-version-min=
${
CAF_IOS_DEPLOYMENT_TARGET
}
"
)
else
()
build_string
(
"EXTRA_FLAGS"
"-miphoneos-version-min=
${
CAF_IOS_DEPLOYMENT_TARGET
}
"
)
endif
()
endif
()
# -- check if the user provided CXXFLAGS, set defaults otherwise ---------------
if
(
NOT CMAKE_CXX_FLAGS
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic
${
EXTRA_FLAGS
}
"
)
endif
()
if
(
NOT
"
${
CMAKE_CXX_FLAGS
}
"
MATCHES
"-std="
)
message
(
STATUS
"Supplied CXXFLAGS do not contain a C++ standard, setting std to c++11"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
endif
()
if
(
NOT CMAKE_CXX_FLAGS_DEBUG
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"-O0 -g"
)
endif
()
if
(
NOT CMAKE_CXX_FLAGS_MINSIZEREL
)
set
(
CMAKE_CXX_FLAGS_MINSIZEREL
"-Os"
)
endif
()
if
(
NOT CMAKE_CXX_FLAGS_RELEASE
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3 -DNDEBUG"
)
endif
()
if
(
NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O2 -g -fno-omit-frame-pointer"
)
endif
()
if
(
NOT CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE RelWithDebInfo
)
endif
()
# needed by subprojects
if
(
DEFINED CMAKE_LD_LIBS
)
list
(
APPEND
${
CMAKE_LD_LIBS
}
)
endif
()
# -- install targets -----------------------------------------------------------
# Process cmake_uninstall.cmake.in.
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/cmake_uninstall.cmake.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
# Add uninstall target.
add_custom_target
(
uninstall
COMMAND
"
${
CMAKE_COMMAND
}
"
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
# -- utility macro for adding unit tests ---------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
enable_testing
()
macro
(
add_unit_tests globstr
)
file
(
GLOB_RECURSE tests
"
${
globstr
}
"
)
set
(
CAF_ALL_UNIT_TESTS
${
CAF_ALL_UNIT_TESTS
}
${
tests
}
)
endmacro
()
else
()
macro
(
add_unit_tests globstr
)
# do nothing (unit tests disabled)
endmacro
()
endif
()
# -- add targets ---------------------------------------------------------------
include_directories
(
"
${
CAF_INCLUDE_DIRS
}
"
)
macro
(
add_caf_lib name header_only
)
string
(
TOUPPER
${
name
}
upper_name
)
set
(
full_name libcaf_
${
name
}
)
add_subdirectory
(
${
full_name
}
)
# if (NOT header_only)
# set(shared_target ${full_name}_shared)
# set(static_target ${full_name}_static)
# set(lib_varname CAF_LIBRARY_${upper_name})
# set(lib_varname_static ${lib_varname}_STATIC)
# if(NOT CAF_BUILD_STATIC_ONLY)
# set(${lib_varname} ${shared_target})
# set(CAF_LIBRARIES ${CAF_LIBRARIES} ${shared_target})
# else()
# set(${lib_varname} ${static_target})
# set(CAF_LIBRARIES ${CAF_LIBRARIES} ${static_target})
# endif()
# if(CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC)
# set(${lib_varname_static} ${static_target})
# endif()
# endif()
add_unit_tests
(
"
${
full_name
}
/test/*.cpp"
)
# add headers to include directories so other subprojects can use them
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/libcaf_
${
name
}
"
)
endmacro
()
add_caf_lib
(
bb yes
)
# -- unit tests setup ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
# setup unit test binary
add_executable
(
incubator-test
"cmake/incubator-test.cpp"
${
CAF_ALL_UNIT_TESTS
}
)
target_link_libraries
(
incubator-test
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
)
add_custom_target
(
all_unit_tests
)
add_dependencies
(
incubator-test all_unit_tests
)
# enumerate all test suites.
foreach
(
test
${
CAF_ALL_UNIT_TESTS
}
)
file
(
STRINGS
${
test
}
contents
)
foreach
(
line
${
contents
}
)
if
(
"
${
line
}
"
MATCHES
"CAF_SUITE (.*)"
)
string
(
REGEX REPLACE
".* CAF_SUITE (.*)"
"
\\
1"
suite
${
line
}
)
list
(
APPEND suites
${
suite
}
)
endif
()
endforeach
()
endforeach
()
list
(
REMOVE_DUPLICATES suites
)
# creates one CMake test per test suite.
macro
(
make_test suite
)
string
(
REPLACE
" "
"_"
test_name
${
suite
}
)
set
(
caf_test
${
EXECUTABLE_OUTPUT_PATH
}
/incubator-test
)
add_test
(
${
test_name
}
${
caf_test
}
-r 300 -n -v 5 -s
"
${
suite
}
"
${
ARGN
}
)
endmacro
()
list
(
LENGTH suites num_suites
)
message
(
STATUS
"Found
${
num_suites
}
test suites"
)
foreach
(
suite
${
suites
}
)
make_test
(
"
${
suite
}
"
)
endforeach
()
endif
()
# -- print summary -------------------------------------------------------------
# Inverts a boolean.
macro
(
invertYesNo in out
)
if
(
${
in
}
)
set
(
${
out
}
no
)
else
()
set
(
${
out
}
yes
)
endif
()
endmacro
()
# Invert CAF_NO_* variables for nicer output.
invertYesNo
(
CAF_NO_UNIT_TESTS CAF_BUILD_UNIT_TESTS
)
# Collect all compiler flags.
string
(
TOUPPER
"
${
CMAKE_BUILD_TYPE
}
"
UPPER_BUILD_TYPE
)
set
(
ALL_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
CMAKE_CXX_FLAGS_
${
UPPER_BUILD_TYPE
}}
"
)
set
(
ALL_LD_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
${
CAF_EXTRA_LDFLAGS
}
"
)
string
(
STRIP
"
${
ALL_LD_FLAGS
}
"
ALL_LD_FLAGS
)
# Print summary.
if
(
NOT CAF_NO_SUMMARY
)
message
(
STATUS
"
\n
====================| Build Summary |===================="
"
\n
"
"
\n
Build type:
${
CMAKE_BUILD_TYPE
}
"
"
\n
Build static:
${
CAF_BUILD_STATIC
}
"
"
\n
Build static only:
${
CAF_BUILD_STATIC_ONLY
}
"
"
\n
Build static runtime:
${
CAF_BUILD_STATIC_RUNTIME
}
"
"
\n
"
"
\n
CXX:
${
CMAKE_CXX_COMPILER
}
"
"
\n
CXXFLAGS:
${
ALL_CXX_FLAGS
}
"
"
\n
LINKER_FLAGS (shared):
${
ALL_LD_FLAGS
}
"
"
\n
"
"
\n
Source directory:
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
\n
Build directory:
${
CMAKE_CURRENT_BINARY_DIR
}
"
"
\n
Executable path:
${
EXECUTABLE_OUTPUT_PATH
}
"
"
\n
Library path:
${
LIBRARY_OUTPUT_PATH
}
"
"
\n
Install prefix:
${
CMAKE_INSTALL_PREFIX
}
"
"
\n
Generator:
${
CMAKE_GENERATOR
}
"
"
\n
"
"
\n
===========================================================
\n
"
)
endif
()
cmake/FindCAF.cmake
0 → 100644
View file @
430bedea
# Try to find CAF headers and libraries.
#
# Use this module as follows:
#
# find_package(CAF [COMPONENTS <core|io|opencl|...>*] [REQUIRED])
#
# Variables used by this module (they can change the default behaviour and need
# to be set before calling find_package):
#
# CAF_ROOT_DIR Set this variable either to an installation prefix or to wa
# CAF build directory where to look for the CAF libraries.
#
# Variables defined by this module:
#
# CAF_FOUND System has CAF headers and library
# CAF_LIBRARIES List of library files for all components
# CAF_INCLUDE_DIRS List of include paths for all components
# CAF_LIBRARY_$C Library file for component $C
# CAF_INCLUDE_DIR_$C Include path for component $C
if
(
CAF_FIND_COMPONENTS STREQUAL
""
)
message
(
FATAL_ERROR
"FindCAF requires at least one COMPONENT."
)
endif
()
# iterate over user-defined components
foreach
(
comp
${
CAF_FIND_COMPONENTS
}
)
# we use uppercase letters only for variable names
string
(
TOUPPER
"
${
comp
}
"
UPPERCOMP
)
if
(
"
${
comp
}
"
STREQUAL
"core"
)
set
(
HDRNAME
"caf/all.hpp"
)
elseif
(
"
${
comp
}
"
STREQUAL
"test"
)
set
(
HDRNAME
"caf/test/unit_test.hpp"
)
else
()
set
(
HDRNAME
"caf/
${
comp
}
/all.hpp"
)
endif
()
if
(
CAF_ROOT_DIR
)
set
(
header_hints
"
${
CAF_ROOT_DIR
}
/include"
"
${
CAF_ROOT_DIR
}
/libcaf_
${
comp
}
"
"
${
CAF_ROOT_DIR
}
/../libcaf_
${
comp
}
"
"
${
CAF_ROOT_DIR
}
/../../libcaf_
${
comp
}
"
)
endif
()
find_path
(
CAF_INCLUDE_DIR_
${
UPPERCOMP
}
NAMES
${
HDRNAME
}
HINTS
${
header_hints
}
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${
CMAKE_INSTALL_PREFIX
}
/include
)
mark_as_advanced
(
CAF_INCLUDE_DIR_
${
UPPERCOMP
}
)
if
(
NOT
"
${
CAF_INCLUDE_DIR_
${
UPPERCOMP
}}
"
STREQUAL
"CAF_INCLUDE_DIR_
${
UPPERCOMP
}
-NOTFOUND"
)
# mark as found (set back to false when missing library or build header)
set
(
CAF_
${
comp
}
_FOUND true
)
# check for CMake-generated build header for the core component
if
(
"
${
comp
}
"
STREQUAL
"core"
)
find_path
(
caf_build_header_path
NAMES
caf/detail/build_config.hpp
HINTS
${
header_hints
}
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${
CMAKE_INSTALL_PREFIX
}
/include
)
if
(
"
${
caf_build_header_path
}
"
STREQUAL
"caf_build_header_path-NOTFOUND"
)
message
(
WARNING
"Found all.hpp for CAF core, but not build_config.hpp"
)
set
(
CAF_
${
comp
}
_FOUND false
)
else
()
list
(
APPEND CAF_INCLUDE_DIRS
"
${
caf_build_header_path
}
"
)
endif
()
endif
()
list
(
APPEND CAF_INCLUDE_DIRS
"
${
CAF_INCLUDE_DIR_
${
UPPERCOMP
}}
"
)
# look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs
# skip probe_event as it is header only
if
(
NOT
${
comp
}
STREQUAL
"probe_event"
AND NOT
${
comp
}
STREQUAL
"test"
)
if
(
CAF_ROOT_DIR
)
set
(
library_hints
"
${
CAF_ROOT_DIR
}
/lib"
)
endif
()
find_library
(
CAF_LIBRARY_
${
UPPERCOMP
}
NAMES
"caf_
${
comp
}
"
"caf_
${
comp
}
_static"
HINTS
${
library_hints
}
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
${
CMAKE_INSTALL_PREFIX
}
/lib
)
mark_as_advanced
(
CAF_LIBRARY_
${
UPPERCOMP
}
)
if
(
"
${
CAF_LIBRARY_
${
UPPERCOMP
}}
"
STREQUAL
"CAF_LIBRARY_
${
UPPERCOMP
}
-NOTFOUND"
)
set
(
CAF_
${
comp
}
_FOUND false
)
else
()
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
${
CAF_LIBRARY_
${
UPPERCOMP
}}
)
endif
()
endif
()
endif
()
endforeach
()
if
(
DEFINED CAF_INCLUDE_DIRS
)
list
(
REMOVE_DUPLICATES CAF_INCLUDE_DIRS
)
endif
()
# let CMake check whether all requested components have been found
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
CAF
FOUND_VAR CAF_FOUND
REQUIRED_VARS CAF_LIBRARIES CAF_INCLUDE_DIRS
HANDLE_COMPONENTS
)
# final step to tell CMake we're done
mark_as_advanced
(
CAF_ROOT_DIR
CAF_LIBRARIES
CAF_INCLUDE_DIRS
)
cmake/cmake_uninstall.cmake.in
0 → 100644
View file @
430bedea
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest:
\"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing
\"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
cmake/get_compiler_version.cpp
0 → 100644
View file @
430bedea
#include <iostream>
using
namespace
std
;
int
main
()
{
# ifdef __clang__
cout
<<
__clang_major__
<<
"."
<<
__clang_minor__
;
# elif defined(__GNUC__)
cout
<<
__GNUC__
<<
"."
<<
__GNUC_MINOR__
;
# else
cout
<<
"0.0"
;
# endif
return
0
;
}
cmake/incubator-test.cpp
0 → 100644
View file @
430bedea
#include "caf/test/unit_test_impl.hpp"
configure
0 → 100755
View file @
430bedea
#!/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
$*
"
dirname_0
=
`
dirname
$0
`
sourcedir
=
`
cd
$dirname_0
&&
pwd
`
usage
=
"
\
Usage:
$0
[OPTION]... [VAR=VALUE]...
Build Options:
--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
--build-dir=DIR place build files in directory [build]
--bin-dir=DIR executable directory [build/bin]
--lib-dir=DIR library directory [build/lib]
--build-static build as static and shared library
--build-static-only build as static library only
--static-runtime build with static C++ runtime
--more-warnings enables most warnings
--no-compiler-check disable compiler version check
--no-auto-libc++ do not automatically enable libc++ for Clang
Required packages in non-standard locations:
--with-caf=PATH path to CAF install root or build directory
Installation Directories:
--prefix=PREFIX installation directory [/usr/local]
Debugging:
--enable-asan build with address sanitizer
Convenience options:
--dev-mode sets --build-type=debug and --enable-asan
Influential Environment Variables (only on first invocation):
CXX C++ compiler command
CXXFLAGS C++ compiler flags (overrides defaults)
LDFLAGS Additional linker flags
CMAKE_GENERATOR Selects a custom generator
Python Build Options:
--with-python-config=FILE Use python-conf binary to determine includes and libs
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.
# $1 is the cache entry variable name
# $2 is the cache entry variable type
# $3 is the cache entry variable value
append_cache_entry
()
{
case
"
$3
"
in
*
\
*
)
# string contains whitespace
CMakeCacheEntries
=
"
$CMakeCacheEntries
-D
\"
$1
:
$2
=
$3
\"
"
;;
*
)
# string contains whitespace
CMakeCacheEntries
=
"
$CMakeCacheEntries
-D
$1
:
$2
=
$3
"
;;
esac
}
# -- set defaults --------------------------------------------------------------
builddir
=
"
$sourcedir
/build"
CMakeCacheEntries
=
""
append_cache_entry CMAKE_INSTALL_PREFIX PATH /usr/local
# -- parse custom environment variables ----------------------------------------
if
[
-n
"
$CMAKE_GENERATOR
"
]
;
then
CMakeGenerator
=
"
$CMAKE_GENERATOR
"
fi
# -- 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
;;
--generator
=
*
)
CMakeGenerator
=
"
$optarg
"
;;
--prefix
=
*
)
append_cache_entry CMAKE_INSTALL_PREFIX PATH
"
$optarg
"
;;
--enable-asan
)
append_cache_entry CAF_ENABLE_ADDRESS_SANITIZER BOOL
yes
;;
--more-warnings
)
append_cache_entry CAF_MORE_WARNINGS 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
;;
--with-caf
=
*
)
append_cache_entry CAF_ROOT_DIR PATH
"
$optarg
"
;;
--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
"
;;
--build-type
=
*
)
append_cache_entry CMAKE_BUILD_TYPE STRING
"
$optarg
"
;;
--extra-flags
=
*
)
append_cache_entry EXTRA_FLAGS STRING
"
$optarg
"
;;
--build-dir
=
*
)
builddir
=
"
$optarg
"
;;
--bin-dir
=
*
)
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH
"
$optarg
"
;;
--lib-dir
=
*
)
append_cache_entry LIBRARY_OUTPUT_PATH PATH
"
$optarg
"
;;
--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-opencl
)
append_cache_entry CAF_NO_OPENCL BOOL
yes
;;
--no-openssl
)
append_cache_entry CAF_NO_OPENSSL BOOL
yes
;;
--build-static
)
append_cache_entry CAF_BUILD_STATIC BOOL
yes
;;
--build-static-only
)
append_cache_entry CAF_BUILD_STATIC_ONLY BOOL
yes
;;
--static-runtime
)
append_cache_entry CAF_BUILD_STATIC_RUNTIME BOOL
yes
;;
--dev-mode
)
append_cache_entry CMAKE_BUILD_TYPE STRING Debug
append_cache_entry CAF_ENABLE_ADDRESS_SANITIZER BOOL
yes
;;
*
)
echo
"Invalid option '
$1
'. Try
$0
--help to see available options."
exit
1
;;
esac
shift
done
# -- CMake setup ---------------------------------------------------------------
CMakeDefaultCache
=
$CMakeCacheEntries
CMakeCacheEntries
=
$CMakeDefaultCache
# Set $workdir to the absolute path of $builddir.
case
"
$builddir
"
in
/
*
)
# Absolute path given
workdir
=
"
$builddir
"
;;
*
)
# Relative path given, convert to absolute path.
workdir
=
"
$PWD
/
$builddir
"
;;
esac
# Make sure the build directory exists but has no CMakeCache.txt in it.
if
[
-d
"
$workdir
"
]
;
then
if
[
-f
"
$workdir
/CMakeCache.txt"
]
;
then
rm
-f
"
$workdir
/CMakeCache.txt"
fi
else
mkdir
-p
"
$workdir
"
fi
cd
"
$workdir
"
if
[
-n
"
$CMakeGenerator
"
]
;
then
cmake
-G
"
$CMakeGenerator
"
$CMakeCacheEntries
"
$sourcedir
"
else
cmake
$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
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