From 67c511edba9ce702234b9ca90abb7df0add3e8ba Mon Sep 17 00:00:00 2001 From: igo95862 Date: Thu, 15 Jul 2021 19:16:45 +0300 Subject: [PATCH] Added compile target for dummy python module Mostly used to check compilation and for Clangd LSP. --- CMakeLists.txt | 6 ++++++ python/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 python/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cdca8fd4..b490494d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -884,3 +884,9 @@ install( NAMELINK_COMPONENT Development ) endif() + +option(DUMMY_PYTHON "Build dummy python module used for compile check and Clangd" OFF) +if(${DUMMY_PYTHON}) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +add_subdirectory("./python") +endif() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt new file mode 100644 index 000000000..c3c894f12 --- /dev/null +++ b/python/CMakeLists.txt @@ -0,0 +1,33 @@ +include(FindPkgConfig) +pkg_search_module(PYTHON3 REQUIRED python3) + +set(NOTCURSES_PYTHON_SRC + notcurses/context.c + notcurses/misc.c + notcurses/channels.c + notcurses/main.c + notcurses/notcurses-python.h + notcurses/plane.c +) + +add_library( + dummy_python MODULE + ${NOTCURSES_PYTHON_SRC} +) + +target_include_directories( + dummy_python + PRIVATE ${PYTHON3_INCLUDE_DIRS} + PRIVATE "${PROJECT_SOURCE_DIR}/include" +) + +target_link_libraries( + dummy_python + PRIVATE + notcurses +) + +target_compile_options( + dummy_python + PRIVATE -Wall -Wextra +)