Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from ben-marshall/buildsystem/cmake
Browse files Browse the repository at this point in the history
Merging Buildsystem/cmake
  • Loading branch information
ben-marshall authored Jul 12, 2016
2 parents 44f36ea + 5569e51 commit 8204fb7
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 198 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ install:
- sudo pip install cpp-coveralls

before_script:
- make setup
- ./bin/project.sh

script:
- cd ./build/debug/
- make parser
- make test

after_success:
- pwd
- make coverage-report
- coveralls -b build/ -e build/bin -e build/lib -i build/coverage -i build/gen -i src/ --gcov-options "-f -b -c"
- pwd
- coveralls -i ../../src/ -i ./src -b .src/CMakeFiles/verilogparser.dir/


after_failure:
- echo "Failure"
Expand Down
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8)

project(verilog-parser)

add_subdirectory(./src)
add_subdirectory(./docs)

add_custom_target(test
COMMAND ./bin/run-tests.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${EXECUTABLE_NAME}
COMMENT "Running Test Suite"
VERBATIM
)
37 changes: 0 additions & 37 deletions Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Standard.
This will get you going workspace wise.

```sh
$> make setup
$> ./bin/project
$> cd ./build/debug
$> make test
```

Expand Down
20 changes: 15 additions & 5 deletions bin/project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ source ../bin/setup-tests.sh
cd ../

# Create build directory structure.
mkdir -p build
mkdir -p build/obj
mkdir -p build/gen
mkdir -p build/lib
mkdir -p build/bin
mkdir -p build/release
mkdir -p build/debug
mkdir -p build/docs

echo "Setup debug build environment..."

cd ./build/debug
cmake -DCMAKE_BUILD_TYPE=Debug ../../
cd -

echo "Setup release build environment..."

cd ./build/release
cmake -DCMAKE_BUILD_TYPE=Release ../../
cd -

echo " "
echo "Project workspace setup complete."
2 changes: 1 addition & 1 deletion bin/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "------------------------- Running Test Script -------------------------"

rm -rf build/tests.log

EXE=build/bin/verilog-app
EXE=./build/debug/src/parser
TEST_FILES=`find tests/ -name *.v | sort`

FAILED_TESTS=" "
Expand Down
10 changes: 2 additions & 8 deletions bin/setup-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ function downloadModelTest {
fi
}

if [ "$CI" -eq "true" ]
then
echo "Not unpacking SPARC test set yet..."
else
echo "Unzipping SPARC test set..."
unzip -o ../bin/sparct1.zip
fi

echo "Unzipping SPARC test set..."
unzip -o ../bin/sparct1.zip

echo "Downloading Tests..."

Expand Down
96 changes: 0 additions & 96 deletions build/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8)

project(verilog-parser-docs)

find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(docs
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
58 changes: 10 additions & 48 deletions docs/project-organisation.dox
Original file line number Diff line number Diff line change
Expand Up @@ -24,62 +24,24 @@ and source code.

@section build-system Build System

The build system is purely GNU Make. There is a top level Makefile with
the most common commands needed for the project included. These are:
The build system uses CMake, and is split into debug and release builds.
These are setup by the `bin/project.sh` script, and are found in the
`build/debug` or `build/release` directories.

- `all` - This builds the parser library, tester app and documentation.
- `app` - Builds the library and test app only.
- `docs` - Builds the documentation for the project.
- `setup` - Initialises the project workspace.
From either of those directories, we can run the following commands:

The `app` and `docs` commands recurse into the `build/` and `docs/`
subdirectories respectively.

@subsection build-system-docs Documentation

All documentation is built using Doxygen. The command to do so is
wrapped in a Makefile with the single command `make docs` in
`docs/Makefile`.

@subsection build-system-source Compilation

Compilation of the source code is handled by the makefile in the `build/`
directory. This makefile should be self explanatory, but is essentially
responsible for generating the flex and bison parsers, compiling object
code, linking into a static library, and creating the test app which
uses this library.

The `build/` folder contains five sub-folders (assuming that `make all`
has been run from the top of the project). These are:

- `bin` - Contains exectuable binaries like the test app.
- `lib` - Static and dynamic libraries, once compiled.
- `obj` - All intermediate object files.
- `gen` - Generated C source code, like the Bison and Flex code.
- `docs` - Documentation Generator output.
- `coverage` - See @ref coverage-info

@subsection coverage-info Coverage

The project uses `gcov` to generate coverage information and `lcov` to
create html reports. The following `make` commands are useful in this case:

- `make app-with-coverage` - This is infact an alias for the
`make with-coverage` in `build/Makefile`. It simply builds the parser
library and test app with the appropriate coverage flags set.
- `make coverage-report` - This runs the script `bin/test-coverage.sh` which
runs all of the available test programs through the test app. The coverage
results are then compiled into the `build/coverage` folder, and the
html reports are generated with lcov.
- `make view-coverage-report` - Opens the generated html coverage reports
in your default html file viewer.
- `make all`
- `make parser` - Builds the library and a small tester app
- `make test` - Runs the test suite against the most recent build.
- `make coverage-report` - Runs the coverage suite against the most recent
build, and puts the results in `./build/coverage/`

@section ci-tool Continuous Integration

This project uses the Travis-CI tool for continuous integration. This is
a service that plugs into github, meaning that every commit, fork and
pull request automatically triggers a build. This build is configured using
the `.travis.yml` file in the root of the project. As a minium, all builds
must complete successfully, and tests should also be run.
must complete successfully, and all of the test should be run without errors.

*/
Loading

0 comments on commit 8204fb7

Please sign in to comment.