Commit 71e7651e authored by Dominik Charousset's avatar Dominik Charousset

Cleanup CMake scaffold, remove python shell

parent f085334d
[submodule "libcaf_python/third_party/pybind"]
path = libcaf_python/third_party/pybind
url = https://github.com/pybind/pybind11.git
...@@ -8,8 +8,6 @@ option(BUILD_SHARED_LIBS "Build all modules as shared library" ON) ...@@ -8,8 +8,6 @@ option(BUILD_SHARED_LIBS "Build all modules as shared library" ON)
# -- includes ------------------------------------------------------------------ # -- includes ------------------------------------------------------------------
include(CMakePackageConfigHelpers) # For creating .cmake files include(CMakePackageConfigHelpers) # For creating .cmake files
include(CheckCXXSourceCompiles) # Check whether compiler works
include(CheckCXXSourceRuns) # Check whether compiler produces binaries
include(GNUInstallDirs) # Sets default install paths include(GNUInstallDirs) # Sets default install paths
include(GenerateExportHeader) # Auto-generates dllexport macros include(GenerateExportHeader) # Auto-generates dllexport macros
...@@ -240,7 +238,6 @@ pretty_no("CAF_ENABLE_RUNTIME_CHECKS") ...@@ -240,7 +238,6 @@ pretty_no("CAF_ENABLE_RUNTIME_CHECKS")
pretty_no("CAF_NO_MEM_MANAGEMENT") pretty_no("CAF_NO_MEM_MANAGEMENT")
pretty_no("CAF_NO_EXCEPTIONS") pretty_no("CAF_NO_EXCEPTIONS")
pretty_no("CAF_NO_OPENSSL") pretty_no("CAF_NO_OPENSSL")
pretty_no("CAF_NO_PYTHON")
pretty_no("CAF_NO_TOOLS") pretty_no("CAF_NO_TOOLS")
pretty_no("CAF_NO_SUMMARY") pretty_no("CAF_NO_SUMMARY")
...@@ -248,7 +245,6 @@ if(NOT CAF_NO_IO) ...@@ -248,7 +245,6 @@ if(NOT CAF_NO_IO)
set(CAF_NO_IO no) set(CAF_NO_IO no)
else() else()
set(CAF_NO_TOOLS yes) set(CAF_NO_TOOLS yes)
set(CAF_NO_PYTHON yes)
endif() endif()
################################################################################ ################################################################################
...@@ -499,11 +495,6 @@ if(NOT CAF_NO_OPENSSL) ...@@ -499,11 +495,6 @@ if(NOT CAF_NO_OPENSSL)
endif(OPENSSL_FOUND) endif(OPENSSL_FOUND)
endif() endif()
# build Python binding if not being told otherwise
if(NOT CAF_NO_PYTHON AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libcaf_python/CMakeLists.txt")
add_subdirectory(libcaf_python)
endif()
# build examples if not being told otherwise # build examples if not being told otherwise
add_optional_caf_binaries(examples) add_optional_caf_binaries(examples)
...@@ -557,8 +548,11 @@ invertYesNo(CAF_NO_UNIT_TESTS CAF_BUILD_UNIT_TESTS) ...@@ -557,8 +548,11 @@ invertYesNo(CAF_NO_UNIT_TESTS CAF_BUILD_UNIT_TESTS)
invertYesNo(CAF_NO_EXCEPTIONS CAF_BUILD_WITH_EXCEPTIONS) invertYesNo(CAF_NO_EXCEPTIONS CAF_BUILD_WITH_EXCEPTIONS)
invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT) invertYesNo(CAF_NO_MEM_MANAGEMENT CAF_BUILD_MEM_MANAGEMENT)
invertYesNo(CAF_NO_OPENSSL CAF_BUILD_OPENSSL) invertYesNo(CAF_NO_OPENSSL CAF_BUILD_OPENSSL)
invertYesNo(CAF_NO_PYTHON CAF_BUILD_PYTHON) if(GENERATOR_IS_MULTI_CONFIG)
get_property(all_cxx_flags DIRECTORY PROPERTY COMPILE_OPTIONS) set(summary_build_type "Multi-Config")
else()
set(summary_build_type "${CMAKE_BUILD_TYPE}")
endif()
# done # done
if(NOT CAF_NO_SUMMARY) if(NOT CAF_NO_SUMMARY)
message(STATUS message(STATUS
...@@ -566,7 +560,8 @@ if(NOT CAF_NO_SUMMARY) ...@@ -566,7 +560,8 @@ if(NOT CAF_NO_SUMMARY)
"\n" "\n"
"\nCAF version: ${CAF_VERSION}" "\nCAF version: ${CAF_VERSION}"
"\n" "\n"
"\nBuild type: ${CMAKE_BUILD_TYPE}" "\nCXX: ${CMAKE_CXX_COMPILER}"
"\nBuild type: ${summary_build_type}"
"\nLink type: ${LINK_TYPE}" "\nLink type: ${LINK_TYPE}"
"\nBuild static runtime: ${CAF_BUILD_STATIC_RUNTIME}" "\nBuild static runtime: ${CAF_BUILD_STATIC_RUNTIME}"
"\nRuntime checks: ${CAF_ENABLE_RUNTIME_CHECKS}" "\nRuntime checks: ${CAF_ENABLE_RUNTIME_CHECKS}"
...@@ -575,15 +570,11 @@ if(NOT CAF_NO_SUMMARY) ...@@ -575,15 +570,11 @@ if(NOT CAF_NO_SUMMARY)
"\nWith exceptions: ${CAF_BUILD_WITH_EXCEPTIONS}" "\nWith exceptions: ${CAF_BUILD_WITH_EXCEPTIONS}"
"\n" "\n"
"\nBuild I/O module: ${CAF_BUILD_IO}" "\nBuild I/O module: ${CAF_BUILD_IO}"
"\nBuild OpenSSL module: ${CAF_BUILD_OPENSSL}"
"\nBuild tools: ${CAF_BUILD_TOOLS}" "\nBuild tools: ${CAF_BUILD_TOOLS}"
"\nBuild examples: ${CAF_BUILD_EXAMPLES}" "\nBuild examples: ${CAF_BUILD_EXAMPLES}"
"\nBuild unit tests: ${CAF_BUILD_UNIT_TESTS}" "\nBuild unit tests: ${CAF_BUILD_UNIT_TESTS}"
"\nBuild OpenSSL: ${CAF_BUILD_OPENSSL}"
"\nBuild Python: ${CAF_BUILD_PYTHON}"
"\n" "\n"
"\nCXX: ${CMAKE_CXX_COMPILER}"
"\nCXXFLAGS: ${all_cxx_flags}"
"\nLINKER_FLAGS (shared) ${ALL_LD_FLAGS}"
"\n" "\n"
"\nSource directory: ${CMAKE_CURRENT_SOURCE_DIR}" "\nSource directory: ${CMAKE_CURRENT_SOURCE_DIR}"
"\nBuild directory: ${CMAKE_CURRENT_BINARY_DIR}" "\nBuild directory: ${CMAKE_CURRENT_BINARY_DIR}"
......
...@@ -49,10 +49,8 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -49,10 +49,8 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--no-openssl build without OpenSSL module --no-openssl build without OpenSSL module
--no-tools build without CAF tools such as caf-run --no-tools build without CAF tools such as caf-run
--no-io build without I/O module --no-io build without I/O module
--no-python build without python binding
--no-summary do not print configuration before building --no-summary do not print configuration before building
--libs-only sets no-examples, no-tools, no-python, --libs-only sets no-examples, no-tools and no-unit-tests
and no-unit-tests
--core-only same as libs-only but also adds sets --core-only same as libs-only but also adds sets
no-openssl, and no-io no-openssl, and no-io
...@@ -79,9 +77,6 @@ Usage: $0 [OPTION]... [VAR=VALUE]... ...@@ -79,9 +77,6 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
LDFLAGS Additional linker flags LDFLAGS Additional linker flags
CMAKE_GENERATOR Selects a custom generator 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): iOS Build Options (should be used with XCode generator):
--sysroot=DIR set system root for Clang --sysroot=DIR set system root for Clang
- iphoneos: for iOS device - iphoneos: for iOS device
...@@ -313,28 +308,22 @@ while [ $# -ne 0 ]; do ...@@ -313,28 +308,22 @@ while [ $# -ne 0 ]; do
--static-runtime) --static-runtime)
append_cache_entry CAF_BUILD_STATIC_RUNTIME BOOL yes append_cache_entry CAF_BUILD_STATIC_RUNTIME BOOL yes
;; ;;
--with-python-config=*)
append_cache_entry CAF_PYTHON_CONFIG_BIN FILEPATH "$optarg"
;;
--no-tools) --no-tools)
append_cache_entry CAF_NO_TOOLS BOOL yes append_cache_entry CAF_NO_TOOLS BOOL yes
;; ;;
--no-io) --no-io)
append_cache_entry CAF_NO_IO BOOL yes append_cache_entry CAF_NO_IO BOOL yes
;; ;;
--no-python)
append_cache_entry CAF_NO_PYTHON BOOL yes
;;
--no-summary) --no-summary)
append_cache_entry CAF_NO_SUMMARY BOOL yes append_cache_entry CAF_NO_SUMMARY BOOL yes
;; ;;
--libs-only) --libs-only)
for var in CAF_NO_TOOLS CAF_NO_PYTHON CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS; do for var in CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS; do
append_cache_entry $var BOOL yes append_cache_entry $var BOOL yes
done done
;; ;;
--core-only) --core-only)
for var in CAF_NO_TOOLS CAF_NO_PYTHON CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS CAF_NO_IO CAF_NO_OPENSSL ; do for var in CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_NO_UNIT_TESTS CAF_NO_IO CAF_NO_OPENSSL ; do
append_cache_entry $var BOOL yes append_cache_entry $var BOOL yes
done done
;; ;;
...@@ -342,7 +331,7 @@ while [ $# -ne 0 ]; do ...@@ -342,7 +331,7 @@ while [ $# -ne 0 ]; do
for var in CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_ENABLE_RUNTIME_CHECKS ; do for var in CAF_NO_TOOLS CAF_NO_EXAMPLES CAF_ENABLE_RUNTIME_CHECKS ; do
append_cache_entry $var BOOL yes append_cache_entry $var BOOL yes
done done
append_cache_entry CMAKE_BUILD_TYPE STRING debug append_cache_entry CMAKE_BUILD_TYPE STRING Debug
append_cache_entry CAF_LOG_LEVEL STRING TRACE append_cache_entry CAF_LOG_LEVEL STRING TRACE
append_cache_entry CAF_SANITIZERS STRING address,undefined append_cache_entry CAF_SANITIZERS STRING address,undefined
;; ;;
......
cmake_minimum_required(VERSION 2.8.12)
project(caf_cash CXX)
# check whether submodules are available
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/pybind/CMakeLists.txt")
message(STATUS "Pybind submodule not loaded, skip libcaf_python.")
set(CAF_NO_PYTHON yes)
else()
if(NOT "${CAF_PYTHON_CONFIG_BIN}" STREQUAL "")
execute_process(COMMAND "${CAF_PYTHON_CONFIG_BIN}" --includes
OUTPUT_VARIABLE PYTHON_INCLUDE_FLAGS)
string(STRIP "${PYTHON_INCLUDE_FLAGS}" PYTHON_INCLUDE_FLAGS)
execute_process(COMMAND "${CAF_PYTHON_CONFIG_BIN}" --ldflags
OUTPUT_VARIABLE PYTHON_LDFLAGS)
string(STRIP "${PYTHON_LDFLAGS}" PYTHON_LDFLAGS)
if ("${CAF_EXTRA_LDFLAGS}" STREQUAL "")
set(CAF_EXTRA_LDFLAGS "${PYTHON_LDFLAGS}")
else()
set(CAF_EXTRA_LDFLAGS "${CAF_EXTRA_LDFLAGS} ${PYTHON_LDFLAGS}")
endif()
string(REPLACE " -I" ";-I" dir_list ${PYTHON_INCLUDE_FLAGS})
foreach(flag ${dir_list})
# strip -I from each path
string(SUBSTRING "${flag}" 2 -1 dir)
include_directories("${dir}")
endforeach()
else()
find_package(PythonLibs)
if (NOT PYTHONLIBS_FOUND)
message(STATUS "Unable to find Python, disable Python binding")
message(STATUS "Set CAF_PYTHON_CONFIG_BIN or use './configure --with-python-config=...' to use python-conf")
set(CAF_NO_PYTHON yes)
else()
message(STATUS "Found Python ${PYTHONLIBS_VERSION_STRING}")
include_directories(${PYTHON_INCLUDE_DIRS})
endif()
endif()
endif()
set(CAF_PYTHON_SRCS src/main.cpp)
set(CAF_PYTHON_HDRS)
# add targets to CMake
if(NOT CAF_NO_PYTHON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_executable(caf-python ${CAF_PYTHON_SRCS} ${CAF_PYTHON_HDRS})
target_link_libraries(caf-python
${CAF_EXTRA_LDFLAGS}
caf::core caf::io
${CAF_LIBRARY_RIAC}
${PTHREAD_LIBRARIES}
${LIBEDIT_LIBRARIES}
${PYTHON_LIBRARIES})
install(TARGETS caf-python DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
add_custom_target(caf-python SOURCES ${CAF_PYTHON_SRCS} ${CAF_PYTHON_HDRS})
endif()
This diff is collapsed.
Subproject commit 19d95ef09a384d6631308161ead24e5a230c9bf8
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment