summaryrefslogtreecommitdiff
path: root/py/CMakeLists.txt
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-20 22:09:35 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-05-23 09:43:27 +0300
commit6d13ebbb8b9854713a5597df71a12f8dd9a36c34 (patch)
tree874148f1f3be655df557e01ecefe03570b0dbe47 /py/CMakeLists.txt
parentd37da4a303ab2760103ef8302cb1778f8860f16f (diff)
Use pybind11 instead of SWIG
Diffstat (limited to 'py/CMakeLists.txt')
-rw-r--r--py/CMakeLists.txt23
1 files changed, 8 insertions, 15 deletions
diff --git a/py/CMakeLists.txt b/py/CMakeLists.txt
index c6341d8..ff68939 100644
--- a/py/CMakeLists.txt
+++ b/py/CMakeLists.txt
@@ -1,27 +1,20 @@
-set(SWIG_EXECUTABLE "swig3.0")
-find_package(SWIG 3.0 REQUIRED)
-include(${SWIG_USE_FILE})
-
include_directories(${LIBDRM_INCLUDE_DIRS})
link_directories(${LIBDRM_LIBRARY_DIRS})
pkg_check_modules(PYTHON python3 REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
-# XXX how to add these inc dirs in a proper way?
-include_directories(../libkms++ ../libkmstest)
-
-#set(CMAKE_SWIG_FLAGS "-I../../libkms")
-set(CMAKE_SWIG_FLAGS "-builtin")
+if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+endif()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
+include_directories(${PROJECT_SOURCE_DIR}/ext/pybind11/include)
-set_source_files_properties(pykms.i PROPERTIES CPLUSPLUS ON)
-swig_add_module(pykms python pykms.i)
-swig_link_libraries(pykms kms++ kmstest ${LIBDRM_LIBRARIES} ${PYTHON_LIBRARIES})
+add_library(pykms SHARED pykms.cpp)
+target_link_libraries(pykms kms++ kmstest ${LIBDRM_LIBRARIES})
-# We get some "maybe-uninitialized" warnings from the generated code. I hope they are harmless.
-set_source_files_properties(${swig_generated_file_fullname} PROPERTIES COMPILE_FLAGS "-Wno-maybe-uninitialized")
+# Don't add a 'lib' prefix to the shared library
+set_target_properties(pykms PROPERTIES PREFIX "")
file(GLOB PY_SRCS "*.py")
add_custom_target(pyextras SOURCES ${PY_SRCS})