diff options
author | Sascha Montellese <sascha.montellese@gmail.com> | 2014-08-01 10:21:23 +0200 |
---|---|---|
committer | Sascha Montellese <sascha.montellese@gmail.com> | 2014-08-01 10:21:23 +0200 |
commit | 6b54c290c11eed79dfd610cfcedaeb8683ca2124 (patch) | |
tree | 11a29c8d18a05ef919896ee40b5d727dd4a8f40b | |
parent | 4f40cef839b8376f44f38ba9c553959b11c32db1 (diff) | |
parent | 138aab9e10bcd0bdf60da3040b2bf372438699aa (diff) |
Merge pull request #5014 from Montellese/binary_addons
cmake: common addons depends buildsystem
36 files changed, 403 insertions, 158 deletions
diff --git a/.gitignore b/.gitignore index 375054dfef..714470b25e 100644 --- a/.gitignore +++ b/.gitignore @@ -344,7 +344,7 @@ lib/cpluff/stamp-h1 /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/ diff --git a/Makefile.in b/Makefile.in index a21013f198..cc0b40c1ca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -646,6 +646,9 @@ endif @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..." diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index e449078e75..e358855500 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt @@ -18,24 +18,24 @@ else() 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}) @@ -47,7 +47,7 @@ set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -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() @@ -58,51 +58,24 @@ if(CMAKE_TOOLCHAIN_FILE) 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) @@ -113,16 +86,19 @@ foreach(addon ${addons}) 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() diff --git a/project/cmake/addons/README b/project/cmake/addons/README index d34039c3dd..59a5728e3b 100644 --- a/project/cmake/addons/README +++ b/project/cmake/addons/README @@ -9,13 +9,15 @@ where 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 @@ -38,10 +40,6 @@ by whoever uses it: * 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 diff --git a/project/cmake/addons/addons/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac.txt index 24b5999300..1f1468a7f7 100644 --- a/project/cmake/addons/addons/audioencoder.flac.txt +++ b/project/cmake/addons/addons/audioencoder.flac.txt @@ -1 +1 @@ -audioencoder.flac https://github.com/xbmc 84bdf32 +audioencoder.flac https://github.com/xbmc/audioencoder.flac 84bdf32 diff --git a/project/cmake/addons/addons/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame.txt index 07a7996dd7..70d5eb9ff0 100644 --- a/project/cmake/addons/addons/audioencoder.lame.txt +++ b/project/cmake/addons/addons/audioencoder.lame.txt @@ -1 +1 @@ -audioencoder.lame https://github.com/xbmc 90fb99b +audioencoder.lame https://github.com/xbmc/audioencoder.lame 90fb99b diff --git a/project/cmake/addons/addons/audioencoder.vorbis.txt b/project/cmake/addons/addons/audioencoder.vorbis.txt index 92d7717b99..731ca04d5f 100644 --- a/project/cmake/addons/addons/audioencoder.vorbis.txt +++ b/project/cmake/addons/addons/audioencoder.vorbis.txt @@ -1 +1 @@ -audioencoder.vorbis https://github.com/xbmc a73ef7e +audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis a73ef7e diff --git a/project/cmake/addons/addons/audioencoder.wav.txt b/project/cmake/addons/addons/audioencoder.wav.txt index 86dcc1d53e..aef9bda109 100644 --- a/project/cmake/addons/addons/audioencoder.wav.txt +++ b/project/cmake/addons/addons/audioencoder.wav.txt @@ -1 +1 @@ -audioencoder.wav https://github.com/xbmc b28ab95 +audioencoder.wav https://github.com/xbmc/audioencoder.wav b28ab95 diff --git a/project/cmake/addons/depends/CMakeLists.txt b/project/cmake/addons/depends/CMakeLists.txt new file mode 100644 index 0000000000..3e3f6caa3c --- /dev/null +++ b/project/cmake/addons/depends/CMakeLists.txt @@ -0,0 +1,150 @@ +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 diff --git a/project/cmake/addons/depends/README b/project/cmake/addons/depends/README new file mode 100644 index 0000000000..f80a7a1566 --- /dev/null +++ b/project/cmake/addons/depends/README @@ -0,0 +1,59 @@ +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" diff --git a/project/cmake/addons/depends/win32/CMakeLists.txt b/project/cmake/addons/depends/win32/CMakeLists.txt deleted file mode 100644 index d8a55eb5d1..0000000000 --- a/project/cmake/addons/depends/win32/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -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() diff --git a/project/cmake/addons/depends/windows/CMakeLists.txt b/project/cmake/addons/depends/windows/CMakeLists.txt new file mode 100644 index 0000000000..611958574a --- /dev/null +++ b/project/cmake/addons/depends/windows/CMakeLists.txt @@ -0,0 +1,47 @@ +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() diff --git a/project/cmake/addons/depends/win32/Find7Zip.cmake b/project/cmake/addons/depends/windows/Find7Zip.cmake index 82b09026ad..82b09026ad 100644 --- a/project/cmake/addons/depends/win32/Find7Zip.cmake +++ b/project/cmake/addons/depends/windows/Find7Zip.cmake diff --git a/project/cmake/addons/depends/win32/README b/project/cmake/addons/depends/windows/README index 1021a18b9e..3512f32ae6 100644 --- a/project/cmake/addons/depends/win32/README +++ b/project/cmake/addons/depends/windows/README @@ -9,7 +9,7 @@ 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 <path> [-G <generator>] cmake supports multiple generators, see http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. diff --git a/project/cmake/addons/depends/windows/cmake/xbmc/CMakeLists.txt b/project/cmake/addons/depends/windows/cmake/xbmc/CMakeLists.txt new file mode 100644 index 0000000000..57d8a93065 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/xbmc/CMakeLists.txt @@ -0,0 +1,31 @@ +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 diff --git a/project/cmake/addons/depends/windows/cmake/xbmc/noinstall.txt b/project/cmake/addons/depends/windows/cmake/xbmc/noinstall.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/xbmc/noinstall.txt diff --git a/project/cmake/addons/depends/windows/cmake/xbmc/xbmc.txt b/project/cmake/addons/depends/windows/cmake/xbmc/xbmc.txt new file mode 100644 index 0000000000..0d53f64477 --- /dev/null +++ b/project/cmake/addons/depends/windows/cmake/xbmc/xbmc.txt @@ -0,0 +1 @@ +xbmc
\ No newline at end of file diff --git a/project/cmake/addons/depends/win32/extract-7z.cmake b/project/cmake/addons/depends/windows/extract-7z.cmake index 95a2672cc4..95a2672cc4 100644 --- a/project/cmake/addons/depends/win32/extract-7z.cmake +++ b/project/cmake/addons/depends/windows/extract-7z.cmake diff --git a/project/cmake/addons/depends/win32/extract-direct.cmake b/project/cmake/addons/depends/windows/extract-direct.cmake index 13cb74f919..13cb74f919 100644 --- a/project/cmake/addons/depends/win32/extract-direct.cmake +++ b/project/cmake/addons/depends/windows/extract-direct.cmake diff --git a/project/cmake/addons/depends/win32/install.cmake b/project/cmake/addons/depends/windows/install.cmake index 9a3adbb7c3..9a3adbb7c3 100644 --- a/project/cmake/addons/depends/win32/install.cmake +++ b/project/cmake/addons/depends/windows/install.cmake diff --git a/project/cmake/addons/depends/win32/prebuilt/README b/project/cmake/addons/depends/windows/prebuilt/README index 11a05a5838..11a05a5838 100644 --- a/project/cmake/addons/depends/win32/prebuilt/README +++ b/project/cmake/addons/depends/windows/prebuilt/README diff --git a/project/cmake/addons/depends/win32/prebuilt/flac/flac.txt b/project/cmake/addons/depends/windows/prebuilt/flac/flac.txt index 098f08f739..098f08f739 100644 --- a/project/cmake/addons/depends/win32/prebuilt/flac/flac.txt +++ b/project/cmake/addons/depends/windows/prebuilt/flac/flac.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/flac/install.txt b/project/cmake/addons/depends/windows/prebuilt/flac/install.txt index 8a6437e563..8a6437e563 100644 --- a/project/cmake/addons/depends/win32/prebuilt/flac/install.txt +++ b/project/cmake/addons/depends/windows/prebuilt/flac/install.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/lame.txt b/project/cmake/addons/depends/windows/prebuilt/lame.txt index 6fc7acf9f5..6fc7acf9f5 100644 --- a/project/cmake/addons/depends/win32/prebuilt/lame.txt +++ b/project/cmake/addons/depends/windows/prebuilt/lame.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/ogg/install.txt b/project/cmake/addons/depends/windows/prebuilt/ogg/install.txt index a5f8852265..a5f8852265 100644 --- a/project/cmake/addons/depends/win32/prebuilt/ogg/install.txt +++ b/project/cmake/addons/depends/windows/prebuilt/ogg/install.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/ogg/ogg.txt b/project/cmake/addons/depends/windows/prebuilt/ogg/ogg.txt index 801b13b65a..801b13b65a 100644 --- a/project/cmake/addons/depends/win32/prebuilt/ogg/ogg.txt +++ b/project/cmake/addons/depends/windows/prebuilt/ogg/ogg.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/vorbis/install.txt b/project/cmake/addons/depends/windows/prebuilt/vorbis/install.txt index 3021f12c1d..3021f12c1d 100644 --- a/project/cmake/addons/depends/win32/prebuilt/vorbis/install.txt +++ b/project/cmake/addons/depends/windows/prebuilt/vorbis/install.txt diff --git a/project/cmake/addons/depends/win32/prebuilt/vorbis/vorbis.txt b/project/cmake/addons/depends/windows/prebuilt/vorbis/vorbis.txt index 23e56e2901..23e56e2901 100644 --- a/project/cmake/addons/depends/win32/prebuilt/vorbis/vorbis.txt +++ b/project/cmake/addons/depends/windows/prebuilt/vorbis/vorbis.txt diff --git a/project/cmake/AddOptions.cmake b/project/cmake/scripts/common/addoptions.cmake index 0ebb823666..0ebb823666 100644 --- a/project/cmake/AddOptions.cmake +++ b/project/cmake/scripts/common/addoptions.cmake diff --git a/project/cmake/xbmc-addon-helpers.cmake b/project/cmake/scripts/common/xbmc-addon-helpers.cmake index d62598bcc0..130582afea 100644 --- a/project/cmake/xbmc-addon-helpers.cmake +++ b/project/cmake/scripts/common/xbmc-addon-helpers.cmake @@ -77,7 +77,7 @@ function (xbmc_find_path var_name filename search_path strip_file) endfunction() # Cmake build options -include(AddOptions) +include(addoptions) include(TestCXXAcceptsFlag) OPTION(PACKAGE_ZIP "Package Zip file?" OFF) OPTION(PACKAGE_TGZ "Package TGZ file?" OFF) diff --git a/project/cmake/scripts/common/xbmc-prepare-env.cmake b/project/cmake/scripts/common/xbmc-prepare-env.cmake new file mode 100644 index 0000000000..ae3b9f28b8 --- /dev/null +++ b/project/cmake/scripts/common/xbmc-prepare-env.cmake @@ -0,0 +1,46 @@ +# 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 diff --git a/project/cmake/xbmc-c-flag-overrides.cmake b/project/cmake/scripts/windows/xbmc-c-flag-overrides.cmake index ab19701707..ab19701707 100644 --- a/project/cmake/xbmc-c-flag-overrides.cmake +++ b/project/cmake/scripts/windows/xbmc-c-flag-overrides.cmake diff --git a/project/cmake/xbmc-cxx-flag-overrides.cmake b/project/cmake/scripts/windows/xbmc-cxx-flag-overrides.cmake index ad3a0908ef..ad3a0908ef 100644 --- a/project/cmake/xbmc-cxx-flag-overrides.cmake +++ b/project/cmake/scripts/windows/xbmc-cxx-flag-overrides.cmake diff --git a/tools/buildsteps/win32/make-addon-depends.bat b/tools/buildsteps/win32/make-addon-depends.bat index e1c3fdab5e..b53dbfc72e 100644 --- a/tools/buildsteps/win32/make-addon-depends.bat +++ b/tools/buildsteps/win32/make-addon-depends.bat @@ -29,9 +29,10 @@ 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 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 @@ -60,7 +61,10 @@ CD "%ADDON_DEPENDS_BUILD_PATH%" 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 diff --git a/tools/buildsteps/win32/make-addons.bat b/tools/buildsteps/win32/make-addons.bat index 10a2a8bc4d..3283d98e0b 100644 --- a/tools/buildsteps/win32/make-addons.bat +++ b/tools/buildsteps/win32/make-addons.bat @@ -34,15 +34,13 @@ IF "%WORKDIR%" == "" ( 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 ( @@ -70,14 +68,6 @@ IF %noclean% == false ( ) ) -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%" @@ -95,16 +85,22 @@ ECHO -------------------------------------------------- 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 diff --git a/tools/depends/target/xbmc-audioencoder-addons/Makefile b/tools/depends/target/xbmc-audioencoder-addons/Makefile index 15cf50d288..9153a24787 100644 --- a/tools/depends/target/xbmc-audioencoder-addons/Makefile +++ b/tools/depends/target/xbmc-audioencoder-addons/Makefile @@ -1,7 +1,6 @@ -include ../../Makefile.include -LIBNAME = xbmc-audioencoder-addons - +ADDONS = "audioencoder.flac audioencoder.lame audioencoder.vorbis audioencoder.wav" ifeq ($(PLATFORM),) PLATFORM = native endif @@ -36,6 +35,6 @@ 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 $@ |