You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Merge pull request #263 from OpenShot/cmake-owns-version
Move version info ownership to CMake (based on @ferdnyc PR https://github.com/OpenShot/libopenshot/pull/253)
This commit is contained in:
@@ -39,49 +39,45 @@ For more information, please visit <http://www.openshot.org/>.
|
||||
################ ADD CMAKE MODULES ##################
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
|
||||
|
||||
################ GET VERSION INFORMATION FROM VERSION.H ##################
|
||||
message(STATUS "Determining Version Number (from Version.h file)")
|
||||
################ PROJECT VERSION ####################
|
||||
set(PROJECT_VERSION_FULL "0.2.3-dev1")
|
||||
set(PROJECT_SO_VERSION 17)
|
||||
|
||||
#### Get the lines related to libopenshot version from the Version.h header
|
||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/Version.h
|
||||
OPENSHOT_VERSION_LINES
|
||||
REGEX "#define[ ]+OPENSHOT_VERSION_.*[0-9]+;.*")
|
||||
|
||||
#### Set each line into its own variable
|
||||
|
||||
list (GET OPENSHOT_VERSION_LINES 0 LINE_MAJOR)
|
||||
list (GET OPENSHOT_VERSION_LINES 1 LINE_MINOR)
|
||||
list (GET OPENSHOT_VERSION_LINES 2 LINE_BUILD)
|
||||
list (GET OPENSHOT_VERSION_LINES 3 LINE_SO)
|
||||
|
||||
#### Get the version number out of each line
|
||||
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MAJOR[ ]+([0-9]+);(.*)" "\\1" MAJOR_VERSION "${LINE_MAJOR}")
|
||||
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_MINOR[ ]+([0-9]+);(.*)" "\\1" MINOR_VERSION "${LINE_MINOR}")
|
||||
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_BUILD[ ]+([0-9]+);(.*)" "\\1" BUILD_VERSION "${LINE_BUILD}")
|
||||
STRING(REGEX REPLACE "#define[ ]+OPENSHOT_VERSION_SO[ ]+([0-9]+);(.*)" "\\1" SO_VERSION "${LINE_SO}")
|
||||
|
||||
message(STATUS "MAJOR Version: ${MAJOR_VERSION}")
|
||||
message(STATUS "MINOR Version: ${MINOR_VERSION}")
|
||||
message(STATUS "BUILD Version: ${BUILD_VERSION}")
|
||||
message(STATUS "SO/API/ABI Version: ${SO_VERSION}")
|
||||
message(STATUS "Determining Version Number - done")
|
||||
# Remove the dash and anything following, to get the #.#.# version for project()
|
||||
STRING(REGEX REPLACE "\-.*$" "" VERSION_NUM "${PROJECT_VERSION_FULL}")
|
||||
|
||||
################### SETUP PROJECT ###################
|
||||
PROJECT(libopenshot LANGUAGES C CXX
|
||||
VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_VERSION})
|
||||
# This will define the following variables
|
||||
# PROJECT_NAME
|
||||
# PROJECT_VERSION, libopenshot_VERSION
|
||||
# PROJECT_VERSION_MAJOR, libopenshot_VERSION_MAJOR
|
||||
# PROJECT_VERSION_MINOR, libopenshot_VERSION_MINOR
|
||||
# PROJECT_VERSION_PATCH, libopenshot_VERSION_PATCH
|
||||
PROJECT(libopenshot LANGUAGES C CXX VERSION ${VERSION_NUM})
|
||||
|
||||
message("
|
||||
Generating build files for OpenShot
|
||||
Building ${PROJECT_NAME} (version ${PROJECT_VERSION})
|
||||
SO/API/ABI Version: ${SO_VERSION}
|
||||
SO/API/ABI Version: ${PROJECT_SO_VERSION}
|
||||
")
|
||||
|
||||
#### Work around a GCC < 9 bug with handling of _Pragma() in macros
|
||||
#### See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578
|
||||
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
|
||||
(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "9.0.0"))
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-integrated-cpp")
|
||||
endif()
|
||||
# Define install paths according to system conventions
|
||||
# XXX: This must be AFTER THE PROJECT() COMMAND w/ languages enabled,
|
||||
# in order to properly configure CMAKE_INSTALL_LIBDIR path
|
||||
include(GNUInstallDirs)
|
||||
|
||||
########## Configure Version.h header ##############
|
||||
configure_file(include/OpenShotVersion.h.in include/OpenShotVersion.h @ONLY)
|
||||
# We'll want that installed later
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/OpenShotVersion.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libopenshot)
|
||||
|
||||
############### Set up include paths #################
|
||||
list(APPEND OPENSHOT_INCLUDE_DIRS
|
||||
include
|
||||
include/effects
|
||||
include/Qt
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include )
|
||||
|
||||
#### Enable C++11 (for std::shared_ptr support)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
@@ -102,7 +98,4 @@ add_subdirectory(tests)
|
||||
|
||||
################### DOCUMENTATION ###################
|
||||
# Find Doxygen (used for documentation)
|
||||
include(cmake/Modules/UseDoxygen.cmake)
|
||||
|
||||
file(GLOB_RECURSE doc_files ${CMAKE_CURRENT_BINARY_DIR}/doc/html/*.*)
|
||||
INSTALL(FILES ${doc_files} DESTINATION share/doc/libopenshot)
|
||||
include(cmake/Modules/UseDoxygen.cmake)
|
||||
@@ -96,7 +96,7 @@
|
||||
*/
|
||||
|
||||
// Include the version number of OpenShot Library
|
||||
#include "Version.h"
|
||||
#include "OpenShotVersion.h"
|
||||
|
||||
// Include all other classes
|
||||
#include "AudioBufferSource.h"
|
||||
|
||||
@@ -31,18 +31,16 @@
|
||||
#ifndef OPENSHOT_VERSION_H
|
||||
#define OPENSHOT_VERSION_H
|
||||
|
||||
// Crazy c++ macro to convert an integer into a string
|
||||
#ifndef STRINGIZE
|
||||
#define STRINGIZE_(x) #x
|
||||
#define STRINGIZE(x) STRINGIZE_(x)
|
||||
#endif
|
||||
#define OPENSHOT_VERSION_ALL "@PROJECT_VERSION@" /// A string of the entire version "Major.Minor.Build"
|
||||
#define OPENSHOT_VERSION_FULL "@PROJECT_VERSION_FULL@" /// A string of the full version identifier, including suffixes (e.g. "0.0.0-dev0")
|
||||
|
||||
#define OPENSHOT_VERSION_MAJOR 0; /// Major version number is incremented when huge features are added or improved.
|
||||
#define OPENSHOT_VERSION_MINOR 2; /// Minor version is incremented when smaller (but still very important) improvements are added.
|
||||
#define OPENSHOT_VERSION_BUILD 3; /// Build number is incremented when minor bug fixes and less important improvements are added.
|
||||
#define OPENSHOT_VERSION_SO 17; /// Shared object version number. This increments any time the API and ABI changes (so old apps will no longer link)
|
||||
#define OPENSHOT_VERSION_MAJOR_MINOR STRINGIZE(OPENSHOT_VERSION_MAJOR) "." STRINGIZE(OPENSHOT_VERSION_MINOR); /// A string of the "Major.Minor" version
|
||||
#define OPENSHOT_VERSION_ALL STRINGIZE(OPENSHOT_VERSION_MAJOR) "." STRINGIZE(OPENSHOT_VERSION_MINOR) "." STRINGIZE(OPENSHOT_VERSION_BUILD); /// A string of the entire version "Major.Minor.Build"
|
||||
#define OPENSHOT_VERSION_MAJOR_MINOR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@" /// A string of the "Major.Minor" version
|
||||
|
||||
#define OPENSHOT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ /// Major version number is incremented when huge features are added or improved.
|
||||
#define OPENSHOT_VERSION_MINOR @PROJECT_VERSION_MINOR@ /// Minor version is incremented when smaller (but still very important) improvements are added.
|
||||
#define OPENSHOT_VERSION_BUILD @PROJECT_VERSION_PATCH@ /// Build number is incremented when minor bug fixes and less important improvements are added.
|
||||
|
||||
#define OPENSHOT_VERSION_SO @PROJECT_SO_VERSION@ /// Shared object version number. This increments any time the API and ABI changes (so old apps will no longer link)
|
||||
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Header file for UnitTests
|
||||
* @author Jonathan Thomas <jonathan@openshot.org>
|
||||
*
|
||||
* @ref License
|
||||
*/
|
||||
|
||||
/* LICENSE
|
||||
*
|
||||
* Copyright (c) 2008-2019 OpenShot Studios, LLC
|
||||
* <http://www.openshotstudios.com/>. This file is part of
|
||||
* OpenShot Library (libopenshot), an open-source project dedicated to
|
||||
* delivering high quality video editing and animation solutions to the
|
||||
* world. For more information visit <http://www.openshot.org/>.
|
||||
*
|
||||
* OpenShot Library (libopenshot) is free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* OpenShot Library (libopenshot) is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPENSHOT_UNITTESTS_H
|
||||
#define OPENSHOT_UNITTESTS_H
|
||||
|
||||
#ifndef TEST_MEDIA_PATH
|
||||
#define TEST_MEDIA_PATH "../../src/examples/"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,9 @@
|
||||
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# Pick up our include directories from the parent context
|
||||
include_directories(${OPENSHOT_INCLUDE_DIRS})
|
||||
|
||||
################ OPTIONS ##################
|
||||
# Optional build settings for libopenshot
|
||||
OPTION(USE_SYSTEM_JSONCPP "Use system installed JsonCpp" OFF)
|
||||
@@ -299,7 +302,7 @@ add_library(openshot SHARED
|
||||
set_target_properties(openshot
|
||||
PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${SO_VERSION}
|
||||
SOVERSION ${PROJECT_SO_VERSION}
|
||||
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
|
||||
)
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
%shared_ptr(Frame)
|
||||
|
||||
%{
|
||||
#include "../../../include/Version.h"
|
||||
#include "OpenShotVersion.h"
|
||||
#include "../../../include/ReaderBase.h"
|
||||
#include "../../../include/WriterBase.h"
|
||||
#include "../../../include/CacheBase.h"
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
%include "../../../include/Version.h"
|
||||
%include "OpenShotVersion.h"
|
||||
%include "../../../include/ReaderBase.h"
|
||||
%include "../../../include/WriterBase.h"
|
||||
%include "../../../include/CacheBase.h"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# Pick up our include directories from the parent context
|
||||
include_directories(${OPENSHOT_INCLUDE_DIRS})
|
||||
|
||||
############### RUBY BINDINGS ################
|
||||
FIND_PACKAGE(SWIG 2.0 REQUIRED)
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace std {
|
||||
#define RB_RSHIFT(a, b) RSHIFT(a, b)
|
||||
#undef RSHIFT
|
||||
#endif
|
||||
#include "../../../include/Version.h"
|
||||
#include "OpenShotVersion.h"
|
||||
#include "../../../include/ReaderBase.h"
|
||||
#include "../../../include/WriterBase.h"
|
||||
#include "../../../include/CacheBase.h"
|
||||
@@ -127,7 +127,7 @@ namespace std {
|
||||
%}
|
||||
#endif
|
||||
|
||||
%include "../../../include/Version.h"
|
||||
%include "OpenShotVersion.h"
|
||||
%include "../../../include/ReaderBase.h"
|
||||
%include "../../../include/WriterBase.h"
|
||||
%include "../../../include/CacheBase.h"
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
# Pick up our include directories from the parent context
|
||||
include_directories(${OPENSHOT_INCLUDE_DIRS})
|
||||
|
||||
SET(TEST_MEDIA_PATH "${PROJECT_SOURCE_DIR}/src/examples/")
|
||||
|
||||
################ WINDOWS ##################
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
@@ -81,4 +80,4 @@ TEST(ImageWriter_Test_Gif)
|
||||
CHECK_EQUAL(11, (int)pixels[pixel_index + 2]);
|
||||
CHECK_EQUAL(255, (int)pixels[pixel_index + 3]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include "UnitTest++.h"
|
||||
#include "../include/OpenShot.h"
|
||||
#include "../include/Tests.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace openshot;
|
||||
|
||||
Reference in New Issue
Block a user