Skip to content

Commit

Permalink
Support the Tilera platform
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
John Zachary committed Mar 15, 2013
1 parent 5c93a90 commit 49e2bbb
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
28 changes: 26 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,34 @@ endif(VERSION_RESULT)

string(REGEX REPLACE "-dev.*" "-dev" BASE_VERSION "${VERSION}")

find_package(PkgConfig)

#-----------------------------------------------------------------------
# Check for prerequisite libraries
# Check for building on Tilera
# If the Tilera environment is installed, then $TILERA_ROOT is defined
# as the path to the active MDE.

find_package(PkgConfig)
if(DEFINED ENV{TILERA_ROOT})
set(TILERA TRUE)
set(TILERA_ROOT $ENV{TILERA_ROOT})
message("-- Configuring for Tilera MDE ${TILERA_ROOT}")
set(ENV{PKG_CONFIG_PATH}
"${TILERA_ROOT}/tile/usr/lib/pkgconfig:${TILERA_ROOT}/tile/usr/local/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
)
set(CMAKE_SYSTEM_NAME "Tilera")
set(CMAKE_SYSTEM_PROCESSOR "tilegx")
set(CMAKE_C_COMPILER "${TILERA_ROOT}/bin/tile-gcc")
set(CMAKE_LINKER "${TILERA_ROOT}/bin/tile-ld")
set(TILERA_MONITOR "${TILERA_ROOT}/bin/tile-monitor")
#add_definitions(-std=gnu99)
set(CMAKE_FIND_ROOT_PATH "${TILERA_ROOT}/tile")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()

#-----------------------------------------------------------------------
# Check for prerequisite libraries

pkg_check_modules(CORK REQUIRED libcork)
include_directories(${CORK_INCLUDE_DIRS})
Expand Down
5 changes: 5 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ find_program(

set(GENERATE_DOC TRUE)

if (TILERA)
message(STATUS "Note: We don't build documentation on the Tilera platform")
set(GENERATE_DOC FALSE)
endif (TILERA)

if (NOT SPHINX_EXECUTABLE)
message(WARNING "Unable to find Sphinx documentation generator")
set(GENERATE_DOC FALSE)
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ endmacro(make_test)
#-----------------------------------------------------------------------
# Command-line tests

if(TILERA)
configure_file(tile-test ${CMAKE_BINARY_DIR}/tile-test COPYONLY)
endif(TILERA)

find_program(
CRAM_EXECUTABLE
NAMES cram
Expand Down
32 changes: 32 additions & 0 deletions tests/tile-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

if [ ! -x $TILERA_ROOT/bin/tile-monitor ]; then
# If no tile-monitor is installed, then there is nothing to test.
echo "No tile-monitor installed in $TILERA_ROOT/bin"
exit 1
fi

export TEST_DIR="/tmp/test"
export TILERA_COMMON_ARGS=" \
--debug-on-crash \
--mkdir $TEST_DIR/build \
--mkdir $TEST_DIR/tests \
--tile standard \
--mount-tile /usr \
--mount-tile /lib \
--upload . $TEST_DIR/build \
--upload ../tests $TEST_DIR/tests \
--env LD_LIBRARY_PATH="$TEST_DIR/build/src:/usr/local/lib:/usr/lib:/lib" \
--env PATH="/usr/local/bin:$PATH" \
--cd $TEST_DIR/build \
--run -+- ctest -+- --quit"

export TILERA_DEV_ARGS="--resume $TILERA_COMMON_ARGS"
$TILERA_ROOT/bin/tile-monitor $TILERA_DEV_ARGS

## Uncomment the following four lines and comment the previous two if
## you want to run the tests on the Tilera simulator.
#export SIM_IMAGE_SIZE="4x4"
#export TILERA_SIM_ARGS=" \
# --image $SIM_IMAGE_SIZE $TILERA_COMMON_ARGS --functional"
#$TILERA_ROOT/bin/tile-monitor $TILERA_SIM_ARGS

0 comments on commit 49e2bbb

Please sign in to comment.