/project/cmake/xbmc-config.cmake
/project/cmake/*.error
/project/cmake/addons/build
-/project/cmake/addons/depends/win32/build
+/project/cmake/addons/depends/build
/project/cmake/addons/output
# /project/Win32BuildSetup/
@for f in project/cmake/*.cmake; do \
install -m 0644 $$f $(DESTDIR)$(libdir)/xbmc; \
done
+ @for f in project/cmake/scripts/common/*.cmake; do \
+ install -m 0644 $$f $(DESTDIR)$(libdir)/xbmc; \
+ done
uninstall:
@echo "Removing XBMC..."
+++ /dev/null
-# - Add options without repeating them on the command line
-#
-# Synopsis:
-#
-# add_options (lang build opts)
-#
-# where:
-#
-# lang Name of the language whose compiler should receive the
-# options, e.g. CXX. If a comma-separated list is received
-# then the option is added for all those languages. Use the
-# special value ALL_LANGUAGES for these languages: CXX, C
-# and Fortran
-#
-# build Kind of build to which this options should apply,
-# such as DEBUG and RELEASE. This can also be a comma-
-# separated list. Use the special value ALL_BUILDS to apply
-# to all builds.
-#
-# opts List of options to add. Each should be quoted.
-#
-# Example:
-#
-# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
-
-function (add_options langs builds)
- # special handling of empty language specification
- if ("${langs}" STREQUAL "ALL_LANGUAGES")
- set (langs CXX C Fortran)
- endif ("${langs}" STREQUAL "ALL_LANGUAGES")
- foreach (lang IN LISTS langs)
- # prepend underscore if necessary
- foreach (build IN LISTS builds)
- if (NOT ("${build}" STREQUAL "ALL_BUILDS"))
- set (_bld "_${build}")
- string (TOUPPER "${_bld}" _bld)
- else (NOT ("${build}" STREQUAL "ALL_BUILDS"))
- set (_bld "")
- endif (NOT ("${build}" STREQUAL "ALL_BUILDS"))
- foreach (_opt IN LISTS ARGN)
- set (_var "CMAKE_${lang}_FLAGS${_bld}")
- #message (STATUS "Adding \"${_opt}\" to \${${_var}}")
- # remove it first
- string (REPLACE "${_opt}" "" _without "${${_var}}")
- string (STRIP "${_without}" _without)
- # we need to strip this one as well, so they are comparable
- string (STRIP "${${_var}}" _stripped)
- # if it wasn't there, then add it at the end
- if ("${_without}" STREQUAL "${_stripped}")
- # don't add any extra spaces if no options yet are set
- if (NOT ${_stripped} STREQUAL "")
- set (${_var} "${_stripped} ${_opt}")
- else (NOT ${_stripped} STREQUAL "")
- set (${_var} "${_opt}")
- endif (NOT ${_stripped} STREQUAL "")
- set (${_var} "${${_var}}" PARENT_SCOPE)
- endif ("${_without}" STREQUAL "${_stripped}")
- endforeach (_opt)
- endforeach (build)
- endforeach (lang)
-endfunction (add_options lang build)
-
-# set varname to flag unless user has specified something that matches regex
-function (set_default_option varname flag regex)
- if (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
- set (${varname} ${flag} PARENT_SCOPE)
- else (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
- set (${varname} PARENT_SCOPE)
- endif (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
- AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
-endfunction (set_default_option)
-
-# note: this must be called before project()
-macro (no_default_options)
- # prevent the platform probe to set options
- set (CMAKE_NOT_USING_CONFIG_FLAGS TRUE)
-endmacro (no_default_options)
endif()
get_filename_component(XBMCROOT "${XBMCROOT}" ABSOLUTE)
-if(NOT DEPENDS_PATH)
- set(DEPENDS_PATH "${CMAKE_BINARY_DIR}/addons")
-else()
- file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH)
-endif()
-# xbmc-config.cmake.in (further down) expects a "prefix" variable
-get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE)
+if(NOT WIN32)
+ if(NOT DEPENDS_PATH)
+ set(DEPENDS_PATH "${PROJECT_SOURCE_DIR}/output/depends")
+ else()
+ file(TO_CMAKE_PATH "${DEPENDS_PATH}" DEPENDS_PATH)
+ endif()
-#make sure CMAKE_PREFIX_PATH is set
-if(NOT CMAKE_PREFIX_PATH)
- set(CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
-else()
- file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
- list(APPEND CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
+ # make sure CMAKE_PREFIX_PATH is set
+ if(NOT CMAKE_PREFIX_PATH)
+ set(CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
+ else()
+ file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
+ list(APPEND CMAKE_PREFIX_PATH "${DEPENDS_PATH}")
+ endif()
endif()
if(NOT CMAKE_INSTALL_PREFIX)
- set(CMAKE_INSTALL_PREFIX ${prefix})
+ set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/output/addons")
endif()
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
-DBUILD_SHARED_LIBS=1)
if(PACKAGE_ZIP)
- #needed for project installing
+ # needed for project installing
list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1)
MESSAGE("package zip specified")
endif()
MESSAGE(${BUILD_ARGS})
endif()
-# parse version.txt to get the version info
-if (EXISTS "${XBMCROOT}/version.txt")
- file(STRINGS "${XBMCROOT}/version.txt" versions)
- foreach (version ${versions})
- string(REGEX MATCH "^[^ ]+" version_name ${version})
- string(REPLACE "${version_name} " "" version_value ${version})
- set(APP_${version_name} "${version_value}")
- endforeach()
+if(NOT ADDONS_TO_BUILD)
+ set(ADDONS_TO_BUILD "all")
+else()
+ message(STATUS "Building following addons: ${ADDONS_TO_BUILD}")
+ separate_arguments(ADDONS_TO_BUILD)
endif()
-# bail if we can't parse versions
-if (NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR)
- message(FATAL_ERROR "Could not determine app version! make sure that ${XBMCROOT}/version.txt exists")
-endif()
+if(NOT WIN32)
+ # copy the xbmc-prepare-env.cmake script to the depends path so that we can include it
+ file(COPY ${XBMCROOT}/project/cmake/scripts/common/xbmc-prepare-env.cmake DESTINATION ${DEPENDS_PATH}/lib/xbmc)
-### copy all the addon binding header files to include/xbmc
-# make sure include/xbmc exists and is empty
-set(XBMC_LIB_DIR ${DEPENDS_PATH}/lib/xbmc)
-if(NOT EXISTS "${XBMC_LIB_DIR}/")
- file(MAKE_DIRECTORY ${XBMC_LIB_DIR})
-endif()
+ # add the location of xbmc-prepare-env.cmake to CMAKE_MODULE_PATH so that it is found
+ list(APPEND CMAKE_MODULE_PATH ${DEPENDS_PATH}/lib/xbmc)
-set(XBMC_INCLUDE_DIR ${DEPENDS_PATH}/include/xbmc)
-if(NOT EXISTS "${XBMC_INCLUDE_DIR}/")
- file(MAKE_DIRECTORY ${XBMC_INCLUDE_DIR})
+ # include xbmc-prepare-env.cmake which contains the logic to install the addon header bindings etc
+ include(xbmc-prepare-env)
endif()
-# generate the proper xbmc-config.cmake file
-configure_file(${XBMCROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY)
-# copy cmake helpers to lib/xbmc
-file(COPY ${XBMCROOT}/project/cmake/xbmc-addon-helpers.cmake ${XBMCROOT}/project/cmake/AddOptions.cmake DESTINATION ${XBMC_LIB_DIR})
-
-### copy all the addon binding header files to include/xbmc
-# parse addon-bindings.mk to get the list of header files to copy
-file(STRINGS ${XBMCROOT}/xbmc/addons/addon-bindings.mk bindings)
-string(REPLACE "\n" ";" bindings "${bindings}")
-foreach(binding ${bindings})
- string(REPLACE " =" ";" binding "${binding}")
- string(REPLACE "+=" ";" binding "${binding}")
- list(GET binding 1 header)
- # copy the header file to include/xbmc
- file(COPY ${XBMCROOT}/${header} DESTINATION ${XBMC_INCLUDE_DIR})
-endforeach()
-
-
### get and build all the binary addons
# look for all the addons to be built
file(GLOB addons ${PROJECT_SOURCE_DIR}/addons/*.txt)
list(GET def 1 url)
list(GET def 2 revision)
- # make sure the output directory is clean
- if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}")
- file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
- endif()
+ list(FIND ADDONS_TO_BUILD ${id} idx)
+ if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all")
+ # make sure the output directory is clean
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/${id}")
+ file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/${id}/")
+ endif()
- # add the addon as an external project for automatic building
- externalproject_add(${id}
- GIT_REPOSITORY ${url}/${id}
+ # add the addon as an external project for automatic building
+ externalproject_add(${id}
+ GIT_REPOSITORY ${url}
GIT_TAG ${revision}
INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
CMAKE_ARGS ${BUILD_ARGS}
)
+ endif()
endforeach()
addon.xml
* <git-base-url> must be the base URL (i.e. the URL must not contain the name
of the git repository itself) of the git repository containing the addon.
- The name repository of the addon must be <addon-id>.
+ The repository name of the addon must be <addon-id>.
* <git-revision> must be a valid git tag/branch/commit in the addon's git
repository which will be used for the build.
The buildsystem uses the following variables (which can be passed into it when
executing cmake with the -D<variable-name>=<value> option) to e.g. access
specific paths:
+ * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that
+ you want to build (default is "all").
* CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
or "Release" (default is "Release").
* CMAKE_INSTALL_PREFIX points to the directory where the built addons and their
* Any dependencies of the addons must already be built and their include and
library files must be present in the path pointed to by <CMAKE_PREFIX_PATH> (in
"include" and "lib" sub-directories).
- * The xbmc-config.cmake.in must be located at <XBMCROOT>/project/cmake. It can
- use any of the variables used in CMakeLists.txt using the @variable@
- notation. The variables will be replaced with the actual values and the
- resulting file will be installed to <PREFIX>/lib/xbmc/xbmc-config.cmake.
To trigger the cmake-based buildsystem the following command must be executed
with <path> being the path to this directory (absolute or relative, allowing for
-audioencoder.flac https://github.com/xbmc 84bdf32
+audioencoder.flac https://github.com/xbmc/audioencoder.flac 84bdf32
-audioencoder.lame https://github.com/xbmc 90fb99b
+audioencoder.lame https://github.com/xbmc/audioencoder.lame 90fb99b
-audioencoder.vorbis https://github.com/xbmc a73ef7e
+audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis a73ef7e
-audioencoder.wav https://github.com/xbmc b28ab95
+audioencoder.wav https://github.com/xbmc/audioencoder.wav b28ab95
--- /dev/null
+project(xbmc-addons-depends)
+
+cmake_minimum_required(VERSION 2.8)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+if(NOT CORE_SYSTEM_NAME)
+ string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
+endif()
+
+include(ExternalProject)
+
+if(NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/../output/depends)
+else()
+ file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
+endif()
+get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
+
+## handle dependencies with a cmake based buildsystem which need to be downloaded, built and installed
+file(GLOB_RECURSE cmake_input_files ${CORE_SYSTEM_NAME}/cmake/*.txt)
+file(GLOB_RECURSE cmake_input_files2 common/*.txt)
+list(APPEND cmake_input_files ${cmake_input_files2})
+foreach(file ${cmake_input_files})
+ if(NOT (file MATCHES CMakeLists.txt OR
+ file MATCHES install.txt OR
+ file MATCHES noinstall.txt OR
+ file MATCHES flags.txt OR
+ file MATCHES deps.txt))
+ message(STATUS "Processing ${file}")
+ file(STRINGS ${file} def)
+ string(REPLACE " " ";" def ${def})
+ list(LENGTH def deflength)
+ get_filename_component(dir ${file} PATH)
+
+ # get the id and url of the dependency
+ set(url "")
+ if(NOT "${def}" STREQUAL "")
+ # read the id and the url from the file
+ list(GET def 0 id)
+ if(deflength GREATER 1)
+ list(GET def 1 url)
+ message(STATUS "${id} url: ${url}")
+ endif()
+ else()
+ # read the id from the filename
+ get_filename_component(id ${file} NAME_WE)
+ endif()
+
+ # check if there are any library specific flags that need to be passed on
+ if(EXISTS ${dir}/flags.txt})
+ file(STRINGS ${dir}/flags.txt extraflags)
+ message(STATUS "${id} extraflags: ${extraflags}")
+ endif()
+
+ set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ -DARCH_DEFINES=${ARCH_DEFINES}
+ -DENABLE_STATIC=1
+ -DBUILD_SHARED_LIBS=0
+ "${extraflags}")
+
+ if(CMAKE_TOOLCHAIN_FILE)
+ list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
+ MESSAGE("toolchain specified")
+ MESSAGE(${BUILD_ARGS})
+ endif()
+
+ # if there's a CMakeLists.txt use it to prepare the build
+ if(EXISTS ${dir}/CMakeLists.txt)
+ set(PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${dir}/CMakeLists.txt
+ ${CMAKE_BINARY_DIR}/build/${id}/src/${id})
+ else()
+ set(PATCH_COMMAND "")
+ endif()
+
+ # if there's an install.txt use it to properly install the built files
+ if(EXISTS ${dir}/install.txt)
+ set(INSTALL_COMMAND INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DINPUTDIR=${CMAKE_BINARY_DIR}/build/${id}/src/${id}-build/
+ -DINPUTFILE=${dir}/install.txt
+ -DDESTDIR=${CMAKE_INSTALL_PREFIX}
+ -DENABLE_STATIC=1
+ "${extraflags}"
+ -P ${PROJECT_SOURCE_DIR}/install.cmake)
+ elseif(EXISTS ${dir}/noinstall.txt)
+ set(INSTALL_COMMAND INSTALL_COMMAND "")
+ else()
+ set(INSTALL_COMMAND "")
+ endif()
+
+ # check if there's a deps.txt containing dependencies on other libraries
+ if(EXISTS ${dir}/deps.txt})
+ file(STRINGS ${dir}/deps.txt deps)
+ message(STATUS "${id} dependencies: ${deps}")
+ set(DEPENDS_COMMAND DEPENDS ${deps})
+ else()
+ set(DEPENDS_COMMAND "")
+ endif()
+
+ # prepare the setup of the call to externalproject_add()
+ set(EXTERNALPROJECT_SETUP PREFIX build/${id}
+ CMAKE_ARGS ${BUILD_ARGS}
+ PATCH_COMMAND ${PATCH_COMMAND}
+ "${INSTALL_COMMAND}"
+ "${DEPENDS_COMMAND}")
+
+ # if there's an url defined we need to pass that to externalproject_add()
+ if(DEFINED url AND NOT "${url}" STREQUAL "")
+ # check if there's a third parameter in the file
+ if(deflength GREATER 2)
+ # the third parameter is considered as a revision of a git repository
+ list(GET def 2 revision)
+
+ externalproject_add(${id}
+ GIT_REPOSITORY ${url}
+ GIT_TAG ${revision}
+ "${EXTERNALPROJECT_SETUP}"
+ )
+ else()
+ externalproject_add(${id}
+ URL ${url}
+ "${EXTERNALPROJECT_SETUP}"
+ )
+ endif()
+ else()
+ externalproject_add(${id}
+ SOURCE_DIR ${dir}
+ "${EXTERNALPROJECT_SETUP}"
+ )
+ endif()
+ endif()
+endforeach()
+
+## if there's a platform-specific sub-directory containing a CMakeLists.txt, add it to the build as well
+if(EXISTS ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt)
+ message(STATUS "Processing ${CORE_SYSTEM_NAME}")
+ add_subdirectory(${CORE_SYSTEM_NAME})
+else()
+ message(FATAL_ERROR "CORE_SYSTEM_NAME: ${PROJECT_SOURCE_DIR}/${CORE_SYSTEM_NAME}/CMakeLists.txt")
+endif()
\ No newline at end of file
--- /dev/null
+XBMC ADDON DEPENDENCIES
+=======================
+This directory contains the cmake-based buildsystem for addon dependencies. It
+looks into the "common" and the "<platform>/cmake" sub-directories and parses
+all *.txt files recursively. Each dependency must have its own <dependency>.txt
+file (either in the main sub-directory or in a separate subdirectory of the main
+subdirectory) which must follow one of the defined formats:
+ * an empty file means that no extra downloads are necessary
+ * <dependency>
+ * <dependency> <url>
+ * <dependency> <git-url> <git-revision>
+where
+ * <dependency> must be identical to the filename
+ * <url> must be the URL to an archive that is downloaded and extracted.
+ * <git-url> must be the URL of the git repository containing the
+ dependency.
+ * <git-revision> must be a valid git tag/branch/commit in the dependency's git
+ repository which will be used for the build.
+
+Reserved filenames (for additional information on how to build a dependency)
+are:
+ * CMakeLists.txt: build instructions for the dependency
+ * install.txt: instructions on how to install the dependency's built files
+ * noinstall.txt: no installation step required (content is ignored)
+ * flags.txt: additional build flags
+ * deps.txt: whitespace separated list of dependencies of this dependency
+
+The buildsystem uses the following variables (which can be passed into it when
+executing cmake with the -D<variable-name>=<value> option) to e.g. access
+specific paths:
+ * CMAKE_BUILD_TYPE specifies the type of the build. This can be either "Debug"
+ or "Release" (default is "Release").
+ * CMAKE_INSTALL_PREFIX points to the directory where the built dependencies
+ (their include and library file) will be installed to.
+ * CMAKE_TOOLCHAIN_FILE can be used to pass a toolchain file into the add-on
+ builds.
+ * CORE_SYSTEM_NAME is the name of the platform (e.g. "linux" or "android") in
+ lower-case (defaults to lowercase(CMAKE_SYSTEM_NAME)).
+ * XBMCROOT points to the root directory of the xbmc project (default is the
+ absolute representation of ../../.. starting from this directory).
+ * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
+ (defaults to empty).
+
+To trigger the cmake-based buildsystem the following command must be executed
+with <path> being the path to this directory (absolute or relative, allowing for
+in-source and out-of-source builds).
+
+ cmake <path> -G <generator>
+
+cmake supports multiple generators, see
+http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
+
+In case of additional options the call might look like this
+
+ cmake <path> [-G <generator>] \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DXBMCROOT="<path-to-xbmc-root>" \
+ -DARCH_DEFINES="-DTARGET_LINUX" \
+ -DCMAKE_INSTALL_PREFIX="<path-to-install-directory"
+++ /dev/null
-project(xbmc-addons-depends-win32)
-
-cmake_minimum_required(VERSION 2.8)
-
-list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
-
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
-endif()
-
-include(ExternalProject)
-
-if(NOT CMAKE_INSTALL_PREFIX)
- set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/depends)
-endif()
-list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
-
-function(add_internal id url inputfile)
- externalproject_add(${id}
- URL ${url}
- PREFIX build/${id}
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ${CMAKE_COMMAND}
- -DINPUTDIR=${CMAKE_BINARY_DIR}/build/${id}/src/${id}
- -DINPUTFILE=${inputfile}
- -DDESTDIR=${CMAKE_INSTALL_PREFIX}
- -P ${PROJECT_SOURCE_DIR}/install.cmake)
-endfunction()
-
-function(add_7zip id url inputfile)
- externalproject_add(${id}
- PREFIX build/${id}
- DOWNLOAD_COMMAND ${CMAKE_COMMAND}
- -D7ZIP_EXECUTABLE=${7ZIP_EXECUTABLE}
- -DURL=${url}
- -DDEST=${CMAKE_BINARY_DIR}/build/${id}/src/${id}
- -DDESTDIR=${CMAKE_BINARY_DIR}/build/${id}/src/${id}-build
- -P ${PROJECT_SOURCE_DIR}/extract-7z.cmake
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ${CMAKE_COMMAND}
- -DINPUTDIR=${CMAKE_BINARY_DIR}/build/${id}/src/${id}-build/
- -DINPUTFILE=${inputfile}
- -DDESTDIR=${CMAKE_INSTALL_PREFIX}
- -P ${PROJECT_SOURCE_DIR}/install.cmake)
-endfunction()
-
-#find_package(7Zip REQUIRED)
-
-file(GLOB_RECURSE download_input_files prebuilt/*.txt)
-foreach(file ${download_input_files})
- if(NOT file MATCHES install.txt)
- file(STRINGS ${file} def)
- get_filename_component(dir ${file} PATH)
- string(REPLACE " " ";" def ${def})
- list(GET def 0 id)
- list(GET def 1 url)
- # if(url MATCHES .7z OR url MATCHES .lzma)
- # add_7zip(${id} ${url} ${dir}/install.txt)
- # else()
- add_internal(${id} ${url} ${dir}/install.txt)
- # endif()
- endif()
-endforeach()
+++ /dev/null
-find_program(7ZIP_EXECUTABLE NAMES 7z.exe
- HINTS PATHS "c:/Program Files/7-Zip")
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(7Zip DEFAULT_MSG 7ZIP_EXECUTABLE)
-
-mark_as_advanced(7ZIP_EXECUTABLE)
+++ /dev/null
-XBMC WIN32 ADDON DEPENDENCIES
-=============================
-This directory contains the cmake-based buildsystem for dependencies (currently
-only prebuilt) used by one or multiple addons. The buildsystem looks into the
-"prebuilt" sub-directory, downloads all the specified dependencies, extracts
-them and places them into the "depends" sub-directory.
-
-To trigger the cmake-based buildsystem the following command must be executed
-with <path> being the path to this directory (absolute or relative, allowing for
-in-source and out-of-source builds).
-
- cmake <path> -G <generator>
-
-cmake supports multiple generators, see
-http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
-For win32 builds one of the "Visual Studio XX" or the "NMake Makefiles"
-generators is preferred. For the "NMake Makefiles" generator to work the above
-command must be called from an environment prepared for VC++ builds (see
-http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
+++ /dev/null
-get_filename_component(file ${URL} NAME)
-file(DOWNLOAD ${URL} ${DEST}/${file})
-execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DEST}/${file}
- WORKING_DIRECTORY ${DESTDIR})
-if(${file} MATCHES .tar)
- string(REPLACE ".7z" "" tarball ${file})
- string(REPLACE ".lzma" "" tarball ${file})
- execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DESTDIR}/${tarball}
- WORKING_DIRECTORY ${DESTDIR})
-endif()
+++ /dev/null
-get_filename_component(file ${URL} NAME)
-file(DOWNLOAD ${URL} ${DEST}/${file})
+++ /dev/null
-if(EXISTS "${INPUTFILE}")
- # if there's an input file we use it to determine which files to copy where
- file(STRINGS ${INPUTFILE} FILES)
- string(REPLACE "\n" ";" FILES "${FILES}")
- foreach(file ${FILES})
- string(REPLACE " " ";" file "${file}")
- list(GET file 0 dir)
- list(GET file 1 dest)
- list(LENGTH file deflength)
- if(deflength GREATER 2)
- list(GET file 2 copy)
- endif()
- file(GLOB files ${INPUTDIR}/${dir})
- foreach(instfile ${files})
- file(COPY ${instfile} DESTINATION ${DESTDIR}/${dest})
- if(copy)
- file(COPY ${instfile} DESTINATION ${DESTDIR}/${copy})
- endif()
- endforeach()
- endforeach()
-else()
- # otherwise we assume that the content of the extracted archive is already well-formed and can just be copied
- file(COPY ${INPUTDIR}/${dir} DESTINATION ${DESTDIR})
-endif()
\ No newline at end of file
+++ /dev/null
-XBMC WIN32 PREBUILT ADDON DEPENDENCIES
-======================================
-This directory contains a file or sub-directory for every prebuilt dependency
-used by one of the addons being built. There are two different modes supported.
-Both include a file named <library-id>.txt which must follow the defined format
- <library-id> <download-url>
-
-If the archive, which the <download-url> points at, contains
- * only the necessary files and in the proper directory structure (i.e. an
- "include" and a "lib" directory) then the file must be put into this
- directory and nothing else is needed.
- * unnecessary files and/or does not follow the defined directory structure
- (i.e. an "include" and a "lib" directory) then the file must be put into a
- sub-directory named <library-id>. Furthermore an additional file called
- "install.txt" must be placed in that sub-directory. install.txt contains a
- line for every path/directory/file with a destination where it must be copied
- to. It must follow the defined format
- <source> <destination> [<copy-destination>]
- where <source> must be an existing file, directory or a path containing
- wildcards, <destination> and the optional <copy-destination> must be existing
- directories.
+++ /dev/null
-flac http://mirrors.xbmc.org/build-deps/win32/flac-1.2.1-devel-win.zip
+++ /dev/null
-include/FLAC/* include/FLAC
-lib/libFLAC_static.lib lib
+++ /dev/null
-lame http://mirrors.xbmc.org/build-deps/win32/libmp3lame-3.99.5-static-win32-2.zip
\ No newline at end of file
+++ /dev/null
-include/ogg/* include/ogg
-lib/* lib
+++ /dev/null
-ogg http://mirrors.xbmc.org/build-deps/win32/libogg-vc100-1.2.0-lib.tar.bz2
+++ /dev/null
-include/vorbis/* include/vorbis
-lib/* lib
+++ /dev/null
-vorbis http://mirrors.xbmc.org/build-deps/win32/libvorbis-vc100-1.3.1-lib.tar.bz2
--- /dev/null
+project(xbmc-addons-depends-windows)
+
+cmake_minimum_required(VERSION 2.8)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+include(ExternalProject)
+
+if(NOT CMAKE_INSTALL_PREFIX)
+ message(FATAL_ERROR "CMAKE_INSTALL_PREFIX (${CMAKE_INSTALL_PREFIX}) is not a valid target directory.")
+else()
+ file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
+endif()
+get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
+
+function(add_internal id url inputfile)
+ externalproject_add(${id}
+ URL ${url}
+ PREFIX build/${id}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND}
+ -DINPUTDIR=${PROJECT_BINARY_DIR}/build/${id}/src/${id}
+ -DINPUTFILE=${inputfile}
+ -DDESTDIR=${CMAKE_INSTALL_PREFIX}
+ -P ${PROJECT_SOURCE_DIR}/install.cmake
+ )
+endfunction()
+
+#find_package(7Zip REQUIRED)
+
+file(GLOB_RECURSE download_input_files prebuilt/*.txt)
+foreach(file ${download_input_files})
+ if(NOT file MATCHES install.txt)
+ file(STRINGS ${file} def)
+ get_filename_component(dir ${file} PATH)
+ string(REPLACE " " ";" def ${def})
+ list(GET def 0 id)
+ list(GET def 1 url)
+ add_internal(${id} ${url} ${dir}/install.txt)
+ endif()
+endforeach()
--- /dev/null
+find_program(7ZIP_EXECUTABLE NAMES 7z.exe
+ HINTS PATHS "c:/Program Files/7-Zip")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(7Zip DEFAULT_MSG 7ZIP_EXECUTABLE)
+
+mark_as_advanced(7ZIP_EXECUTABLE)
--- /dev/null
+XBMC WIN32 ADDON DEPENDENCIES
+=============================
+This directory contains the cmake-based buildsystem for dependencies (currently
+only prebuilt) used by one or multiple addons. The buildsystem looks into the
+"prebuilt" sub-directory, downloads all the specified dependencies, extracts
+them and places them into the "depends" sub-directory.
+
+To trigger the cmake-based buildsystem the following command must be executed
+with <path> being the path to this directory (absolute or relative, allowing for
+in-source and out-of-source builds).
+
+ cmake <path> [-G <generator>]
+
+cmake supports multiple generators, see
+http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
+For win32 builds one of the "Visual Studio XX" or the "NMake Makefiles"
+generators is preferred. For the "NMake Makefiles" generator to work the above
+command must be called from an environment prepared for VC++ builds (see
+http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
--- /dev/null
+project(xbmc)
+
+cmake_minimum_required(VERSION 2.8)
+
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
+
+### setup all the necessary paths
+if(NOT XBMCROOT)
+ set(XBMCROOT ${PROJECT_SOURCE_DIR}/../../../../../../..)
+else()
+ file(TO_CMAKE_PATH "${XBMCROOT}" XBMCROOT)
+endif()
+get_filename_component(XBMCROOT "${XBMCROOT}" ABSOLUTE)
+
+if(NOT CMAKE_INSTALL_PREFIX)
+ message(FATAL_ERROR "CMAKE_INSTALL_PREFIX (${CMAKE_INSTALL_PREFIX}) is not a valid target directory.")
+else()
+ file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX)
+endif()
+get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
+
+### prepare the environment
+# set the DEPENDS_PATH variable used by xbmc-prepare-env
+set(DEPENDS_PATH "${CMAKE_INSTALL_PREFIX}")
+
+# copy the xbmc-prepare-env.cmake script so that we can include it
+file(COPY ${XBMCROOT}/project/cmake/scripts/common/xbmc-prepare-env.cmake DESTINATION ${CMAKE_BINARY_DIR})
+
+# include xbmc-prepare-env.cmake which contains the logic to install the addon header bindings etc
+include(xbmc-prepare-env)
\ No newline at end of file
--- /dev/null
+xbmc
\ No newline at end of file
--- /dev/null
+get_filename_component(file ${URL} NAME)
+file(DOWNLOAD ${URL} ${DEST}/${file})
+execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DEST}/${file}
+ WORKING_DIRECTORY ${DESTDIR})
+if(${file} MATCHES .tar)
+ string(REPLACE ".7z" "" tarball ${file})
+ string(REPLACE ".lzma" "" tarball ${file})
+ execute_process(COMMAND ${7ZIP_EXECUTABLE} -y x ${DESTDIR}/${tarball}
+ WORKING_DIRECTORY ${DESTDIR})
+endif()
--- /dev/null
+get_filename_component(file ${URL} NAME)
+file(DOWNLOAD ${URL} ${DEST}/${file})
--- /dev/null
+if(EXISTS "${INPUTFILE}")
+ # if there's an input file we use it to determine which files to copy where
+ file(STRINGS ${INPUTFILE} FILES)
+ string(REPLACE "\n" ";" FILES "${FILES}")
+ foreach(file ${FILES})
+ string(REPLACE " " ";" file "${file}")
+ list(GET file 0 dir)
+ list(GET file 1 dest)
+ list(LENGTH file deflength)
+ if(deflength GREATER 2)
+ list(GET file 2 copy)
+ endif()
+ file(GLOB files ${INPUTDIR}/${dir})
+ foreach(instfile ${files})
+ file(COPY ${instfile} DESTINATION ${DESTDIR}/${dest})
+ if(copy)
+ file(COPY ${instfile} DESTINATION ${DESTDIR}/${copy})
+ endif()
+ endforeach()
+ endforeach()
+else()
+ # otherwise we assume that the content of the extracted archive is already well-formed and can just be copied
+ file(COPY ${INPUTDIR}/${dir} DESTINATION ${DESTDIR})
+endif()
\ No newline at end of file
--- /dev/null
+XBMC WIN32 PREBUILT ADDON DEPENDENCIES
+======================================
+This directory contains a file or sub-directory for every prebuilt dependency
+used by one of the addons being built. There are two different modes supported.
+Both include a file named <library-id>.txt which must follow the defined format
+ <library-id> <download-url>
+
+If the archive, which the <download-url> points at, contains
+ * only the necessary files and in the proper directory structure (i.e. an
+ "include" and a "lib" directory) then the file must be put into this
+ directory and nothing else is needed.
+ * unnecessary files and/or does not follow the defined directory structure
+ (i.e. an "include" and a "lib" directory) then the file must be put into a
+ sub-directory named <library-id>. Furthermore an additional file called
+ "install.txt" must be placed in that sub-directory. install.txt contains a
+ line for every path/directory/file with a destination where it must be copied
+ to. It must follow the defined format
+ <source> <destination> [<copy-destination>]
+ where <source> must be an existing file, directory or a path containing
+ wildcards, <destination> and the optional <copy-destination> must be existing
+ directories.
--- /dev/null
+flac http://mirrors.xbmc.org/build-deps/win32/flac-1.2.1-devel-win.zip
--- /dev/null
+include/FLAC/* include/FLAC
+lib/libFLAC_static.lib lib
--- /dev/null
+lame http://mirrors.xbmc.org/build-deps/win32/libmp3lame-3.99.5-static-win32-2.zip
\ No newline at end of file
--- /dev/null
+include/ogg/* include/ogg
+lib/* lib
--- /dev/null
+ogg http://mirrors.xbmc.org/build-deps/win32/libogg-vc100-1.2.0-lib.tar.bz2
--- /dev/null
+include/vorbis/* include/vorbis
+lib/* lib
--- /dev/null
+vorbis http://mirrors.xbmc.org/build-deps/win32/libvorbis-vc100-1.3.1-lib.tar.bz2
--- /dev/null
+# - Add options without repeating them on the command line
+#
+# Synopsis:
+#
+# add_options (lang build opts)
+#
+# where:
+#
+# lang Name of the language whose compiler should receive the
+# options, e.g. CXX. If a comma-separated list is received
+# then the option is added for all those languages. Use the
+# special value ALL_LANGUAGES for these languages: CXX, C
+# and Fortran
+#
+# build Kind of build to which this options should apply,
+# such as DEBUG and RELEASE. This can also be a comma-
+# separated list. Use the special value ALL_BUILDS to apply
+# to all builds.
+#
+# opts List of options to add. Each should be quoted.
+#
+# Example:
+#
+# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
+
+function (add_options langs builds)
+ # special handling of empty language specification
+ if ("${langs}" STREQUAL "ALL_LANGUAGES")
+ set (langs CXX C Fortran)
+ endif ("${langs}" STREQUAL "ALL_LANGUAGES")
+ foreach (lang IN LISTS langs)
+ # prepend underscore if necessary
+ foreach (build IN LISTS builds)
+ if (NOT ("${build}" STREQUAL "ALL_BUILDS"))
+ set (_bld "_${build}")
+ string (TOUPPER "${_bld}" _bld)
+ else (NOT ("${build}" STREQUAL "ALL_BUILDS"))
+ set (_bld "")
+ endif (NOT ("${build}" STREQUAL "ALL_BUILDS"))
+ foreach (_opt IN LISTS ARGN)
+ set (_var "CMAKE_${lang}_FLAGS${_bld}")
+ #message (STATUS "Adding \"${_opt}\" to \${${_var}}")
+ # remove it first
+ string (REPLACE "${_opt}" "" _without "${${_var}}")
+ string (STRIP "${_without}" _without)
+ # we need to strip this one as well, so they are comparable
+ string (STRIP "${${_var}}" _stripped)
+ # if it wasn't there, then add it at the end
+ if ("${_without}" STREQUAL "${_stripped}")
+ # don't add any extra spaces if no options yet are set
+ if (NOT ${_stripped} STREQUAL "")
+ set (${_var} "${_stripped} ${_opt}")
+ else (NOT ${_stripped} STREQUAL "")
+ set (${_var} "${_opt}")
+ endif (NOT ${_stripped} STREQUAL "")
+ set (${_var} "${${_var}}" PARENT_SCOPE)
+ endif ("${_without}" STREQUAL "${_stripped}")
+ endforeach (_opt)
+ endforeach (build)
+ endforeach (lang)
+endfunction (add_options lang build)
+
+# set varname to flag unless user has specified something that matches regex
+function (set_default_option varname flag regex)
+ if (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
+ set (${varname} ${flag} PARENT_SCOPE)
+ else (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
+ set (${varname} PARENT_SCOPE)
+ endif (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
+ AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
+endfunction (set_default_option)
+
+# note: this must be called before project()
+macro (no_default_options)
+ # prevent the platform probe to set options
+ set (CMAKE_NOT_USING_CONFIG_FLAGS TRUE)
+endmacro (no_default_options)
--- /dev/null
+# Workaround for the fact that cpack's filenames are not customizable.
+# Each add-on is added as a separate component to facilitate zip/tgz packaging.
+# The filenames are always of the form basename-component, which is
+# incompatible with the addonid-version scheme we want. This hack renames
+# the files from the file names generated by the 'package' target.
+# Sadly we cannot extend the 'package' target, as it is a builtin target, see
+# http://public.kitware.com/Bug/view.php?id=8438
+# Thus, we have to add an 'addon-package' target.
+add_custom_target(addon-package
+ COMMAND cmake --build ${CMAKE_BINARY_DIR} --target package)
+
+macro(add_cpack_workaround target version ext)
+ add_custom_command(TARGET addon-package PRE_BUILD
+ COMMAND cmake -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext})
+endmacro()
+
+# Grab the version from a given add-on's addon.xml
+macro (addon_version dir prefix)
+ FILE(READ ${dir}/addon.xml ADDONXML)
+ STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML})
+ STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING})
+ message(STATUS ${prefix}_VERSION=${${prefix}_VERSION})
+endmacro()
+
+# Build, link and optionally package an add-on
+macro (build_addon target prefix libs)
+ ADD_LIBRARY(${target} ${${prefix}_SOURCES})
+ TARGET_LINK_LIBRARIES(${target} ${${libs}})
+ addon_version(${target} ${prefix})
+ SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${${prefix}_VERSION}
+ SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
+ PREFIX "")
+ IF(OS STREQUAL "android")
+ SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib")
+ ENDIF(OS STREQUAL "android")
+
+ # set zip as default if addon-package is called without PACKAGE_XXX
+ SET(CPACK_GENERATOR "ZIP")
+ SET(ext "zip")
+ IF(PACKAGE_ZIP OR PACKAGE_TGZ)
+ IF(PACKAGE_TGZ)
+ SET(CPACK_GENERATOR "TGZ")
+ SET(ext "tar.gz")
+ ENDIF(PACKAGE_TGZ)
+ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
+ set(CPACK_PACKAGE_FILE_NAME addon)
+ IF(CMAKE_BUILD_TYPE STREQUAL "Release")
+ SET(CPACK_STRIP_FILES TRUE)
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
+ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
+ set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+ list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION})
+ # Pack files together to create an archive
+ INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION})
+ IF(WIN32)
+ INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/${target}.dll
+ DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION})
+ ELSE(WIN32)
+ INSTALL(TARGETS ${target} DESTINATION ${target}
+ COMPONENT ${target}-${${prefix}_VERSION})
+ ENDIF(WIN32)
+ add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
+ ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
+ INSTALL(TARGETS ${target} DESTINATION lib/xbmc/addons/${target})
+ INSTALL(DIRECTORY ${target} DESTINATION share/xbmc/addons)
+ ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ)
+endmacro()
+
+# finds a path to a given file (recursive)
+function (xbmc_find_path var_name filename search_path strip_file)
+ file(GLOB_RECURSE PATH_TO_FILE ${search_path} ${filename})
+ if(strip_file)
+ string(REPLACE ${filename} "" PATH_TO_FILE ${PATH_TO_FILE})
+ endif(strip_file)
+ set (${var_name} ${PATH_TO_FILE} PARENT_SCOPE)
+endfunction()
+
+# Cmake build options
+include(addoptions)
+include(TestCXXAcceptsFlag)
+OPTION(PACKAGE_ZIP "Package Zip file?" OFF)
+OPTION(PACKAGE_TGZ "Package TGZ file?" OFF)
+OPTION(BUILD_SHARED_LIBS "Build shared libs?" ON)
+
+# LTO support?
+CHECK_CXX_ACCEPTS_FLAG("-flto" HAVE_LTO)
+IF(HAVE_LTO)
+ OPTION(USE_LTO "use link time optimization" OFF)
+ IF(USE_LTO)
+ add_options(ALL_LANGUAGES ALL_BUILDS "-flto")
+ ENDIF(USE_LTO)
+ENDIF(HAVE_LTO)
+
+# set this to try linking dependencies as static as possible
+IF(ADDONS_PREFER_STATIC_LIBS)
+ SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ENDIF(ADDONS_PREFER_STATIC_LIBS)
+
--- /dev/null
+# parse version.txt to get the version info
+if(EXISTS "${XBMCROOT}/version.txt")
+ file(STRINGS "${XBMCROOT}/version.txt" versions)
+ foreach (version ${versions})
+ string(REGEX MATCH "^[^ ]+" version_name ${version})
+ string(REPLACE "${version_name} " "" version_value ${version})
+ set(APP_${version_name} "${version_value}")
+ endforeach()
+endif()
+
+# bail if we can't parse versions
+if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR)
+ message(FATAL_ERROR "Could not determine app version! make sure that ${XBMCROOT}/version.txt exists")
+endif()
+
+### copy all the addon binding header files to include/xbmc
+# make sure include/xbmc exists and is empty
+set(XBMC_LIB_DIR ${DEPENDS_PATH}/lib/xbmc)
+if(NOT EXISTS "${XBMC_LIB_DIR}/")
+ file(MAKE_DIRECTORY ${XBMC_LIB_DIR})
+endif()
+
+set(XBMC_INCLUDE_DIR ${DEPENDS_PATH}/include/xbmc)
+if(NOT EXISTS "${XBMC_INCLUDE_DIR}/")
+ file(MAKE_DIRECTORY ${XBMC_INCLUDE_DIR})
+endif()
+
+# xbmc-config.cmake.in (further down) expects a "prefix" variable
+get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE)
+
+# generate the proper xbmc-config.cmake file
+configure_file(${XBMCROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY)
+# copy cmake helpers to lib/xbmc
+file(COPY ${XBMCROOT}/project/cmake/scripts/common/xbmc-addon-helpers.cmake ${XBMCROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${XBMC_LIB_DIR})
+
+### copy all the addon binding header files to include/xbmc
+# parse addon-bindings.mk to get the list of header files to copy
+file(STRINGS ${XBMCROOT}/xbmc/addons/addon-bindings.mk bindings)
+string(REPLACE "\n" ";" bindings "${bindings}")
+foreach(binding ${bindings})
+ string(REPLACE " =" ";" binding "${binding}")
+ string(REPLACE "+=" ";" binding "${binding}")
+ list(GET binding 1 header)
+ # copy the header file to include/xbmc
+ file(COPY ${XBMCROOT}/${header} DESTINATION ${XBMC_INCLUDE_DIR})
+endforeach()
\ No newline at end of file
--- /dev/null
+if(MSVC)
+ set(CMAKE_C_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
+ set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
+ set(CMAKE_C_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+endif(MSVC)
\ No newline at end of file
--- /dev/null
+if(MSVC)
+ set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
+ set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
+ set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+endif(MSVC)
\ No newline at end of file
+++ /dev/null
-# Workaround for the fact that cpack's filenames are not customizable.
-# Each add-on is added as a separate component to facilitate zip/tgz packaging.
-# The filenames are always of the form basename-component, which is
-# incompatible with the addonid-version scheme we want. This hack renames
-# the files from the file names generated by the 'package' target.
-# Sadly we cannot extend the 'package' target, as it is a builtin target, see
-# http://public.kitware.com/Bug/view.php?id=8438
-# Thus, we have to add an 'addon-package' target.
-add_custom_target(addon-package
- COMMAND cmake --build ${CMAKE_BINARY_DIR} --target package)
-
-macro(add_cpack_workaround target version ext)
- add_custom_command(TARGET addon-package PRE_BUILD
- COMMAND cmake -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext})
-endmacro()
-
-# Grab the version from a given add-on's addon.xml
-macro (addon_version dir prefix)
- FILE(READ ${dir}/addon.xml ADDONXML)
- STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML})
- STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING})
- message(STATUS ${prefix}_VERSION=${${prefix}_VERSION})
-endmacro()
-
-# Build, link and optionally package an add-on
-macro (build_addon target prefix libs)
- ADD_LIBRARY(${target} ${${prefix}_SOURCES})
- TARGET_LINK_LIBRARIES(${target} ${${libs}})
- addon_version(${target} ${prefix})
- SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${${prefix}_VERSION}
- SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
- PREFIX "")
- IF(OS STREQUAL "android")
- SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib")
- ENDIF(OS STREQUAL "android")
-
- # set zip as default if addon-package is called without PACKAGE_XXX
- SET(CPACK_GENERATOR "ZIP")
- SET(ext "zip")
- IF(PACKAGE_ZIP OR PACKAGE_TGZ)
- IF(PACKAGE_TGZ)
- SET(CPACK_GENERATOR "TGZ")
- SET(ext "tar.gz")
- ENDIF(PACKAGE_TGZ)
- SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
- set(CPACK_PACKAGE_FILE_NAME addon)
- IF(CMAKE_BUILD_TYPE STREQUAL "Release")
- SET(CPACK_STRIP_FILES TRUE)
- ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
- set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
- set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
- list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION})
- # Pack files together to create an archive
- INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION})
- IF(WIN32)
- INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/${target}.dll
- DESTINATION ${target}
- COMPONENT ${target}-${${prefix}_VERSION})
- ELSE(WIN32)
- INSTALL(TARGETS ${target} DESTINATION ${target}
- COMPONENT ${target}-${${prefix}_VERSION})
- ENDIF(WIN32)
- add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
- ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
- INSTALL(TARGETS ${target} DESTINATION lib/xbmc/addons/${target})
- INSTALL(DIRECTORY ${target} DESTINATION share/xbmc/addons)
- ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ)
-endmacro()
-
-# finds a path to a given file (recursive)
-function (xbmc_find_path var_name filename search_path strip_file)
- file(GLOB_RECURSE PATH_TO_FILE ${search_path} ${filename})
- if(strip_file)
- string(REPLACE ${filename} "" PATH_TO_FILE ${PATH_TO_FILE})
- endif(strip_file)
- set (${var_name} ${PATH_TO_FILE} PARENT_SCOPE)
-endfunction()
-
-# Cmake build options
-include(AddOptions)
-include(TestCXXAcceptsFlag)
-OPTION(PACKAGE_ZIP "Package Zip file?" OFF)
-OPTION(PACKAGE_TGZ "Package TGZ file?" OFF)
-OPTION(BUILD_SHARED_LIBS "Build shared libs?" ON)
-
-# LTO support?
-CHECK_CXX_ACCEPTS_FLAG("-flto" HAVE_LTO)
-IF(HAVE_LTO)
- OPTION(USE_LTO "use link time optimization" OFF)
- IF(USE_LTO)
- add_options(ALL_LANGUAGES ALL_BUILDS "-flto")
- ENDIF(USE_LTO)
-ENDIF(HAVE_LTO)
-
-# set this to try linking dependencies as static as possible
-IF(ADDONS_PREFER_STATIC_LIBS)
- SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-ENDIF(ADDONS_PREFER_STATIC_LIBS)
-
+++ /dev/null
-if(MSVC)
- set(CMAKE_C_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
- set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
- set(CMAKE_C_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
-endif(MSVC)
\ No newline at end of file
+++ /dev/null
-if(MSVC)
- set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
- set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0")
- set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
-endif(MSVC)
\ No newline at end of file
SET CUR_PATH=%CD%
SET BASE_PATH=%WORKDIR%\project\cmake\
+SET SCRIPTS_PATH=%BASE_PATH%\scripts\windows
SET ADDONS_PATH=%BASE_PATH%\addons
SET ADDONS_OUTPUT_PATH=%ADDONS_PATH%\output
-SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\depends\win32
+SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\depends
SET ADDON_DEPENDS_BUILD_PATH=%ADDON_DEPENDS_PATH%\build
SET ERRORFILE=%BASE_PATH%\make-addon-depends.error
rem execute cmake to generate makefiles processable by nmake
cmake "%ADDON_DEPENDS_PATH%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
- -DCMAKE_INSTALL_PREFIX=%ADDONS_OUTPUT_PATH%
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE="%SCRIPTS_PATH%/xbmc-c-flag-overrides.cmake" ^
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%SCRIPTS_PATH%/xbmc-cxx-flag-overrides.cmake" ^ ^
+ -DCMAKE_INSTALL_PREFIX=%ADDONS_OUTPUT_PATH% ^
+ -DARCH_DEFINES="-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_"
IF ERRORLEVEL 1 (
ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE%
GOTO ERROR
rem setup some paths that we need later
SET CUR_PATH=%CD%
SET BASE_PATH=%WORKDIR%\project\cmake
+SET SCRIPTS_PATH=%BASE_PATH%\scripts\windows
SET ADDONS_PATH=%BASE_PATH%\addons
SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\output
SET ADDONS_BUILD_PATH=%ADDONS_PATH%\build
SET ERRORFILE=%BASE_PATH%\make-addons.error
-SET XBMC_INCLUDE_PATH=%ADDON_DEPENDS_PATH%\include\xbmc
-SET XBMC_LIB_PATH=%ADDON_DEPENDS_PATH%\lib\xbmc
-
rem determine whether make-addon-depends.bat should be called with noclean or not
SET addon_depends_mode=clean
IF %noclean% == true (
)
)
-rem make sure the xbmc include and library paths exist
-IF NOT EXIST "%XBMC_INCLUDE_PATH%" (
- MKDIR "%XBMC_INCLUDE_PATH%"
-)
-IF NOT EXIST "%XBMC_LIB_PATH%" (
- MKDIR "%XBMC_LIB_PATH%"
-)
-
rem create the build directory
IF NOT EXIST "%ADDONS_BUILD_PATH%" MKDIR "%ADDONS_BUILD_PATH%"
ECHO Building addons
ECHO --------------------------------------------------
+SET ADDONS_TO_BUILD="all"
+IF "%addon%" NEQ "" (
+ SET ADDONS_TO_BUILD="%addon%"
+)
+
rem execute cmake to generate makefiles processable by nmake
cmake "%ADDONS_PATH%" -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
- -DCMAKE_USER_MAKE_RULES_OVERRIDE="%BASE_PATH%/xbmc-c-flag-overrides.cmake" ^
- -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%BASE_PATH%/xbmc-cxx-flag-overrides.cmake" ^
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE="%SCRIPTS_PATH%/xbmc-c-flag-overrides.cmake" ^
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%SCRIPTS_PATH%/xbmc-cxx-flag-overrides.cmake" ^
-DCMAKE_INSTALL_PREFIX=%ADDONS_INSTALL_PATH% ^
-DXBMCROOT=%WORKDIR% ^
- -DDEPENDS_PATH=%ADDON_DEPENDS_PATH% ^
+ -DCMAKE_PREFIX_PATH=%ADDON_DEPENDS_PATH% ^
-DPACKAGE_ZIP=1 ^
- -DARCH_DEFINES="-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_"
+ -DARCH_DEFINES="-DTARGET_WINDOWS -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_USE_32BIT_TIME_T -D_WINSOCKAPI_" ^
+ -DADDONS_TO_BUILD="%ADDONS_TO_BUILD%"
IF ERRORLEVEL 1 (
ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE%
GOTO ERROR
-include ../../Makefile.include
-LIBNAME = xbmc-audioencoder-addons
-
+ADDONS = "audioencoder.flac audioencoder.lame audioencoder.vorbis audioencoder.wav"
ifeq ($(PLATFORM),)
PLATFORM = native
endif
mkdir -p $(PLATFORM); \
cd $(PLATFORM); \
$(CMAKE) -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX) -DCMAKE_PREFIX_PATH=$(PREFIX) $(CMAKE_EXTRA) \
- ../../../../../project/cmake/addons/ ;\
+ -DADDONS_TO_BUILD=$(ADDONS) ../../../../../project/cmake/addons/ ;\
$(MAKE);
touch $@