Merge pull request #106 from alainmarcel/alainmarcel-patch-1 Working install target
diff --git a/.travis.yml b/.travis.yml index 34a5fca..865cd7d 100644 --- a/.travis.yml +++ b/.travis.yml
@@ -35,4 +35,6 @@ # Build steps script: - make release - + - sudo make install + - make test_install +
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7522b7d..48d1d31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -158,7 +158,6 @@ ${PROJECT_SOURCE_DIR}/src/surelog.h ) - add_library(surelog STATIC ${surelog_SRC}) set_target_properties(surelog PROPERTIES PUBLIC_HEADER "${SURELOG_PUBLIC_HEADERS}") @@ -247,10 +246,13 @@ INSTALL( FILES ${PROJECT_SOURCE_DIR}/src/SourceCompile/SymbolTable.h + ${PROJECT_SOURCE_DIR}/src/SourceCompile/VObjectTypes.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/surelog/SourceCompile ) INSTALL( FILES + ${PROJECT_SOURCE_DIR}/src/ErrorReporting/Location.h + ${PROJECT_SOURCE_DIR}/src/ErrorReporting/Error.h ${PROJECT_SOURCE_DIR}/src/ErrorReporting/ErrorDefinition.h ${PROJECT_SOURCE_DIR}/src/ErrorReporting/ErrorContainer.h ${PROJECT_SOURCE_DIR}/src/ErrorReporting/Report.h @@ -259,6 +261,12 @@ ) INSTALL( FILES + ${PROJECT_SOURCE_DIR}/dist/libantlr4-runtime.a + ${PROJECT_SOURCE_DIR}/build/third_party/flatbuffers/libflatbuffers.a + DESTINATION ${CMAKE_INSTALL_LIBDIR}/surelog + ) +INSTALL( + FILES ${PROJECT_SOURCE_DIR}/src/API/PythonAPI.h ${PROJECT_SOURCE_DIR}/src/API/SLAPI.h ${PROJECT_SOURCE_DIR}/src/API/Surelog.h @@ -271,6 +279,11 @@ ) INSTALL( FILES + ${PROJECT_SOURCE_DIR}/src/DesignCompile/CompileHelper.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/surelog/DesignCompile + ) +INSTALL( + FILES ${PROJECT_SOURCE_DIR}/src/Design/ClockingBlock.h ${PROJECT_SOURCE_DIR}/src/Design/Design.h ${PROJECT_SOURCE_DIR}/src/Design/Instance.h
diff --git a/Makefile b/Makefile index d223a0f..4a46e34 100644 --- a/Makefile +++ b/Makefile
@@ -25,6 +25,10 @@ install: cd build; make install +test_install: + cd tests/TestInstall; rm -rf build; mkdir -p build; cd build; cmake ../ -DINSTALL_DIR=/usr/local; make ; ./test_hellosureworld --version + uninstall: rm -f /usr/local/bin/surelog rm -rf /usr/local/lib/surelog + rm -rf /usr/local/include/surelog
diff --git a/README.md b/README.md index e20d4d3..a726ee8 100644 --- a/README.md +++ b/README.md
@@ -111,6 +111,23 @@ * 0x1 - Fatal error(s) * 0x2 - Syntax error(s) * 0x4 - Error(s) + +### Python API + + * The file [`slformatmsg.py`](src/API/slformatmsg.py) illustrates how messages can be reformated. + * Place a modified version of this file either in the execution directory, or install directory /usr/local/lib/surelog/python + + * The file [`src/API/slSV3_1aPythonListener.py`](src/API/src/API/slSV3_1aPythonListener.py) illustrates how a listener can be created to listen to the Parser AST. + * Place a modified version of this file either in the execution directory, or install directory /usr/local/lib/surelog/python + + * A simple example of creating a new error message and generating errors can be found here: [`python_listener.py`](src/API/python_listener.py) + + * The complete Python API is described in the following files: [`SLAPI.h`](src/API/SLAPI.h) [`vobjecttypes`](src/API/vobjecttypes.py) + + * Waivers can be installed in slwaivers.py files in the execution directory or install directory /usr/local/lib/surelog/python + +### Creating your own executable using libsurelog.a + * This is discussed in [`src/README`](src/README.md) file. ### Similar projects:
diff --git a/src/API/python_listener.py b/src/API/python_listener.py index ef07414..8f960f8 100644 --- a/src/API/python_listener.py +++ b/src/API/python_listener.py
@@ -1,4 +1,4 @@ -# Sample listener used to test release tar file, used by release.tcl +# Sample listener SLregisterNewErrorType("[NOTE :PY0403]", "Module declaration \"%s\"", ""); SLoverrideSeverity("[NOTE :PY0403]", "INFO")
diff --git a/src/API/surelog.bash b/src/API/surelog.bash deleted file mode 100644 index 253354b..0000000 --- a/src/API/surelog.bash +++ /dev/null
@@ -1,6 +0,0 @@ -#!/bin/bash -# Surelog Bash invocation script -SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -export LD_LIBRARY_PATH=${SCRIPTPATH}/lib:$LD_LIBRARY_PATH -${SCRIPTPATH}/bin/surelog.exe "$@" -
diff --git a/src/Design/Scope.h b/src/Design/Scope.h index 34d9431..a91aeee 100644 --- a/src/Design/Scope.h +++ b/src/Design/Scope.h
@@ -30,10 +30,11 @@ #include "Design/DataType.h" #include "Design/TfPortItem.h" #include "Testbench/Variable.h" -#include "DesignCompile/CompileHelper.h" namespace SURELOG { +class Statement; + class Scope { public: Scope(std::string name, Scope* parent)
diff --git a/src/README.md b/src/README.md index 83d1a71..d22e0ae 100644 --- a/src/README.md +++ b/src/README.md
@@ -17,12 +17,20 @@ ### Run a test +* When in the Surelog/build directory, run one of the following: + * dist/Release/surelog -help * dist/Release/surelog -writepp -parse ../tests/UnitElabBlock/top.v * dist/Release/hellosureworld ../tests/UnitElabBlock/top.v -parse -mutestdout +### Create your own executable with the libsurelog.a library + +* The CMake file Surelog/tests/TestInstall/CMakeLists.txt contains the instructions to create your own executable that uses the surelog library for design parsing and creation of the Design/Testbench data model. + +* The source file Surelog/src/hellosureworld.cpp contains the "HelloWorld" for surelog library usage and data model browsing. + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ## Modus operanti for grammar development:
diff --git a/src/surelog.h b/src/surelog.h index 56c86bb..08c74f8 100644 --- a/src/surelog.h +++ b/src/surelog.h
@@ -21,6 +21,10 @@ #include "CommandLine/CommandLineParser.h" #include "SourceCompile/SymbolTable.h" +#include "SourceCompile/VObjectTypes.h" +#include "ErrorReporting/Location.h" +#include "ErrorReporting/Error.h" +#include "ErrorReporting/ErrorDefinition.h" #include "ErrorReporting/ErrorContainer.h" #include "ErrorReporting/Waiver.h" @@ -34,6 +38,7 @@ // Full C++ DataModel API #include "Common/ClockingBlockHolder.h" +#include "DesignCompile/CompileHelper.h" #include "Design/ClockingBlock.h" #include "Design/Design.h" #include "Design/Instance.h"
diff --git a/tests/TestInstall/CMakeLists.txt b/tests/TestInstall/CMakeLists.txt new file mode 100644 index 0000000..e6a7f80 --- /dev/null +++ b/tests/TestInstall/CMakeLists.txt
@@ -0,0 +1,39 @@ +# -*- mode:cmake -*- + +project(HELLOSUREWORLD) + +set(CMAKE_CXX_STANDARD 11) + +cmake_minimum_required(VERSION 3.0) + +# Python +find_package(PythonLibs 3.3 REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) +message(STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") +message(STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") +message(STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") + +# Directories +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/) +set(CMAKE_BUILD_FILES_DIRECTORY ${dir}) +set(CMAKE_BUILD_DIRECTORY ${dir}) + +# C++ +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free ${MY_CXX_WARNING_FLAGS}") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -O0 -g ${MY_CXX_WARNING_FLAGS}") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -O3 -DNDEBUG ${MY_CXX_WARNING_FLAGS}") + +set (INCLUDE_DIR "${INSTALL_DIR}/include/surelog/") + +include_directories(${INCLUDE_DIR}) + +set (LIB_DIR "${INSTALL_DIR}/lib/surelog/") + +set (INSTALL_LIBRARIES_FOR_SURELOG -L${LIB_DIR} surelog antlr4-runtime flatbuffers + ${PYTHON_LIBRARIES} dl util m rt pthread tcmalloc +) + +add_executable(test_hellosureworld ${PROJECT_SOURCE_DIR}/../../src/hellosureworld.cpp) +target_link_libraries( + test_hellosureworld ${INSTALL_LIBRARIES_FOR_SURELOG} +)