From 2f5409af5da4a27afa49d491c22a3a764bc328a6 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Tue, 11 Dec 2018 15:32:04 +0100 Subject: [PATCH] make building Python bindings configurable via CMake flag --- CMakeLists.txt | 10 +++++++++- appveyor.yml | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c8e36c..543e9f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required (VERSION 2.6) +set(BUILD_BINDINGS_PYTHON OFF CACHE BOOL "Build the SourcetrailDB Python bindings.") + set(PROJECT_NAME "SourcetrailDB") project(${PROJECT_NAME}) @@ -13,4 +15,10 @@ set(CORE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/core") # can be accessed in subdirector set(CORE_BINARY_DIR "${CMAKE_BINARY_DIR}/core") # can be accessed in subdirectory CMake files add_subdirectory(${CORE_SOURCE_DIR} ${CORE_BINARY_DIR}) -add_subdirectory("${CMAKE_SOURCE_DIR}/bindings_python" "${CMAKE_BINARY_DIR}/bindings_python") + +if (BUILD_BINDINGS_PYTHON) + message(STATUS "SourcetrailDB Python bindings will be built.") + add_subdirectory("${CMAKE_SOURCE_DIR}/bindings_python" "${CMAKE_BINARY_DIR}/bindings_python") +else() + message(STATUS "Building SourcetrailDB Python bindings will be skipped. You can enable building this target by setting 'BUILD_BINDINGS_PYTHON' to 'ON'.") +endif() diff --git a/appveyor.yml b/appveyor.yml index 104ea91..b9ccee4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,8 +31,7 @@ install: before_build: - mkdir build - cd build - - cmake -G "%CMAKE_GENERATOR%" ../ - - cmake -G "%CMAKE_GENERATOR%" ../ -DPYTHON_INCLUDE_DIRS="%PYTHON_PATH%/include" -DPYTHON_LIBRARIES="%PYTHON_PATH%/libs/python37.lib" + - cmake -G "%CMAKE_GENERATOR%" ../ -DBUILD_BINDINGS_PYTHON=ON -DPYTHON_INCLUDE_DIRS="%PYTHON_PATH%/include" -DPYTHON_INCLUDE_DIRS="%PYTHON_PATH%/include" -DPYTHON_LIBRARIES="%PYTHON_PATH%/libs/python37.lib" - cd ../