@@ -40,8 +40,8 @@ For more information, please visit <http://www.openshot.org/>.
4040set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR} /cmake/Modules" )
4141
4242################ PROJECT VERSION ####################
43- set (PROJECT_VERSION_FULL "0.2.3-dev1 " )
44- set (PROJECT_SO_VERSION 17 )
43+ set (PROJECT_VERSION_FULL "0.2.5-dev2 " )
44+ set (PROJECT_SO_VERSION 19 )
4545
4646# Remove the dash and anything following, to get the #.#.# version for project()
4747STRING (REGEX REPLACE "\- .*$" "" VERSION_NUM "${PROJECT_VERSION_FULL} " )
@@ -66,12 +66,44 @@ Generating build files for OpenShot with CMake ${CMAKE_VERSION}
6666# in order to properly configure CMAKE_INSTALL_LIBDIR path
6767include (GNUInstallDirs)
6868
69+ # Collect and display summary of options/dependencies
70+ include (FeatureSummary)
71+
72+ ################ OPTIONS ##################
73+ # Optional build settings for libopenshot
74+ option (USE_SYSTEM_JSONCPP "Use system installed JsonCpp, if found" ON )
75+ option (DISABLE_BUNDLED_JSONCPP "Don't fall back to bundled JsonCpp" OFF )
76+ option (ENABLE_IWYU "Enable 'Include What You Use' scanner (CMake 3.3+)" OFF )
77+ option (ENABLE_TESTS "Build unit tests (requires UnitTest++)" ON )
78+ option (ENABLE_DOCS "Build API documentation (requires Doxygen)" ON )
79+
80+ # Legacy commandline override
81+ if (DISABLE_TESTS)
82+ if (ENABLE_COVERAGE)
83+ message (WARNING "ENABLE_COVERAGE requires tests, overriding DISABLE_TESTS" )
84+ set (ENABLE_TESTS ON )
85+ else ()
86+ set (ENABLE_TESTS OFF )
87+ endif ()
88+ endif ()
89+
90+ if (DEFINED ENABLE_TESTS)
91+ set (ENABLE_TESTS ${ENABLE_TESTS} CACHE BOOL "Build unit tests (requires UnitTest++)" FORCE)
92+ endif ()
93+
6994########## Configure Version.h header ##############
7095configure_file (include /OpenShotVersion.h.in include /OpenShotVersion.h @ONLY)
7196# We'll want that installed later
7297install (FILES ${CMAKE_CURRENT_BINARY_DIR} /include /OpenShotVersion.h
7398 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /libopenshot)
7499
100+ #### Work around a GCC < 9 bug with handling of _Pragma() in macros
101+ #### See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578
102+ if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" ) AND
103+ (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.0.0" ))
104+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-integrated-cpp" )
105+ endif ()
106+
75107#### Enable C++11 (for std::shared_ptr support)
76108set (CMAKE_CXX_STANDARD 11)
77109set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -85,29 +117,67 @@ include_directories(
85117 ${CMAKE_CURRENT_SOURCE_DIR} /include
86118 ${CMAKE_CURRENT_BINARY_DIR} /include )
87119
120+ ############## Code Coverage #########################
121+ if (DISABLE_TESTS AND ENABLE_COVERAGE)
122+ message (WARNING "ENABLE_COVERAGE requires tests, overriding DISABLE_TESTS" )
123+ set (DISABLE_TESTS OFF CACHE BOOL "Don't build unit tests" FORCE)
124+ endif ()
125+
126+ if (ENABLE_COVERAGE)
127+ if (NOT CMAKE_BUILD_TYPE )
128+ set (CMAKE_BUILD_TYPE "Debug" )
129+ message (STATUS "Coverage enabled, setting build type to Debug" )
130+ endif ()
131+ include (CodeCoverage)
132+ append_coverage_compiler_flags()
133+ endif ()
134+ add_feature_info("Coverage" ENABLE_COVERAGE "analyze test coverage and generate report" )
135+
88136############## PROCESS src/ DIRECTORIES ##############
89137add_subdirectory (src)
90138
91139################### DOCUMENTATION ###################
92140# Find Doxygen (used for documentation)
93- include (cmake/Modules/UseDoxygen.cmake)
94-
95- # Doxygen was found
96- if (TARGET doc )
97- message (STATUS "Doxygen found, documentation target enabled" )
98- message ("\n To compile documentation in doc/html, run: 'make doc'" )
99-
100- # Install docs, if the user builds them with `make doc`
101- install (CODE "MESSAGE(\" Checking for documentation files to install...\" )" )
102- install (CODE "MESSAGE(\" (Compile with 'make doc' command, requires Doxygen)\" )" )
103-
104- install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /doc /html/
105- DESTINATION ${CMAKE_INSTALL_DOCDIR} /API
106- MESSAGE_NEVER # Don't spew about file copies
107- OPTIONAL ) # No error if the docs aren't found
141+ set (DOCS_ENABLED FALSE ) # Only set true if Doxygen is found and configured
142+ if (ENABLE_DOCS)
143+ include (cmake/Modules/UseDoxygen.cmake)
144+
145+ # Doxygen was found
146+ if (TARGET doc )
147+ message (STATUS "Doxygen found, documentation target enabled" )
148+ set (DOCS_ENABLED TRUE )
149+
150+ # Install docs, if the user builds them with `make doc`
151+ install (CODE "MESSAGE(\" Checking for documentation files to install...\" )" )
152+ install (CODE "MESSAGE(\" (Compile with 'make doc' command, requires Doxygen)\" )" )
153+
154+ install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /doc /html/
155+ DESTINATION ${CMAKE_INSTALL_DOCDIR} /API
156+ MESSAGE_NEVER # Don't spew about file copies
157+ OPTIONAL ) # No error if the docs aren't found
158+ endif ()
108159endif ()
160+ add_feature_info("Documentation" DOCS_ENABLED "Build API documentation with 'make doc'" )
109161
110162############# PROCESS tests/ DIRECTORY ##############
111- if (NOT DISABLE_TESTS)
163+ if (ENABLE_TESTS)
164+ set (TESTS_ENABLED TRUE ) # May be overridden by tests/CMakeLists.txt
112165 add_subdirectory (tests)
113166endif ()
167+ add_feature_info("Unit tests" TESTS_ENABLED "Compile unit tests for library functions" )
168+
169+ ############## COVERAGE REPORTING #################
170+ if (ENABLE_COVERAGE)
171+ setup_target_for_coverage_lcov(
172+ NAME coverage
173+ LCOV_ARGS "--no-external"
174+ EXECUTABLE openshot-test
175+ DEPENDENCIES openshot-test )
176+ message ("Generate coverage report with 'make coverage'" )
177+ endif ()
178+
179+ ########### PRINT FEATURE SUMMARY ##############
180+ feature_summary(WHAT ALL
181+ INCLUDE_QUIET_PACKAGES
182+ FATAL_ON_MISSING_REQUIRED_PACKAGES
183+ DESCRIPTION "Displaying feature summary\n\n Build configuration:" )
0 commit comments