File tree 4 files changed +40
-4
lines changed
4 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ BUILD?=build
2
2
VERBOSE?=0
3
3
PARALLEL_JOBS?=1
4
4
CMAKE?=cmake
5
+ TOOLCHAIN_FILE=#./cmake/codesourcery-arm-toolchain.cmake
5
6
6
- all : doc package
7
+ all : package
7
8
8
9
$(BUILD )/Makefile:
9
10
mkdir $(BUILD ) || exit 0
10
- cd $(BUILD ) && $(CMAKE) -DCMAKE_VERBOSE_MAKEFILE=$(VERBOSE) ..
11
+ cd $(BUILD ) && $(CMAKE) -DCMAKE_VERBOSE_MAKEFILE=$(VERBOSE) -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) ..
11
12
12
13
build : $(BUILD )/Makefile
13
14
cd $(BUILD ) && make -j $(PARALLEL_JOBS)
Original file line number Diff line number Diff line change @@ -38,6 +38,18 @@ To submit valgrind test results:
38
38
39
39
make -f Makefile.cmake cdash-mem
40
40
41
+ Cross-compiling:
42
+ An example toolchain file for the CodeSourcery ARM toolchain is included in
43
+ the cmake directory : codesourcery-arm-toolchain.cmake.
44
+
45
+ Install the CodeSourcery toolchain, set the path to the toolchain in
46
+ cmake/codesourcery-arm-toolchain.cmake, and uncomment the TOOLCHAIN_FILE
47
+ variable in Makefile.cmake to use it.
48
+
49
+ If you are using cmake directly, just add the flag
50
+ "-DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain-file" when
51
+ running cmake.
52
+
41
53
Using cmake directly:
42
54
cd ~/your-node-source -dir
43
55
mkdir name -of-build -dir (can be anything)
Original file line number Diff line number Diff line change
1
+ set (toolchain_dir #SET THIS TO YOUR TOOLCHAIN PATH)
2
+ set (toolchain_bin_dir ${toolchain_dir} /bin)
3
+ set (toolchain_libc_dir ${toolchain_dir} /arm-none-linux-gnueabi/libc)
4
+ set (toolchain_inc_dir ${toolchain_libc_dir} /include )
5
+ set (toolchain_lib_dir ${toolchain_libc_dir} /usr/lib)
6
+
7
+ set (CMAKE_SYSTEM_NAME Linux CACHE INTERNAL "system name" )
8
+ set (CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor" )
9
+ set (CMAKE_C_COMPILER ${toolchain_bin_dir} /arm-none-linux-gnueabi-gcc)
10
+ set (CMAKE_CXX_COMPILER ${toolchain_bin_dir} /arm-none-linux-gnueabi-g++)
11
+ set (CMAKE_C_FLAGS "-isystem ${toolchain_inc_dir} " CACHE INTERNAL "c compiler flags" )
12
+ set (CMAKE_CXX_FLAGS "-isystem ${toolchain_inc_dir} " CACHE INTERNAL "cxx compiler flags" )
13
+
14
+ set (link_flags -L${toolchain_lib_dir} )
15
+
16
+ set (CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags" )
17
+ set (CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags" )
18
+ set (CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared lnk flags" )
19
+ set (CMAKE_FIND_ROOT_PATH ${toolchain_libc_dir} CACHE INTERNAL "cross root directory" )
20
+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE INTERNAL "" )
21
+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "" )
22
+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "" )
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ if(NOT SHARED_V8)
38
38
set_property (TARGET v8
39
39
PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR} /deps/v8/${v8_fn} )
40
40
41
+ set (compile_env_vars "CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} CFLAGS=\" ${CMAKE_C_FLAGS} \" CXXFLAGS=\" ${CMAKE_CXX_FLAGS} \" LDFLAGS=\" ${CMAKE_EXE_LINKER_FLAGS} \" " )
41
42
42
43
if (CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
43
44
# use ExternalProject for CMake >2.8
@@ -47,7 +48,7 @@ if(NOT SHARED_V8)
47
48
URL ${PROJECT_SOURCE_DIR} /deps/v8
48
49
49
50
BUILD_IN_SOURCE True
50
- BUILD_COMMAND ${ PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR} /tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}
51
+ BUILD_COMMAND sh -c " ${compile_env_vars} ${ PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR} /tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs} "
51
52
52
53
SOURCE_DIR ${PROJECT_BINARY_DIR} /deps/v8
53
54
# ignore this stuff, it's not needed for building v8 but ExternalProject
@@ -78,7 +79,7 @@ if(NOT SHARED_V8)
78
79
79
80
add_custom_command (
80
81
OUTPUT ${PROJECT_BINARY_DIR} /deps/v8/${v8_fn}
81
- COMMAND ${ PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR} /tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}
82
+ COMMAND sh -c " ${compile_env_vars} ${ PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR} /tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs} "
82
83
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} /deps/v8/
83
84
DEPENDS ${v8_sources_dest}
84
85
)
You can’t perform that action at this time.
0 commit comments