Commit 9944c2be authored by Dominik Charousset's avatar Dominik Charousset

Initial commit

parents
[submodule "third_party/pybind"]
path = third_party/pybind
url = https://github.com/pybind/pybind11.git
cmake_minimum_required(VERSION 2.8)
project(caf_cash CXX)
# check whether submodules are available
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/pybind/CMakeLists.txt")
set(CAF_NO_PYTHON yes)
else()
message(STATUS "try config bin: ${CAF_PYTHON_CONFIG_BIN}")
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 ("${LD_FLAGS}" STREQUAL "")
set(LD_FLAGS "${PYTHON_LDFLAGS}")
else()
set(LD_FLAGS "${LD_FLAGS} ${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 3.5)
if (NOT PYTHONLIBS_FOUND)
message(STATUS "Unable to find Python >= 3.5, disable Python binding")
message(STATUS "Set CAF_PYTHON_CONFIG_BIN or use './configure --with-python-conf=...' to use python-conf")
set(CAF_NO_PYTHON yes)
else()
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
${LD_FLAGS}
${CAF_LIBRARY_CORE}
${CAF_LIBRARY_IO}
${CAF_LIBRARY_RIAC}
${PTHREAD_LIBRARIES}
${LIBEDIT_LIBRARIES}
${PYTHON_LIBRARIES})
install(PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/caf-python DESTINATION bin)
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