summaryrefslogtreecommitdiff
path: root/py/CMakeLists.txt
blob: 562a3cff4572225a298d996d54a44b5ddc86c312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
include_directories(${LIBDRM_INCLUDE_DIRS})
link_directories(${LIBDRM_LIBRARY_DIRS})

pkg_check_modules(PYTHON python3 REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()

include_directories(${PROJECT_SOURCE_DIR}/ext/pybind11/include)

add_library(pykms SHARED pykms.cpp pykmsbase.cpp pykmsutil.cpp)
target_link_libraries(pykms kms++ kms++util ${LIBDRM_LIBRARIES})

# 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})

add_test(NAME pytest COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/functest.py")
set_property(TEST pytest PROPERTY
        ENVIRONMENT "PYTHONPATH=." "LD_LIBRARY_PATH=."
)