Skip to content

Commit

Permalink
python/CMakeLists: Lowercase commands, indents
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc authored Mar 23, 2020
1 parent bb20a9b commit 2684015
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,34 @@


############### SWIG PYTHON BINDINGS ################
FIND_PACKAGE(SWIG 3.0 REQUIRED)
INCLUDE(${SWIG_USE_FILE})
find_package(SWIG 3.0 REQUIRED)
include(${SWIG_USE_FILE})

### Enable some legacy SWIG behaviors, in newer CMAKEs
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0078 OLD)
endif()
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
cmake_policy(SET CMP0086 OLD)
endif()

FIND_PACKAGE(PythonInterp 3)
FIND_PACKAGE(PythonLibs 3)
if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)

### Include Python header files
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
### Include Python header files
include_directories(${PYTHON_INCLUDE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

### Enable C++ support in SWIG
set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot)
### Enable C++ support in SWIG
set_property(SOURCE openshot.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE openshot.i PROPERTY SWIG_MODULE_NAME openshot)

### Suppress a ton of warnings in the generated SWIG C++ code
set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function -Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \
### Suppress a ton of warnings in the generated SWIG C++ code
set(SWIG_CXX_FLAGS "-Wno-unused-variable -Wno-unused-function -Wno-deprecated-copy -Wno-class-memaccess -Wno-cast-function-type \
-Wno-unused-parameter -Wno-catch-value -Wno-sign-compare -Wno-ignored-qualifiers")
separate_arguments(sw_flags UNIX_COMMAND ${SWIG_CXX_FLAGS})
set_property(SOURCE openshot.i PROPERTY GENERATED_COMPILE_OPTIONS ${sw_flags})
separate_arguments(sw_flags UNIX_COMMAND ${SWIG_CXX_FLAGS})
set_property(SOURCE openshot.i PROPERTY GENERATED_COMPILE_OPTIONS ${sw_flags})

### Take include dirs from target, automatically if possible
if (CMAKE_VERSION VERSION_GREATER 3.13)
Expand All @@ -62,19 +62,19 @@ if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
set_property(SOURCE openshot.i PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:openshot,INCLUDE_DIRECTORIES>)
endif ()

### Add the SWIG interface file (which defines all the SWIG methods)
if (CMAKE_VERSION VERSION_LESS 3.8.0)
swig_add_module(pyopenshot python openshot.i)
else()
swig_add_library(pyopenshot LANGUAGE python SOURCES openshot.i)
endif()
### Add the SWIG interface file (which defines all the SWIG methods)
if (CMAKE_VERSION VERSION_LESS 3.8.0)
swig_add_module(pyopenshot python openshot.i)
else()
swig_add_library(pyopenshot LANGUAGE python SOURCES openshot.i)
endif()

### Set output name of target
set_target_properties(${SWIG_MODULE_pyopenshot_REAL_NAME} PROPERTIES
### Set output name of target
set_target_properties(${SWIG_MODULE_pyopenshot_REAL_NAME} PROPERTIES
PREFIX "_" OUTPUT_NAME "openshot")

### Link the new python wrapper library with libopenshot
target_link_libraries(${SWIG_MODULE_pyopenshot_REAL_NAME} PUBLIC
### Link the new python wrapper library with libopenshot
target_link_libraries(${SWIG_MODULE_pyopenshot_REAL_NAME} PUBLIC
${PYTHON_LIBRARIES} openshot)

######### INSTALL PATH ########
Expand All @@ -88,12 +88,12 @@ if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
endif()

if (UNIX AND NOT APPLE)
### Check if the following Debian-friendly python module path exists
set(PYTHON_MODULE_PATH "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/dist-packages")
if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH}")
### Check if the following Debian-friendly python module path exists
set(PYTHON_MODULE_PATH "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/dist-packages")
if (NOT EXISTS "${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH}")

### Calculate the python module path (using distutils)
execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "\
execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "\
from distutils.sysconfig import get_python_lib; \
print( get_python_lib( plat_specific=True, prefix='' ) )"
OUTPUT_VARIABLE PYTHON_MODULE_PATH
Expand All @@ -104,9 +104,9 @@ print( get_python_lib( plat_specific=True, prefix='' ) )"

message(STATUS "PYTHON_MODULE_PATH: ${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH}")

############### INSTALL HEADERS & LIBRARY ################
### Install Python bindings
install(TARGETS ${SWIG_MODULE_pyopenshot_REAL_NAME}
############### INSTALL HEADERS & LIBRARY ################
### Install Python bindings
install(TARGETS ${SWIG_MODULE_pyopenshot_REAL_NAME}
DESTINATION ${PYTHON_MODULE_PATH} )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openshot.py
DESTINATION ${PYTHON_MODULE_PATH} )
Expand Down

0 comments on commit 2684015

Please sign in to comment.