-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathBuildSdkComponents.cmake
More file actions
108 lines (103 loc) · 5.32 KB
/
Copy pathBuildSdkComponents.cmake
File metadata and controls
108 lines (103 loc) · 5.32 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Copyright(c) 2016 codestation
# Distributed under the MIT License (http://opensource.org/licenses/MIT)
#
ExternalProject_add(vita-headers
DEPENDS binutils_${build_suffix} vita-toolchain_${build_suffix}
GIT_REPOSITORY ${HEADERS_REPOSITORY}
GIT_TAG ${HEADERS_TAG}
CONFIGURE_COMMAND ${vita_libs_gen_command}-2 -yml=<SOURCE_DIR>/db -output=<BINARY_DIR>
BUILD_COMMAND ARCH=${binutils_prefix} make
# Copy the generated .a files to the install directory
INSTALL_COMMAND ${CMAKE_COMMAND} -DGLOB_PATTERN=<BINARY_DIR>/*.a
-DINSTALL_DIR=${CMAKE_INSTALL_PREFIX}/${target_arch}/lib
-P ${CMAKE_SOURCE_DIR}/cmake/install_files.cmake
# Copy the include headers to the installation directory
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/${target_arch}/include
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include ${CMAKE_INSTALL_PREFIX}/${target_arch}/include
# Copy the vita.header_warn.cmake to the installation directory
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/vita.header_warn.cmake ${CMAKE_INSTALL_PREFIX}/${target_arch}/vita.header_warn.cmake
# Copy the yml database to the installation directory
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/db ${CMAKE_INSTALL_PREFIX}/share/vita-headers/db
# Save the commit id for tracking purposes
COMMAND ${GIT_EXECUTABLE} -C <SOURCE_DIR> rev-parse HEAD > ${CMAKE_BINARY_DIR}/vita-headers-version.txt
${UPDATE_DISCONNECTED_SUPPORT}
)
# The softfp world calls the same hard-float Sce* stubs vita-headers just
# installed, but with float/double arguments and return values sitting in
# the wrong registers (AAPCS-base vs AAPCS-VFP). Splice the 23 shims from
# softfp-shim/ into the affected stub archives in place -- see
# PLAN-softfp.md, "Fase 1 - los 23 shims de serie" and
# scripts/patch-softfp-stub-archives.sh for why this is an archive rewrite
# and not a -lvita_softfp_shim added to LIB_SPEC.
if(VITASDK_FLOAT_ABI STREQUAL "softfp")
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/softfp-shim.stamp
COMMAND ${PROJECT_SOURCE_DIR}/scripts/build-softfp-shim.sh
${binutils_prefix}-gcc ${binutils_prefix}-ar ${binutils_prefix}-objcopy
${PROJECT_SOURCE_DIR}/softfp-shim
${CMAKE_INSTALL_PREFIX}/${target_arch}/include
${CMAKE_INSTALL_PREFIX}/${target_arch}/lib
${toolchain_build_install_dir}/${target_arch}/lib
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/softfp-shim.stamp
DEPENDS vita-headers gcc-base binutils_${build_suffix}
COMMENT "Splicing the softfp ABI shims into the stub archives"
VERBATIM
)
add_custom_target(softfp-shim ALL DEPENDS ${CMAKE_BINARY_DIR}/softfp-shim.stamp)
endif()
ExternalProject_Add(newlib
DEPENDS binutils_${target_suffix} vita-headers
GIT_REPOSITORY ${NEWLIB_REPOSITORY}
GIT_TAG ${NEWLIB_TAG}
# Pass the compiler_target_tools here so newlib picks up the fresh gcc-base compiler
CONFIGURE_COMMAND ${compiler_flags} ${toolchain_tools} ${compiler_target_tools}
${wrapper_command} <SOURCE_DIR>/configure "CFLAGS_FOR_TARGET=-g -O2 -ffunction-sections -fdata-sections"
--build=${build_native}
--host=${host_native}
--target=${target_arch}
# Use this prefix so the install target can be run twice with different paths
--prefix=/
--with-build-sysroot=${CMAKE_INSTALL_PREFIX}/${target_arch}
--enable-newlib-io-long-long
--enable-newlib-register-fini
--disable-newlib-supplied-syscalls
--enable-newlib-long-time_t
--disable-nls
--enable-newlib-iconv
# Multibyte/UTF-8: sin esto setlocale queda clavado en US-ASCII y toda la
# familia mbrtowc/wcrtomb es inoperante (descubierto con musl libc-test)
--enable-newlib-mb
BUILD_COMMAND ${compiler_flags} ${toolchain_tools} ${wrapper_command} $(MAKE)
INSTALL_COMMAND $(MAKE) install DESTDIR=${CMAKE_INSTALL_PREFIX}
# Save the commit id for tracking purposes
COMMAND ${GIT_EXECUTABLE} -C <SOURCE_DIR> rev-parse HEAD > ${CMAKE_BINARY_DIR}/newlib-version.txt
${UPDATE_DISCONNECTED_SUPPORT}
)
ExternalProject_Add(pthread-embedded
DEPENDS binutils_${target_suffix} newlib vita-headers
GIT_REPOSITORY ${PTHREAD_REPOSITORY}
GIT_TAG ${PTHREAD_TAG}
# TODO: this project should have a proper makefile to support out-of-source builds
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${compiler_flags} ${wrapper_command} $(MAKE)
-C <SOURCE_DIR>/platform/vita ${pthread_tools} PREFIX=${CMAKE_INSTALL_PREFIX}
INSTALL_COMMAND $(MAKE) -C <SOURCE_DIR>/platform/vita PREFIX=${CMAKE_INSTALL_PREFIX}/${target_arch} install
# Save the commit id for tracking purposes
COMMAND ${GIT_EXECUTABLE} -C <SOURCE_DIR> rev-parse HEAD > ${CMAKE_BINARY_DIR}/pthread-embedded-version.txt
${UPDATE_DISCONNECTED_SUPPORT}
)
ExternalProject_Add(samples
GIT_REPOSITORY ${SAMPLES_REPOSITORY}
GIT_TAG ${SAMPLES_TAG}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND}
-DGLOB_PATTERN=<SOURCE_DIR> -DINSTALL_DIR=${CMAKE_INSTALL_PREFIX}/share/gcc-${target_arch}
-P ${CMAKE_SOURCE_DIR}/cmake/install_files.cmake
# Save the commit id for tracking purposes
COMMAND ${GIT_EXECUTABLE} -C <SOURCE_DIR> rev-parse HEAD > ${CMAKE_BINARY_DIR}/samples-version.txt
${UPDATE_DISCONNECTED_SUPPORT}
)