cmake: allow building of selected addons in xbmc-addons project
authorwsnipex <wsnipex@a1.net>
Thu, 17 Jul 2014 14:16:40 +0000 (16:16 +0200)
committermontellese <montellese@xbmc.org>
Wed, 30 Jul 2014 09:16:02 +0000 (11:16 +0200)
project/cmake/addons/CMakeLists.txt
project/cmake/addons/README
tools/depends/target/xbmc-audioencoder-addons/Makefile

index 018e16c..09ed3d4 100644 (file)
@@ -58,6 +58,13 @@ if(CMAKE_TOOLCHAIN_FILE)
   MESSAGE(${BUILD_ARGS})
 endif()
 
+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()
+
 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)
@@ -79,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}
+    # add the addon as an external project for automatic building
+    externalproject_add(${id}
                       GIT_REPOSITORY ${url}/${id}
                       GIT_TAG ${revision}
                       INSTALL_DIR "${CMAKE_INSTALL_PREFIX}"
                       CMAKE_ARGS ${BUILD_ARGS}
                      )
+  endif()
 endforeach()
index ca99eb6..59a5728 100644 (file)
@@ -16,6 +16,8 @@ where
 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
index 15cf50d..9153a24 100644 (file)
@@ -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 $@