Skip to content

Commit

Permalink
cmake: allow to override local addon location via ADDON_SRC_PREFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
wsnipex authored and Montellese committed Mar 3, 2015
1 parent 49e9026 commit 09826ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
17 changes: 13 additions & 4 deletions project/cmake/addons/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ else()
separate_arguments(ADDONS_TO_BUILD)
endif()

if(ADDON_SRC_PREFIX)
message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}")
endif()

if(NOT KODI_LIB_DIR)
set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi")
else()
Expand Down Expand Up @@ -160,17 +164,22 @@ foreach(addon ${addons})
list(GET def 1 url)

set(archive_name ${id})
set(SOURCE_DIR "")
if(ADDON_SRC_PREFIX)
set(SOURCE_DIR ${ADDON_SRC_PREFIX}/${id})
set(archive_name "")
else()
set(SOURCE_DIR "")
endif()

# if there is a 3rd parameter in the file, we consider it a git revision
if(deflength GREATER 2)
# if there is a 3rd parameter in the file, we consider it a git revision
if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "")
list(GET def 2 revision)

# Note: downloading specific revisions via http in the format below is probably github specific
# if we ever use other repositories, this might need adapting
set(url ${url}/archive/${revision}.tar.gz)
set(archive_name ${archive_name}-${revision})
else()
elseif("${SOURCE_DIR}" STREQUAL "")
# check if the URL starts with file://
string(REGEX MATCH "^file://.*$" local_url "${url}")

Expand Down
3 changes: 3 additions & 0 deletions project/cmake/addons/README
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ 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").
* ADDON_SRC_PREFIX can be used to override the addon repository location.
It must point to the locally available parent directory of the addon(s) to build
<addon-id> will be appended to this path automatically
* 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
Expand Down

0 comments on commit 09826ab

Please sign in to comment.