Support the Tilera platform
This patch provides build and test script updates for the Tilera
platform. The cmake scripts autodetect if you are configuring on a
system with a Tilera MDE installed, so you can use the normal `cmake`
command in a build directory with standard cmake options. Note that
we turn off building the documentation on Tilera, even if Sphinx is
installed.
The major modification to our standard workflow is testing: replace
`make test` with `./tile-test`. This assumes there is a working
connection to a Tilera device.
Installation requires sudo access, i.e., `sudo make install`. If you
intend to use these files regularly, then you should use an installation
prefix that includes `$TILERA_ROOT/tile`. One good example is
`$TILERA_ROOT/tile/usr/local`, but you can use any directory you want
that is supported by the various `tile-monitor` upload and mount options.
John Zachary
11 years ago
27 | 27 |
|
28 | 28 |
string(REGEX REPLACE "-dev.*" "-dev" BASE_VERSION "${VERSION}")
|
29 | 29 |
|
|
30 |
find_package(PkgConfig)
|
|
31 |
|
|
32 |
#-----------------------------------------------------------------------
|
|
33 |
# Check for building on Tilera
|
|
34 |
# If the Tilera environment is installed, then $TILERA_ROOT is defined
|
|
35 |
# as the path to the active MDE.
|
|
36 |
|
|
37 |
if(DEFINED ENV{TILERA_ROOT})
|
|
38 |
set(TILERA TRUE)
|
|
39 |
set(TILERA_ROOT $ENV{TILERA_ROOT})
|
|
40 |
message("-- Configuring for Tilera MDE ${TILERA_ROOT}")
|
|
41 |
set(ENV{PKG_CONFIG_PATH}
|
|
42 |
"${TILERA_ROOT}/tile/usr/lib/pkgconfig:${TILERA_ROOT}/tile/usr/local/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
|
|
43 |
)
|
|
44 |
set(CMAKE_SYSTEM_NAME "Tilera")
|
|
45 |
set(CMAKE_SYSTEM_PROCESSOR "tilegx")
|
|
46 |
set(CMAKE_C_COMPILER "${TILERA_ROOT}/bin/tile-gcc")
|
|
47 |
set(CMAKE_LINKER "${TILERA_ROOT}/bin/tile-ld")
|
|
48 |
set(TILERA_MONITOR "${TILERA_ROOT}/bin/tile-monitor")
|
|
49 |
#add_definitions(-std=gnu99)
|
|
50 |
set(CMAKE_FIND_ROOT_PATH "${TILERA_ROOT}/tile")
|
|
51 |
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
|
52 |
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
53 |
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
54 |
endif()
|
|
55 |
|
30 | 56 |
#-----------------------------------------------------------------------
|
31 | 57 |
# Check for prerequisite libraries
|
32 | |
|
33 | |
find_package(PkgConfig)
|
34 | 58 |
|
35 | 59 |
pkg_check_modules(CORK REQUIRED libcork)
|
36 | 60 |
include_directories(${CORK_INCLUDE_DIRS})
|
15 | 15 |
)
|
16 | 16 |
|
17 | 17 |
set(GENERATE_DOC TRUE)
|
|
18 |
|
|
19 |
if (TILERA)
|
|
20 |
message(STATUS "Note: We don't build documentation on the Tilera platform")
|
|
21 |
set(GENERATE_DOC FALSE)
|
|
22 |
endif (TILERA)
|
18 | 23 |
|
19 | 24 |
if (NOT SPHINX_EXECUTABLE)
|
20 | 25 |
message(WARNING "Unable to find Sphinx documentation generator")
|
33 | 33 |
#-----------------------------------------------------------------------
|
34 | 34 |
# Command-line tests
|
35 | 35 |
|
|
36 |
if(TILERA)
|
|
37 |
configure_file(tile-test ${CMAKE_BINARY_DIR}/tile-test COPYONLY)
|
|
38 |
endif(TILERA)
|
|
39 |
|
36 | 40 |
find_program(
|
37 | 41 |
CRAM_EXECUTABLE
|
38 | 42 |
NAMES cram
|
|
0 |
#!/usr/bin/env bash
|
|
1 |
|
|
2 |
if [ ! -x $TILERA_ROOT/bin/tile-monitor ]; then
|
|
3 |
# If no tile-monitor is installed, then there is nothing to test.
|
|
4 |
echo "No tile-monitor installed in $TILERA_ROOT/bin"
|
|
5 |
exit 1
|
|
6 |
fi
|
|
7 |
|
|
8 |
export TEST_DIR="/tmp/test"
|
|
9 |
export TILERA_COMMON_ARGS=" \
|
|
10 |
--debug-on-crash \
|
|
11 |
--mkdir $TEST_DIR/build \
|
|
12 |
--mkdir $TEST_DIR/tests \
|
|
13 |
--tile standard \
|
|
14 |
--mount-tile /usr \
|
|
15 |
--mount-tile /lib \
|
|
16 |
--upload . $TEST_DIR/build \
|
|
17 |
--upload ../tests $TEST_DIR/tests \
|
|
18 |
--env LD_LIBRARY_PATH="$TEST_DIR/build/src:/usr/local/lib:/usr/lib:/lib" \
|
|
19 |
--env PATH="/usr/local/bin:$PATH" \
|
|
20 |
--cd $TEST_DIR/build \
|
|
21 |
--run -+- ctest -+- --quit"
|
|
22 |
|
|
23 |
export TILERA_DEV_ARGS="--resume $TILERA_COMMON_ARGS"
|
|
24 |
$TILERA_ROOT/bin/tile-monitor $TILERA_DEV_ARGS
|
|
25 |
|
|
26 |
## Uncomment the following four lines and comment the previous two if
|
|
27 |
## you want to run the tests on the Tilera simulator.
|
|
28 |
#export SIM_IMAGE_SIZE="4x4"
|
|
29 |
#export TILERA_SIM_ARGS=" \
|
|
30 |
# --image $SIM_IMAGE_SIZE $TILERA_COMMON_ARGS --functional"
|
|
31 |
#$TILERA_ROOT/bin/tile-monitor $TILERA_SIM_ARGS
|