Commit a71a5af3 authored by François Grisez's avatar François Grisez

Adds CMake compilation support

parent 301d7626
cmake_minimum_required(VERSION 3.0)
project(matroska2
VERSION 0.22.1
LANGUAGES C
)
option(CONFIG_EBML_WRITING "Enable EBML file writing support" ON)
option(CONFIG_EBML_UNICODE "Enable Unicode support" ON)
option(CONFIG_DEBUGCHECKS "Enable internal checks" ON)
option(CONFIG_STDIO "Use stdio.h for writing" ON)
option(CONFIG_FILEPOS_64 "Encode filepos_t on 64bits" ON)
option(CONFIG_DEBUG_LEAKS "Enable internal menory leaks checking support" OFF)
configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
include_directories(${CMAKE_BINARY_DIR} ./corec)
add_subdirectory(corec/corec)
add_subdirectory(libebml2)
add_subdirectory(libmatroska2)
install(FILES ${CMAKE_BINARY_DIR}/config.h
DESTINATION ${CMAKE_INSTALL_DIR}/lib/matroska2/include/corec
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/Matroska2ConfigVersion.cmake
VERSION ${MATROSKA2_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(Matroska2Config.cmake.in
${CMAKE_BINARY_DIR}/Matroska2Config.cmake
@ONLY
)
install(FILES
${CMAKE_BINARY_DIR}/Matroska2ConfigVersion.cmake
${CMAKE_BINARY_DIR}/Matroska2Config.cmake
DESTINATION ${CMAKE_INSTALL_DIR}/lib/cmake/Matroska2
)
############################################################################
# Matroska2Config.cmake
# Copyright (C) 2015 Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
#
# Config file for the Matroska2 package.
# It defines the following variables:
#
# MATROSKA2_FOUND - system has Matroska2
# MATROSKA2_INCLUDE_DIRS - the Matroska2 include directory
# MATROSKA2_LIBRARIES - The libraries needed to use Matroska2
# MATROSKA2_CPPFLAGS - The cflags needed to use Matroska2
get_filename_component(MATROSKA2_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
set(MATROSKA2_INCLUDE_DIRS
${MATROSKA2_CMAKE_DIR}/../../../include
${MATROSKA2_CMAKE_DIR}/../../matroska2/include
)
set(MATROSKA2_LIBRARIES ${MATROSKA2_CMAKE_DIR}/../../libmatroska.a)
set(MATROSKA2_CPPFLAGS)
set(MATROSKA2_FOUND 1)
#cmakedefine CONFIG_EBML_WRITING
#cmakedefine CONFIG_EBML_UNICODE
#cmakedefine CONFIG_DEBUGCHECKS
#cmakedefine CONFIG_STDIO
#cmakedefine CONFIG_FILEPOS_64
#cmakedefine CONFIG_DEBUG_LEAKS
add_library(corec STATIC
array/array.c
helpers/charconvert/charconvert_linux.c
helpers/date/date_libc.c
helpers/file/bufstream.c
helpers/file/memstream.c
helpers/file/streams.c
helpers/file/tools.c
helpers/file/file_libc.c
helpers/file/stream_stdio.c
helpers/md5/md5.c
helpers/parser/parser2.c
helpers/parser/strtab.c
helpers/parser/strtypes.c
helpers/parser/dataheap.c
helpers/parser/buffer.c
helpers/parser/hotkey.c
helpers/parser/nodelookup.c
helpers/parser/urlpart.c
helpers/system/ccsystem_posix.c
multithread/multithread_pthread.c
node/node.c
node/nodetree.c
str/str_linux.c
)
install(FILES
banned.h
confhelper.h
corec.h
err.h
helper.h
memalloc.h
memheap.h
portab.h
DESTINATION ${CMAKE_INSTALL_DIR}/lib/matroska2/include/corec
)
\ No newline at end of file
add_library(ebml2 STATIC
ebmlmain.c
ebmlelement.c
ebmlmaster.c
ebmlbinary.c
ebmlstring.c
ebmlnumber.c
ebmlcrc.c
ebmldate.c
ebmlvoid.c
)
install(DIRECTORY ebml
DESTINATION ${CMAKE_INSTALL_DIR}/lib/matroska2/include
)
\ No newline at end of file
add_library(matroska2 STATIC
matroskamain.c
matroskablock.c
matroska_sem.c
)
target_include_directories(matroska2
PUBLIC ${CMAKE_SOURCE_DIR}/libebml2
PUBLIC ${CMAKE_SOURCE_DIR}/libmatroska2
)
target_link_libraries(matroska2 ebml2 corec)
install(DIRECTORY matroska
DESTINATION ${CMAKE_INSTALL_DIR}/include
)
install(TARGETS matroska2
ARCHIVE DESTINATION ${CMAKE_INSTALL_DIR}/lib
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment