CMakeLists.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Include the python directory. Also include the parent (which is for example /usr/include)
  2. # which may be required when it is not includes by the (cross-) compiler by default.
  3. if (NOT CMAKE_VERSION VERSION_LESS "3.12")
  4. find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
  5. include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
  6. add_compile_definitions(PYTHON_VERSION_MAJOR=${Python3_VERSION_MAJOR})
  7. add_compile_definitions(PYTHON_VERSION_MINOR=${Python3_VERSION_MINOR})
  8. else()
  9. find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
  10. include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
  11. add_definitions(-DPYTHON_VERSION_MAJOR=${PYTHON_VERSION_MAJOR})
  12. add_definitions(-DPYTHON_VERSION_MINOR=${PYTHON_VERSION_MINOR})
  13. endif()
  14. # Define the current source locations
  15. SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/python)
  16. SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/python)
  17. FILE ( GLOB PYTHON_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
  18. add_library(python
  19. ${PYTHON_SOURCES}
  20. )
  21. target_link_libraries(python
  22. effectengine
  23. hyperion-utils
  24. )
  25. if (NOT CMAKE_VERSION VERSION_LESS "3.12")
  26. target_link_libraries( python ${Python3_LIBRARIES} )
  27. else()
  28. target_link_libraries( python ${PYTHON_LIBRARIES} )
  29. endif()