File: sdks.cmake

package info (click to toggle)
caveexpress 2.4%2Bgit20160609-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,824 kB
  • sloc: cpp: 66,239; ansic: 1,135; sh: 471; xml: 186; python: 74; makefile: 20
file content (44 lines) | stat: -rw-r--r-- 1,375 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set(SDKS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cp-sdks CACHE STRING "SDKs dir")

macro(cp_git_clone_sdk GITURL GITCLONETARGET)
	file(MAKE_DIRECTORY ${SDKS_DIR})
	if (NOT EXISTS ${SDKS_DIR}/${GITCLONETARGET})
		find_program(GIT_EXECUTABLE NAMES git)
		if (NOT GIT_EXECUTABLE)
			message(FATAL_ERROR "Could not setup the sdk for ${GITURL} - git wasn't found in your path")
		endif()
		execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 --branch master ${GITURL} ${GITCLONETARGET} WORKING_DIRECTORY ${SDKS_DIR})
	endif()
endmacro()

macro(cp_get_sdk URL FILENAME)
	file(DOWNLOAD ${URL} ${FILENAME} STATUS DOWNLOAD_STATUS)
	if (NOT DOWNLOAD_STATUS)
		message(FATAL_ERROR "Could not download ${URL}")
	endif()
endmacro()

if (STEAMLINK)
	cp_git_clone_sdk(https://github.com/ValveSoftware/steamlink-sdk.git steamlink-sdk)
endif()

if (EMSCRIPTEN)
	if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
		set(EMSDK_BIN emsdk.bat)
	else()
		set(EMSDK_BIN emsdk)
	endif()
	cp_git_clone_sdk(https://github.com/juj/emsdk emsdk)
	execute_process(COMMAND ${EMSDK_BIN} update WORKING_DIRECTORY ${SDKS_DIR}/emsdk)
	# TODO: support 32 bit
	execute_process(COMMAND ${EMSDK_BIN} install emscripten-incoming-64bit clang-incoming-64bit WORKING_DIRECTORY ${SDKS_DIR}/emsdk)
endif()

if (ANDROID)
# TODO: install android sdk and ndk
endif()

if ((MSYS OR MINGW) AND LINUX)
# TODO: install mxe
endif()