aboutsummaryrefslogtreecommitdiff
path: root/cmake/scripts/common
diff options
context:
space:
mode:
authorh.udo <hudokkow@gmail.com>2016-09-08 16:42:58 +0100
committerh.udo <hudokkow@gmail.com>2016-12-21 10:04:18 +0000
commitb0cad85adb045b88347cf8cded6770c7dd349406 (patch)
tree1a0b452f530dd2aa4e139c8e6de3f18b01a66bf2 /cmake/scripts/common
parenta18701e7b2fe03780f90502d5d51e09cdc3ad718 (diff)
[cmake] Move to root folder: Update paths
Diffstat (limited to 'cmake/scripts/common')
-rw-r--r--cmake/scripts/common/ArchSetup.cmake8
-rw-r--r--cmake/scripts/common/GenerateVersionedFiles.cmake2
-rw-r--r--cmake/scripts/common/HandleDepends.cmake2
-rw-r--r--cmake/scripts/common/Macros.cmake64
-rw-r--r--cmake/scripts/common/PrepareEnv.cmake12
-rw-r--r--cmake/scripts/common/ProjectMacros.cmake2
6 files changed, 52 insertions, 38 deletions
diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake
index 4b862c8b50..58b2cfe44b 100644
--- a/cmake/scripts/common/ArchSetup.cmake
+++ b/cmake/scripts/common/ArchSetup.cmake
@@ -82,17 +82,17 @@ else()
endif()
# Main cpp
-set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
# system specific arch setup
-if(NOT EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
+if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
message(FATAL_ERROR "Couldn't find configuration for '${CORE_SYSTEM_NAME}' "
"Either the platform is not (yet) supported "
"or a toolchain file has to be specified. "
- "Consult ${CMAKE_SOURCE_DIR}/README.md for instructions. "
+ "Consult ${CMAKE_SOURCE_DIR}/cmake/README.md for instructions. "
"Note: Specifying a toolchain requires a clean build directory!")
endif()
-include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
+include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake)
message(STATUS "Core system type: ${CORE_SYSTEM_NAME}")
message(STATUS "Platform: ${PLATFORM}")
diff --git a/cmake/scripts/common/GenerateVersionedFiles.cmake b/cmake/scripts/common/GenerateVersionedFiles.cmake
index e105b277e8..6062362fd5 100644
--- a/cmake/scripts/common/GenerateVersionedFiles.cmake
+++ b/cmake/scripts/common/GenerateVersionedFiles.cmake
@@ -1,4 +1,4 @@
-include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake)
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
core_find_versions()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon)
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake
index adc105bf31..85d2cf43e9 100644
--- a/cmake/scripts/common/HandleDepends.cmake
+++ b/cmake/scripts/common/HandleDepends.cmake
@@ -1,4 +1,4 @@
-include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/CheckTargetPlatform.cmake)
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/CheckTargetPlatform.cmake)
# handle addon depends
function(add_addon_depends addon searchpath)
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake
index 62dfb873b5..6846ab00ac 100644
--- a/cmake/scripts/common/Macros.cmake
+++ b/cmake/scripts/common/Macros.cmake
@@ -1,7 +1,12 @@
# This script holds the main functions used to construct the build system
-# include system specific macros
-include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/Macros.cmake)
+# Include system specific macros but only if this file is included from
+# kodi main project. It's not needed for kodi-addons project
+# If CORE_SOURCE_DIR is set, it was called from kodi-addons project
+# TODO: drop check if we ever integrate kodi-addons into kodi project
+if(NOT CORE_SOURCE_DIR)
+ include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/Macros.cmake)
+endif()
# IDEs: Group source files in target in folders (file system hierarchy)
# Source: http://blog.audio-tk.com/2015/09/01/sorting-source-files-and-projects-in-folders-with-cmake-and-visual-studioxcode/
@@ -72,7 +77,7 @@ function(core_add_library name)
# Add precompiled headers to Kodi main libraries
if(CORE_SYSTEM_NAME STREQUAL windows)
- add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi)
+ add_precompiled_header(${name} pch.h ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi)
set_language_cxx(${name})
target_link_libraries(${name} PUBLIC effects11)
endif()
@@ -118,8 +123,8 @@ function(core_add_addon_library name)
set_target_properties(${name} PROPERTIES FOLDER addons)
target_include_directories(${name} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
- ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
- ${CORE_SOURCE_DIR}/xbmc)
+ ${CMAKE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi
+ ${CMAKE_SOURCE_DIR}/xbmc)
endfunction()
# Add an dl-loaded shared library
@@ -191,7 +196,7 @@ endfunction()
# Optional Arguments:
# NO_INSTALL: exclude file from installation target (only mirror)
# DIRECTORY: directory where the file should be mirrored to
-# (default: preserve tree structure relative to CORE_SOURCE_DIR)
+# (default: preserve tree structure relative to CMAKE_SOURCE_DIR)
# On return:
# Files is mirrored to the build tree and added to ${install_data}
# (if NO_INSTALL is not given).
@@ -202,7 +207,7 @@ function(copy_file_to_buildtree file)
get_filename_component(outfile ${file} NAME)
set(outfile ${outdir}/${outfile})
else()
- string(REPLACE "${CORE_SOURCE_DIR}/" "" outfile ${file})
+ string(REPLACE "${CMAKE_SOURCE_DIR}/" "" outfile ${file})
get_filename_component(outdir ${outfile} DIRECTORY)
endif()
@@ -243,7 +248,7 @@ endfunction()
# Optional Arguments:
# NO_INSTALL: exclude files from installation target
# Implicit arguments:
-# CORE_SOURCE_DIR - root of source tree
+# CMAKE_SOURCE_DIR - root of source tree
# On return:
# Files are mirrored to the build tree and added to ${install_data}
# (if NO_INSTALL is not given).
@@ -273,17 +278,17 @@ function(copy_files_from_filelist_to_buildtree pattern)
# If the full path to an existing file is specified then add that single file.
# Don't recursively add all files with the given name.
- if(EXISTS ${CORE_SOURCE_DIR}/${src} AND NOT IS_DIRECTORY ${CORE_SOURCE_DIR}/${src})
+ if(EXISTS ${CMAKE_SOURCE_DIR}/${src} AND NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${src})
set(files ${src})
else()
- file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${src})
+ file(GLOB_RECURSE files RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/${src})
endif()
foreach(file ${files})
if(arg_NO_INSTALL)
- copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} DIRECTORY ${dest} NO_INSTALL)
+ copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest} NO_INSTALL)
else()
- copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} DIRECTORY ${dest})
+ copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest})
endif()
endforeach()
endforeach()
@@ -427,9 +432,9 @@ function(core_add_subdirs_from_filelist files)
list(GET subdir 0 subdir_src)
list(GET subdir -1 subdir_dest)
if(VERBOSE)
- message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CMAKE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
endif()
- add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
+ add_subdirectory(${CMAKE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
endforeach()
endforeach()
endfunction()
@@ -466,9 +471,9 @@ macro(core_add_optional_subdirs_from_filelist pattern)
foreach(opt ${opts})
if(ENABLE_${opt})
if(VERBOSE)
- message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
+ message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CMAKE_SOURCE_DIR}/${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
endif()
- add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
+ add_subdirectory(${CMAKE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
else()
if(VERBOSE)
message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir")
@@ -496,14 +501,14 @@ endfunction()
# if no git tree is found, value is set to "nobody <nobody@example.com>"
function(userstamp)
find_package(Git)
- if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git)
+ if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
execute_process(COMMAND ${GIT_EXECUTABLE} config user.name
OUTPUT_VARIABLE username
- WORKING_DIRECTORY ${CORE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} config user.email
OUTPUT_VARIABLE useremail
- WORKING_DIRECTORY ${CORE_SOURCE_DIR}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PACKAGE_MAINTAINER "${username} <${useremail}>" PARENT_SCOPE)
else()
@@ -528,29 +533,29 @@ function(core_find_git_rev stamp)
set(${stamp} ${GIT_VERSION} PARENT_SCOPE)
else()
find_package(Git)
- if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git)
+ if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet --
RESULT_VARIABLE status_code
- WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
if(NOT status_code)
execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --ignore-submodules --quiet HEAD --
RESULT_VARIABLE status_code
- WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()
if(status_code)
execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h-dirty" HEAD
OUTPUT_VARIABLE HASH
- WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
string(SUBSTRING ${HASH} 1 13 HASH)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} log -n 1 --pretty=format:"%h" HEAD
OUTPUT_VARIABLE HASH
- WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
string(SUBSTRING ${HASH} 1 7 HASH)
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:"%cd" --date=short HEAD
OUTPUT_VARIABLE DATE
- WORKING_DIRECTORY ${CORE_SOURCE_DIR})
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
string(SUBSTRING ${DATE} 1 10 DATE)
string(REPLACE "-" "" DATE ${DATE})
else()
@@ -586,6 +591,15 @@ endfunction()
# guilib_version - current ADDONGUI API version
# guilib_version_min - minimal ADDONGUI API version
macro(core_find_versions)
+ # kodi-addons project also calls this macro and uses CORE_SOURCE_DIR
+ # to point to core base dir
+ # Set CORE_SOURCE_DIR here, otherwise kodi main project fails
+ # TODO: drop this code block and refactor the rest to use CMAKE_SOURCE_DIR
+ # if we ever integrate kodi-addons into kodi project
+ if(NOT CORE_SOURCE_DIR)
+ set(CORE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
+ endif()
+
include(CMakeParseArguments)
core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt)
string(REPLACE " " ";" version_list "${version_list}")
diff --git a/cmake/scripts/common/PrepareEnv.cmake b/cmake/scripts/common/PrepareEnv.cmake
index 51be7395a8..1f68fdccae 100644
--- a/cmake/scripts/common/PrepareEnv.cmake
+++ b/cmake/scripts/common/PrepareEnv.cmake
@@ -1,5 +1,5 @@
# parse version.txt and libKODI_guilib.h to get the version and API info
-include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/Macros.cmake)
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
core_find_versions()
# in case we need to download something, set KODI_MIRROR to the default if not alread set
@@ -33,11 +33,11 @@ if(NOT WIN32)
endif()
# generate the proper KodiConfig.cmake file
-configure_file(${CORE_SOURCE_DIR}/project/cmake/KodiConfig.cmake.in ${APP_LIB_DIR}/KodiConfig.cmake @ONLY)
+configure_file(${CORE_SOURCE_DIR}/cmake/KodiConfig.cmake.in ${APP_LIB_DIR}/KodiConfig.cmake @ONLY)
# copy cmake helpers to lib/kodi
-file(COPY ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddonHelpers.cmake
- ${CORE_SOURCE_DIR}/project/cmake/scripts/common/AddOptions.cmake
+file(COPY ${CORE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
+ ${CORE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
DESTINATION ${APP_LIB_DIR})
### copy all the addon binding header files to include/kodi
@@ -52,8 +52,8 @@ foreach(binding ${bindings})
endforeach()
### processing additional tools required by the platform
-if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
- file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake)
+if(EXISTS ${CORE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
+ file(GLOB platform_tools ${CORE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake)
foreach(platform_tool ${platform_tools})
get_filename_component(platform_tool_name ${platform_tool} NAME_WE)
message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}")
diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake
index e73ef903ed..89ecca4e9e 100644
--- a/cmake/scripts/common/ProjectMacros.cmake
+++ b/cmake/scripts/common/ProjectMacros.cmake
@@ -33,7 +33,7 @@ function(copy_skin_to_buildtree skin)
copy_file_to_buildtree(${file})
endforeach()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media)
- string(REPLACE "${CORE_SOURCE_DIR}/" "" dest ${skin})
+ string(REPLACE "${CMAKE_SOURCE_DIR}/" "" dest ${skin})
pack_xbt(${skin}/media ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt)
file(GLOB THEMES RELATIVE ${skin}/themes ${skin}/themes/*)