2424# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
2525################################################################################
2626
27- # Pick up our include directories from the parent context
28- include_directories (${OPENSHOT_INCLUDE_DIRS} )
29-
30- ####### Display summary of options/dependencies ######
27+ # Collect and display summary of options/dependencies
3128include (FeatureSummary)
3229
3330################ OPTIONS ##################
@@ -36,6 +33,9 @@ option(USE_SYSTEM_JSONCPP "Use system installed JsonCpp, if found" ON)
3633option (DISABLE_BUNDLED_JSONCPP "Don't fall back to bundled JsonCpp" OFF )
3734option (ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF )
3835
36+ # Automatically process Qt classes with meta-object compiler
37+ set (CMAKE_AUTOMOC True )
38+
3939################ WINDOWS ##################
4040# Set some compiler options for Windows
4141# required for libopenshot-audio headers
@@ -90,9 +90,6 @@ FIND_PACKAGE(OpenShotAudio 0.1.8 REQUIRED)
9090# Include Juce headers (needed for compile)
9191include_directories (${LIBOPENSHOT_AUDIO_INCLUDE_DIRS} )
9292
93- # Manually moc Qt files
94- qt5_wrap_cpp(MOC_FILES ${QT_HEADER_FILES} )
95-
9693################# BLACKMAGIC DECKLINK ###################
9794# Find BlackMagic DeckLinkAPI libraries
9895IF (ENABLE_BLACKMAGIC)
@@ -147,73 +144,71 @@ if(ENABLE_IWYU)
147144endif ()
148145add_feature_info("IWYU (include-what-you-use)" ENABLE_IWYU "Scan all source files with 'iwyu'" )
149146
150- #### GET LIST OF EFFECT FILES ####
151- FILE (GLOB EFFECT_FILES "${CMAKE_CURRENT_SOURCE_DIR} /effects/*.cpp" )
152-
153- #### GET LIST OF QT PLAYER FILES ####
154- FILE (GLOB QT_PLAYER_FILES "${CMAKE_CURRENT_SOURCE_DIR} /Qt/*.cpp" )
155-
156- ############### SET LIBRARY SOURCE FILES #################
157- SET ( OPENSHOT_SOURCE_FILES
158- AudioBufferSource.cpp
159- AudioReaderSource.cpp
160- AudioResampler.cpp
161- CacheBase.cpp
162- CacheDisk.cpp
163- CacheMemory.cpp
164- ChunkReader.cpp
165- ChunkWriter.cpp
166- Color.cpp
167- Clip.cpp
168- ClipBase.cpp
169- Coordinate.cpp
170- CrashHandler.cpp
171- DummyReader.cpp
172- ReaderBase.cpp
173- RendererBase.cpp
174- WriterBase.cpp
175- EffectBase.cpp
176- ${EFFECT_FILES}
177- EffectInfo.cpp
178- FFmpegReader.cpp
179- FFmpegWriter.cpp
180- Fraction.cpp
181- Frame.cpp
182- FrameMapper.cpp
183- KeyFrame.cpp
184- OpenShotVersion.cpp
185- ZmqLogger.cpp
186- PlayerBase.cpp
187- Point.cpp
188- Profiles.cpp
189- QtImageReader.cpp
190- QtPlayer.cpp
191- Settings.cpp
192- Timeline.cpp
193- QtTextReader.cpp
194- QtHtmlReader.cpp
195-
196-
197- # Qt Video Player
198- ${QT_PLAYER_FILES}
199- ${MOC_FILES} )
200-
201- # ImageMagic related files
202- IF (ImageMagick_FOUND)
203- SET ( OPENSHOT_SOURCE_FILES ${OPENSHOT_SOURCE_FILES}
204- ImageReader.cpp
205- ImageWriter.cpp
206- TextReader.cpp)
207- ENDIF (ImageMagick_FOUND)
208-
209- # BlackMagic related files
210- IF (BLACKMAGIC_FOUND)
211- SET ( OPENSHOT_SOURCE_FILES ${OPENSHOT_SOURCE_FILES}
212- DecklinkInput.cpp
213- DecklinkReader.cpp
214- DecklinkOutput.cpp
215- DecklinkWriter.cpp)
216- ENDIF (BLACKMAGIC_FOUND)
147+ # Main library sources
148+ set (OPENSHOT_SOURCES
149+ AudioBufferSource.cpp
150+ AudioReaderSource.cpp
151+ AudioResampler.cpp
152+ CacheBase.cpp
153+ CacheDisk.cpp
154+ CacheMemory.cpp
155+ ChunkReader.cpp
156+ ChunkWriter.cpp
157+ Color.cpp
158+ Clip.cpp
159+ ClipBase.cpp
160+ Coordinate.cpp
161+ CrashHandler.cpp
162+ DummyReader.cpp
163+ ReaderBase.cpp
164+ RendererBase.cpp
165+ WriterBase.cpp
166+ EffectBase.cpp
167+ EffectInfo.cpp
168+ FFmpegReader.cpp
169+ FFmpegWriter.cpp
170+ Fraction.cpp
171+ Frame.cpp
172+ FrameMapper.cpp
173+ KeyFrame.cpp
174+ OpenShotVersion.cpp
175+ ZmqLogger.cpp
176+ PlayerBase.cpp
177+ Point.cpp
178+ Profiles.cpp
179+ QtHtmlReader.cpp
180+ QtImageReader.cpp
181+ QtPlayer.cpp
182+ QtTextReader.cpp
183+ Settings.cpp
184+ Timeline.cpp)
185+
186+ # Video effects
187+ set (EFFECTS_SOURCES
188+ effects/Bars.cpp
189+ effects/Blur.cpp
190+ effects/Brightness.cpp
191+ effects/ChromaKey.cpp
192+ effects/ColorShift.cpp
193+ effects/Crop.cpp
194+ effects/Deinterlace.cpp
195+ effects/Hue.cpp
196+ effects/Mask.cpp
197+ effects/Negate.cpp
198+ effects/Pixelate.cpp
199+ effects/Saturation.cpp
200+ effects/Shift.cpp
201+ effects/Wave.cpp)
202+
203+ # Qt video player components
204+ set (QT_PLAYER_SOURCES
205+ Qt/AudioPlaybackThread.cpp
206+ Qt/PlayerDemo.cpp
207+ Qt/PlayerPrivate.cpp
208+ Qt/VideoCacheThread.cpp
209+ Qt/VideoPlaybackThread.cpp
210+ Qt/VideoRenderer.cpp
211+ Qt/VideoRenderWidget.cpp)
217212
218213
219214# Get list of headers
@@ -224,9 +219,13 @@ SET(CMAKE_MACOSX_RPATH 0)
224219
225220############### CREATE LIBRARY #################
226221# Create shared openshot library
227- add_library (openshot SHARED
228- ${OPENSHOT_SOURCE_FILES}
229- ${headers} )
222+ add_library (openshot SHARED)
223+
224+ target_sources (openshot
225+ PRIVATE
226+ ${OPENSHOT_SOURCES} ${EFFECTS_SOURCES} ${QT_PLAYER_SOURCES}
227+ PUBLIC
228+ ${headers} )
230229
231230# Set SONAME and other library properties
232231set_target_properties (openshot
@@ -236,6 +235,34 @@ set_target_properties(openshot
236235 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX} /lib"
237236 )
238237
238+ # Add optional ImageMagic-dependent sources
239+ if (ImageMagick_FOUND)
240+ target_sources (openshot PRIVATE
241+ ImageReader.cpp
242+ ImageWriter.cpp
243+ TextReader.cpp)
244+ endif ()
245+
246+ # BlackMagic related files
247+ if (BLACKMAGIC_FOUND)
248+ target_sources (openshot PRIVATE
249+ DecklinkInput.cpp
250+ DecklinkReader.cpp
251+ DecklinkOutput.cpp
252+ DecklinkWriter.cpp)
253+ endif ()
254+
255+ # Location of our includes, both internally and when installed
256+ target_include_directories (openshot
257+ PRIVATE
258+ ${CMAKE_SOURCE_DIR} /include
259+ ${CMAKE_BINARY_DIR} /include
260+ PUBLIC
261+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR} /include >
262+ $<BUILD_INTERFACE:${CMAKE_BINARY_DIR} /include >
263+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} /libopenshot>)
264+
265+
239266################### JSONCPP #####################
240267# Include jsoncpp headers (needed for JSON parsing)
241268if (USE_SYSTEM_JSONCPP)
@@ -342,7 +369,6 @@ endif()
342369############### LINK LIBRARY #################
343370SET ( REQUIRED_LIBRARIES
344371 ${LIBOPENSHOT_AUDIO_LIBRARIES}
345- ${QT_LIBRARIES}
346372 ${PROFILER}
347373 )
348374
0 commit comments