mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
build configuration update
This commit is contained in:
parent
b4f5616814
commit
3534175d43
8 changed files with 75 additions and 89 deletions
30
.travis.yml
30
.travis.yml
|
@ -22,29 +22,27 @@ cache:
|
|||
- $HOME/build64
|
||||
|
||||
before_install:
|
||||
- cp -r $HOME/third_party .
|
||||
- if [ ! -d "$TOOLDIR" ] || [ -z "$(ls -A $TOOLDIR)" ] || [ "$(cat "$TOOLDIR/version.txt")" != "v1" ]; then
|
||||
rm -rf $TOOLDIR;
|
||||
mkdir -p $TOOLDIR;
|
||||
OSDIR=ubuntu/focal ./ci/toolchain_install.sh --all;
|
||||
echo "v1" > "$TOOLDIR/version.txt";
|
||||
fi
|
||||
- if [ ! -d "$HOME/third_party" ] || [ -z "$(ls -A $HOME/third_party)" ] || [ "$(cat "$HOME/third_party/version.txt")" != "v0" ]; then
|
||||
make -C third_party > /dev/null;
|
||||
cp -r third_party $HOME;
|
||||
echo "v0" > "$HOME/third_party/version.txt";
|
||||
else
|
||||
cp -r $HOME/third_party .
|
||||
fi
|
||||
- source ./ci/toolchain_env.sh
|
||||
|
||||
stages:
|
||||
- setup
|
||||
- build
|
||||
- test
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: setup
|
||||
script:
|
||||
- if [ ! -d "$TOOLDIR" ] || [ -z "$(ls -A $TOOLDIR)" ] || [ "$(cat "$TOOLDIR/version.txt")" != "v1" ]; then
|
||||
rm -rf $TOOLDIR;
|
||||
mkdir -p $TOOLDIR;
|
||||
OSDIR=ubuntu/focal ./ci/toolchain_install.sh --all;
|
||||
echo "v1" > "$TOOLDIR/version.txt";
|
||||
fi
|
||||
- if [ ! -d "$HOME/third_party" ] || [ -z "$(ls -A $HOME/third_party)" ] || [ "$(cat "$HOME/third_party/version.txt")" != "v0" ]; then
|
||||
make -C third_party > /dev/null;
|
||||
cp -r third_party $HOME;
|
||||
echo "v0" > "$HOME/third_party/version.txt";
|
||||
fi
|
||||
include:
|
||||
- stage: build
|
||||
name: build32
|
||||
script:
|
||||
|
|
|
@ -58,12 +58,12 @@ More detailed build instructions can be found [here](docs/install_vortex.md).
|
|||
|
||||
$ TOOLDIR=$HOME/tools ./ci/toolchain_install.sh --all
|
||||
|
||||
### Set up environment variables
|
||||
$ source ./ci/toolchain_env.sh
|
||||
### Building Vortex
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ TOOLDIR=$HOME/tools ../configure
|
||||
$ make
|
||||
### Set up environment variables
|
||||
$ source ./ci/toolchain_env.sh
|
||||
### Quick demo running vecadd OpenCL kernel on 2 cores
|
||||
$ ./ci/blackbox.sh --cores=2 --app=vecadd
|
2
ci/toolchain_env.sh → ci/toolchain_env.sh.in
Normal file → Executable file
2
ci/toolchain_env.sh → ci/toolchain_env.sh.in
Normal file → Executable file
|
@ -14,7 +14,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
TOOLDIR=${TOOLDIR:=/opt}
|
||||
TOOLDIR=${TOOLDIR:=@TOOLDIR@}
|
||||
|
||||
export VERILATOR_ROOT=$TOOLDIR/verilator
|
||||
export PATH=$VERILATOR_ROOT/bin:$PATH
|
|
@ -17,7 +17,7 @@
|
|||
set -e
|
||||
|
||||
REPOSITORY=https://github.com/vortexgpgpu/vortex-toolchain-prebuilt/raw/master
|
||||
TOOLDIR=${TOOLDIR:=/opt}
|
||||
TOOLDIR=${TOOLDIR:=@TOOLDIR@}
|
||||
OSDIR=${OSDIR:=ubuntu/bionic}
|
||||
|
||||
OS="${OS:=ubuntu/bionic}"
|
|
@ -16,7 +16,7 @@
|
|||
# exit when any command fails
|
||||
set -e
|
||||
|
||||
TOOLDIR=${TOOLDIR:=/opt}
|
||||
TOOLDIR=${TOOLDIR:=@TOOLDIR@}
|
||||
OSDIR=${OSDIR:=ubuntu/bionic}
|
||||
|
||||
riscv()
|
106
configure
vendored
106
configure
vendored
|
@ -28,67 +28,65 @@ CURRENT_DIR=$(pwd)
|
|||
|
||||
THIRD_PARTY_DIR=$SCRIPT_DIR/third_party
|
||||
|
||||
# Path to the template file
|
||||
TEMPLATE="$SCRIPT_DIR/config.in"
|
||||
|
||||
# Output file
|
||||
OUTPUT="config.mk"
|
||||
|
||||
# Function to process config.in and generate config.mk
|
||||
generate_config() {
|
||||
if [ -f "$TEMPLATE" ]; then
|
||||
# Replace tokens
|
||||
sed "s|@VORTEX_HOME@|$SCRIPT_DIR|g; s|@XLEN@|$XLEN|g; s|@TOOLDIR@|$TOOLDIR|g " "$TEMPLATE" > "$CURRENT_DIR/$OUTPUT"
|
||||
else
|
||||
echo "Template file $TEMPLATE not found."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to recursively copy Makefiles, skipping the current directory
|
||||
copy_makefiles() {
|
||||
# Function to recursively copy files, skipping the current directory
|
||||
copy_files() {
|
||||
local source_dir="$1"
|
||||
local target_dir="$2"
|
||||
#echo "source_dir=$source_dir, target_dir=$target_dir"
|
||||
|
||||
local same_dir=0
|
||||
if [ "$(realpath "$source_dir")" == "$(realpath "$target_dir")" ]; then
|
||||
same_dir=1
|
||||
fi
|
||||
|
||||
# Function to copy and update file
|
||||
copy_and_update() {
|
||||
local src_pattern="$1"
|
||||
local dest_dir="$2"
|
||||
for file in $src_pattern; do
|
||||
#echo "*** $file > $dest_dir"
|
||||
if [ -f "$file" ]; then
|
||||
if [[ "$file" == *.in ]]; then
|
||||
filename=$(basename -- "$file")
|
||||
filename_no_ext="${filename%.in}"
|
||||
mkdir -p "$dest_dir"
|
||||
sed "s|@VORTEX_HOME@|$SCRIPT_DIR|g; s|@XLEN@|$XLEN|g; s|@TOOLDIR@|$TOOLDIR|g" "$file" > "$dest_dir/$filename_no_ext"
|
||||
else
|
||||
if [ $same_dir -eq 0 ]; then
|
||||
mkdir -p "$dest_dir"
|
||||
cp "$file" "$dest_dir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
for pattern in "${SUBDIRS[@]}"; do
|
||||
local full_copy=0
|
||||
if [[ "$pattern" == !* ]]; then
|
||||
local dir_to_copy="${pattern#!}" # Remove the "!" from the start
|
||||
cp -r "$source_dir/$dir_to_copy" "$target_dir/"
|
||||
elif [[ "$pattern" == "." ]]; then
|
||||
# Handle the current script directory explicitly
|
||||
if [ -f "$source_dir/Makefile" ]; then
|
||||
mkdir -p "$target_dir"
|
||||
cp "$source_dir/Makefile" "$target_dir"
|
||||
fi
|
||||
else
|
||||
# Use find to match the directory pattern and process each matched directory
|
||||
find "$source_dir" -type d -path "$source_dir/$pattern" 2>/dev/null | while read dir; do
|
||||
# Compute the relative path of the directory
|
||||
local rel_path="${dir#$source_dir}"
|
||||
rel_path="${rel_path#/}" # Remove leading slash, if present
|
||||
local full_target_dir="$target_dir/$rel_path"
|
||||
|
||||
# Function to copy and update file includes
|
||||
copy_and_update_includes() {
|
||||
local file="$1"
|
||||
local dest="$2/$file"
|
||||
if [ -f "$dir/$file" ]; then
|
||||
mkdir -p "$2"
|
||||
cp "$dir/$file" "$dest"
|
||||
fi
|
||||
}
|
||||
|
||||
# Copy and update Makefile and common.mk if they exist
|
||||
copy_and_update_includes "Makefile" "$full_target_dir"
|
||||
copy_and_update_includes "common.mk" "$full_target_dir"
|
||||
done
|
||||
full_copy=1
|
||||
pattern=${pattern:1}
|
||||
fi
|
||||
local source_pattern="$source_dir/$pattern"
|
||||
if [[ "$pattern" == "." ]]; then
|
||||
source_pattern=$source_dir
|
||||
fi
|
||||
find "$source_dir" -type d -path "$source_pattern" 2>/dev/null | while read dir; do
|
||||
# Compute the relative path of the directory
|
||||
local rel_path="${dir#$source_dir}"
|
||||
rel_path="${rel_path#/}" # Remove leading slash, if present
|
||||
local full_target_dir="$target_dir/$rel_path"
|
||||
|
||||
# Copy and update Makefile and common.mk if they exist
|
||||
if [ $full_copy -eq 1 ]; then
|
||||
copy_and_update "$dir/*" "$full_target_dir"
|
||||
else
|
||||
copy_and_update "$dir/Makefile" "$full_target_dir"
|
||||
copy_and_update "$dir/common.mk" "$full_target_dir"
|
||||
copy_and_update "$dir/*.in" "$full_target_dir"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
generate_config
|
||||
|
||||
if [ "$(realpath "$SCRIPT_DIR")" != "$(realpath "$CURRENT_DIR")" ]; then
|
||||
copy_makefiles "$SCRIPT_DIR" "$CURRENT_DIR"
|
||||
fi
|
||||
copy_files "$SCRIPT_DIR" "$CURRENT_DIR"
|
||||
|
|
|
@ -39,18 +39,13 @@
|
|||
$ TOOLDIR=$HOME/tools ./ci/toolchain_install.sh --all
|
||||
```
|
||||
|
||||
5. Set up environment:
|
||||
|
||||
```
|
||||
$ source ./ci/toolchain_env.sh
|
||||
```
|
||||
|
||||
6. Build Vortex
|
||||
5. Build Vortex
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ TOOLDIR=$HOME/tools ../configure
|
||||
$ source ./ci/toolchain_env.sh
|
||||
$ make
|
||||
```
|
||||
|
||||
|
@ -92,17 +87,12 @@ Note: depending on the system, some of the toolchain may need to be recompiled f
|
|||
$ TOOLDIR=$HOME/tools ./ci/toolchain_install.sh --all
|
||||
```
|
||||
|
||||
6. Set up environment:
|
||||
|
||||
```
|
||||
$ source ./ci/toolchain_env.sh
|
||||
```
|
||||
|
||||
7. Build Vortex
|
||||
6. Build Vortex
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ TOOLDIR=$HOME/tools ../configure
|
||||
$ source ./ci/toolchain_env.sh
|
||||
$ make
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue