summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/common/PrepareEnv.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2017-06-04 16:57:49 +0200
committermanuel <manuel@mausz.at>2017-06-04 16:57:49 +0200
commitf44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (patch)
treed8de60fc7e17edeb6f0921726c038ee54b281445 /cmake/scripts/common/PrepareEnv.cmake
parentae08c8b7221bc965ac40d70e53fc8fcddb050c46 (diff)
downloadkodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.gz
kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.bz2
kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.zip
sync with upstream
Diffstat (limited to 'cmake/scripts/common/PrepareEnv.cmake')
-rw-r--r--cmake/scripts/common/PrepareEnv.cmake65
1 files changed, 65 insertions, 0 deletions
diff --git a/cmake/scripts/common/PrepareEnv.cmake b/cmake/scripts/common/PrepareEnv.cmake
new file mode 100644
index 0000000..4dc8698
--- /dev/null
+++ b/cmake/scripts/common/PrepareEnv.cmake
@@ -0,0 +1,65 @@
1# parse version.txt and versions.h to get the version and API info
2include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
3core_find_versions()
4
5# in case we need to download something, set KODI_MIRROR to the default if not already set
6if(NOT DEFINED KODI_MIRROR)
7 set(KODI_MIRROR "http://mirrors.kodi.tv")
8endif()
9
10### copy all the addon binding header files to include/kodi
11# make sure include/kodi exists and is empty
12set(APP_LIB_DIR ${ADDON_DEPENDS_PATH}/lib/${APP_NAME_LC})
13if(NOT EXISTS "${APP_LIB_DIR}/")
14 file(MAKE_DIRECTORY ${APP_LIB_DIR})
15endif()
16
17set(APP_DATA_DIR ${ADDON_DEPENDS_PATH}/share/${APP_NAME_LC})
18if(NOT EXISTS "${APP_DATA_DIR}/")
19 file(MAKE_DIRECTORY ${APP_DATA_DIR})
20endif()
21
22set(APP_INCLUDE_DIR ${ADDON_DEPENDS_PATH}/include/${APP_NAME_LC})
23if(NOT EXISTS "${APP_INCLUDE_DIR}/")
24 file(MAKE_DIRECTORY ${APP_INCLUDE_DIR})
25endif()
26
27# make sure C++11 is always set
28if(NOT WIN32)
29 string(REGEX MATCH "-std=(gnu|c)\\+\\+11" cxx11flag "${CMAKE_CXX_FLAGS}")
30 if(NOT cxx11flag)
31 set(CXX11_SWITCH "-std=c++11")
32 endif()
33endif()
34
35# generate the proper KodiConfig.cmake file
36configure_file(${CORE_SOURCE_DIR}/cmake/KodiConfig.cmake.in ${APP_LIB_DIR}/KodiConfig.cmake @ONLY)
37
38# copy cmake helpers to lib/kodi
39file(COPY ${CORE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
40 ${CORE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
41 DESTINATION ${APP_LIB_DIR})
42
43# copy standard add-on include files
44file(COPY ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/
45 DESTINATION ${APP_INCLUDE_DIR})
46
47### copy all the addon binding header files to include/kodi
48# parse addon-bindings.mk to get the list of header files to copy
49core_file_read_filtered(bindings ${CORE_SOURCE_DIR}/xbmc/addons/addon-bindings.mk)
50foreach(header ${bindings})
51 # copy the header file to include/kodi
52 configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY)
53endforeach()
54
55### processing additional tools required by the platform
56if(EXISTS ${CORE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/tools/)
57 file(GLOB platform_tools ${CORE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake)
58 foreach(platform_tool ${platform_tools})
59 get_filename_component(platform_tool_name ${platform_tool} NAME_WE)
60 message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}")
61
62 # include the file
63 include(${platform_tool})
64 endforeach()
65endif()