Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions bindings/java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,27 @@
find_package(SWIG 4.0 REQUIRED)
include(${SWIG_USE_FILE})

### Enable some legacy SWIG behaviors in newer CMake versions
### Use modern SWIG target behavior when available
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0078 NEW)
endif()
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
cmake_policy(SET CMP0086 NEW)
endif()

find_package(Java REQUIRED)
include(UseJava)

find_package(JNI REQUIRED)
include_directories(${JNI_INCLUDE_DIRS})
message(STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
message(STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")

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

### Set the swig package name for the JAR
set_source_files_properties(openshot.i PROPERTIES
SWIG_FLAGS "-package;org.openshot"
SWIG_FLAGS "-package;org.openshot;-w503,516,813,822"
)

### Suppress a ton of warnings in the generated SWIG C++ code
Expand All @@ -51,7 +49,6 @@ elseif(CMAKE_VERSION VERSION_GREATER 3.12)
set(_inc $<TARGET_PROPERTY:openshot,INCLUDE_DIRECTORIES>)
endif()
if (DEFINED _inc)
message(STATUS "Include directories: ${_inc}")
set_property(SOURCE openshot.i PROPERTY INCLUDE_DIRECTORIES ${_inc})
endif()

Expand All @@ -61,29 +58,30 @@ if (CMAKE_VERSION VERSION_GREATER 3.20)
endif()

### Add the SWIG interface file (which defines all the SWIG methods)
if (CMAKE_VERSION VERSION_LESS 3.8.0)
swig_add_module(openshot-java java openshot.i)
swig_add_library(openshot-java LANGUAGE java SOURCES openshot.i)

if (POLICY CMP0078)
set(_openshot_java_target openshot-java)
else()
swig_add_library(openshot-java LANGUAGE java SOURCES openshot.i)
set(_openshot_java_target ${SWIG_MODULE_openshot-java_REAL_NAME})
endif()

### Set the prefix for the library to 'lib'
#set_target_properties(${SWIG_MODULE_openshot-java_REAL_NAME} PROPERTIES PREFIX "lib")

### Compile the generated wrapper file
get_property(_java_files TARGET openshot-java PROPERTY SWIG_SUPPORT_FILES)
message("_java_files: ${_java_files}")

### Link the new Java wrapper library with libopenshot
target_link_libraries(${SWIG_MODULE_openshot-java_REAL_NAME} PUBLIC
target_link_libraries(${_openshot_java_target} PUBLIC
${JNI_LIBRARIES} openshot)

### Create a custom target for the JAR file
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bindings/java/openshotJNI.jar
COMMAND ${Java_JAVAC_EXECUTABLE} -d ${CMAKE_BINARY_DIR}/bindings/java ${CMAKE_BINARY_DIR}/bindings/java/*.java
COMMAND ${Java_JAR_EXECUTABLE} -cf ${CMAKE_BINARY_DIR}/bindings/java/openshotJNI.jar -C ${CMAKE_BINARY_DIR}/bindings/java .
DEPENDS openshot-java
DEPENDS ${_openshot_java_target}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bindings/java
COMMENT "Creating openshotJNI.jar"
)
Expand Down
6 changes: 6 additions & 0 deletions bindings/java/openshot.i
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
/* Suppress warnings about ignored operator= */
%warnfilter(362);

/* JUCE thread internals are implementation details, not binding API */
%ignore juce::Thread;
namespace juce {
class Thread {};
}

/* Don't generate multiple wrappers for functions with default args */
%feature("compactdefaultargs", "1");

Expand Down
37 changes: 26 additions & 11 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,29 @@
find_package(SWIG 3.0 REQUIRED)
include(${SWIG_USE_FILE})

### Enable some legacy SWIG behaviors, in newer CMAKEs
### Use modern SWIG target behavior when available
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0078 NEW)
endif()
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
cmake_policy(SET CMP0086 NEW)
endif()

find_package(PythonInterp 3)
find_package(PythonLibs 3)
if (CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonInterp 3)
find_package(PythonLibs 3)
else()
find_package(Python3 3 COMPONENTS Interpreter Development)
if (Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
set(PYTHON_INCLUDE_PATH "${Python3_INCLUDE_DIRS}")
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
set(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}")
set(PYTHONINTERP_FOUND TRUE)
set(PYTHONLIBS_FOUND TRUE)
endif()
endif()

if (NOT PYTHONLIBS_FOUND OR NOT PYTHONINTERP_FOUND)
return()
Expand Down Expand Up @@ -85,18 +98,20 @@ if (CMAKE_VERSION VERSION_GREATER 3.20)
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)
swig_add_library(pyopenshot LANGUAGE python SOURCES openshot.i)

if (POLICY CMP0078)
set(_pyopenshot_target pyopenshot)
else()
swig_add_library(pyopenshot LANGUAGE python SOURCES openshot.i)
set(_pyopenshot_target ${SWIG_MODULE_pyopenshot_REAL_NAME})
endif()

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

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

######### INSTALL PATH ########
Expand Down Expand Up @@ -128,7 +143,7 @@ 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(TARGETS ${_pyopenshot_target}
DESTINATION ${PYTHON_MODULE_PATH} )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/openshot.py
DESTINATION ${PYTHON_MODULE_PATH} )
8 changes: 7 additions & 1 deletion bindings/python/openshot.i
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
/* Suppress warnings about ignored operator= */
%warnfilter(362);

/* JUCE thread internals are implementation details, not binding API */
%ignore juce::Thread;
namespace juce {
class Thread {};
}

/* Don't generate multiple wrappers for functions with default args */
%feature("compactdefaultargs", "1");

Expand Down Expand Up @@ -248,7 +254,7 @@ static int openshot_swig_is_qwidget(PyObject *obj) {
$1 = reinterpret_cast<QWidget*>(ptr);
}

%typemap(typecheck) QWidget * {
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) QWidget * {
$1 = openshot_swig_is_qwidget($input);
}

Expand Down
20 changes: 11 additions & 9 deletions bindings/ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
find_package(SWIG 3.0 REQUIRED)
include(${SWIG_USE_FILE})

### Enable some legacy SWIG behaviors, in newer CMAKEs
### Use modern SWIG target behavior when available
if (POLICY CMP0078)
cmake_policy(SET CMP0078 OLD)
cmake_policy(SET CMP0078 NEW)
endif()
if (POLICY CMP0086)
cmake_policy(SET CMP0086 OLD)
cmake_policy(SET CMP0086 NEW)
endif()

find_package(Ruby)
Expand Down Expand Up @@ -102,22 +102,24 @@ if (CMAKE_VERSION VERSION_GREATER 3.20)
endif()

### Add the SWIG interface file (which defines all the SWIG methods)
if (CMAKE_VERSION VERSION_LESS 3.8.0)
swig_add_module(rbopenshot ruby openshot.i)
swig_add_library(rbopenshot LANGUAGE ruby SOURCES openshot.i)

if (POLICY CMP0078)
set(_rbopenshot_target rbopenshot)
else()
swig_add_library(rbopenshot LANGUAGE ruby SOURCES openshot.i)
set(_rbopenshot_target ${SWIG_MODULE_rbopenshot_REAL_NAME})
endif()

### Set name of target (with no prefix, since Ruby does not like that)
# XXX: If this is not done exactly this way, the module builds as
# e.g. rbopenshot.so, but its initializer method will be named
# 'Init_openshot()' (via the module name set in the SWIG .i file).
# Which leads to Ruby barfing when it attempts to load the module.
set_target_properties(${SWIG_MODULE_rbopenshot_REAL_NAME} PROPERTIES
set_target_properties(${_rbopenshot_target} PROPERTIES
PREFIX "" OUTPUT_NAME "openshot")

### Link the new Ruby wrapper library with libopenshot
target_link_libraries(${SWIG_MODULE_rbopenshot_REAL_NAME} PUBLIC
target_link_libraries(${_rbopenshot_target} PUBLIC
${RUBY_LIBRARY} openshot)

######### INSTALL PATH ########
Expand Down Expand Up @@ -147,5 +149,5 @@ message(STATUS "RUBY_MODULE_PATH: ${CMAKE_INSTALL_PREFIX}/${RUBY_MODULE_PATH}")

############### INSTALL HEADERS & LIBRARY ################
# Install Ruby bindings
install(TARGETS ${SWIG_MODULE_rbopenshot_REAL_NAME}
install(TARGETS ${_rbopenshot_target}
DESTINATION ${RUBY_MODULE_PATH} )
15 changes: 15 additions & 0 deletions bindings/ruby/openshot.i
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
/* Suppress warnings about ignored operator= */
%warnfilter(362);

/* JUCE thread internals are implementation details, not binding API */
%ignore juce::Thread;
namespace juce {
class Thread {};
}

/* Ruby bindings intentionally expose the primary OpenShot base class only */
%warnfilter(802) openshot::Clip;
%warnfilter(802) openshot::Timeline;

/* Ruby bindings do not expose Profile comparison operators */
%warnfilter(503) operator<;
%warnfilter(503) operator>;
%warnfilter(503) operator==;

/* Don't generate multiple wrappers for functions with default args */
%feature("compactdefaultargs", "1");

Expand Down
2 changes: 1 addition & 1 deletion cmake/Modules/Findbabl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function(_babl_GET_VERSION _header)
endfunction()

find_package(PkgConfig)
pkg_check_modules(PC_BABL babl)
pkg_check_modules(PC_BABL QUIET babl)

set(babl_VERSION ${PC_BABL_VERSION})

Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ mark_as_advanced(QT_VERSION_STR)
# Find FFmpeg libraries (used for video encoding / decoding)
find_package(FFmpeg REQUIRED
COMPONENTS avcodec avformat avutil swscale
OPTIONAL_COMPONENTS swresample avresample
OPTIONAL_COMPONENTS swresample
)

set(all_comps avcodec avformat avutil swscale)
Expand All @@ -404,6 +404,7 @@ if(TARGET FFmpeg::swresample)
set(resample_lib swresample)
set(USE_SW TRUE)
else()
find_package(FFmpeg REQUIRED COMPONENTS avresample)
set(resample_lib avresample)
set(USE_SW FALSE)
endif()
Expand Down
Loading