# /project/cmake
/project/cmake/xbmc-config.cmake
/project/cmake/addons/build
+/project/cmake/addons/depends/win32/build
+/project/cmake/addons/output
# /project/Win32BuildSetup/
/project/Win32BuildSetup/XBMC.log
--- /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
+@ECHO OFF
+
+SETLOCAL
+
+SET EXITCODE=0
+
+rem set Visual C++ build environment
+call "%VS120COMNTOOLS%..\..\VC\bin\vcvars32.bat"
+
+SET WORKDIR=%WORKSPACE%
+
+IF "%WORKDIR%"=="" (
+ SET WORKDIR=%CD%\..\..\..
+)
+
+rem setup some paths that we need later
+SET CUR_PATH=%CD%
+
+SET BASE_PATH=%WORKDIR%\project\cmake\
+SET ADDONS_PATH=%BASE_PATH%\addons
+SET ADDONS_OUTPUT_PATH=%ADDONS_PATH%\output
+SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\depends\win32
+SET ADDON_DEPENDS_BUILD_PATH=%ADDON_DEPENDS_PATH%\build
+
+SET ERRORFILE=%BASE_PATH%\make-addon-depends.error
+
+rem remove the output directory if it exists
+IF EXIST "%ADDONS_OUTPUT_PATH%" (
+ RMDIR "%ADDONS_OUTPUT_PATH%" /S /Q > NUL
+)
+
+rem create the output directory
+MKDIR "%ADDONS_OUTPUT_PATH%"
+
+rem go into the addon depends directory
+CD %ADDON_DEPENDS_PATH%
+
+rem remove the build directory if it exists
+IF EXIST "%ADDON_DEPENDS_BUILD_PATH%" (
+ RMDIR "%ADDON_DEPENDS_BUILD_PATH%" /S /Q > NUL
+)
+
+rem create the build directory
+MKDIR "%ADDON_DEPENDS_BUILD_PATH%"
+
+rem go into the build directory
+CD "%ADDON_DEPENDS_BUILD_PATH%"
+
+rem execute cmake to generate makefiles processable by nmake
+cmake "%ADDON_DEPENDS_PATH%" -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%ADDONS_OUTPUT_PATH%
+IF ERRORLEVEL 1 (
+ ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE%
+ GOTO ERROR
+)
+
+rem execute nmake to build the addon depends
+nmake
+IF ERRORLEVEL 1 (
+ ECHO nmake error level: %ERRORLEVEL% > %ERRORFILE%
+ GOTO ERROR
+)
+
+rem everything was fine
+GOTO END
+
+:ERROR
+rem something went wrong
+ECHO Failed to build addon dependencies
+ECHO See %ERRORFILE% for more details
+SET EXITCODE=1
+
+:END
+rem go back to the original directory
+cd %CUR_PATH%
+
+rem exit the script with the defined exitcode
+EXIT /B %EXITCODE%