Added CMake support

This commit is contained in:
Borna Rajkovic 2022-04-08 19:13:53 +02:00
parent b8bd4a678a
commit 0a0b20a156
8 changed files with 59 additions and 54 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/cmake-build-debug/**
/.idea/**

44
CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.9)
project(SchemeEditor)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Core Gui Widgets)
set(CMAKE_AUTOMOC TRUE)
set(CMAKE_AUTORCC TRUE)
set(CMAKE_AUTOUIC TRUE)
add_executable(SchemeEditor
mainwindow.cpp
comdel/display/component_display.cpp
comdel/display/schema_display.cpp
comdel/display/library_display.cpp
comdel/domain/value.cpp
comdel/domain/schema.cpp
comdel/domain/component.cpp
comdel/domain/connectioninstance.cpp
comdel/domain/rule.cpp
comdel/domain/wireinstance.cpp
comdel/domain/attribute.cpp
comdel/domain/bus.cpp
comdel/domain/pin.cpp
comdel/domain/display.cpp
comdel/domain/library.cpp
comdel/domain/functionsignature.cpp
comdel/domain/addressspace.cpp
comdel/domain/instanceattribute.cpp
comdel/domain/connection.cpp
comdel/domain/instance.cpp
comdel/domain/comdelgenerator.cpp
comdel/parser/assert.cpp
comdel/parser/comdelparser.cpp
comdel/parser/token.cpp
comdel/parser/parser_util.cpp
comdel/parser/sourceerror.cpp
comdel/parser/parsecontext.cpp
comdel/parser/tokenstype.cpp
comdel/parser/astnode.cpp
comdel/parser/parserutil.cpp
comdel/parser/comdellexer.cpp
main.cpp
mainwindow.ui
)
target_link_libraries(SchemeEditor Qt5::Core Qt5::Gui Qt5::Widgets)

View File

@ -150,7 +150,7 @@ std::optional<Library> ComdelGenerator::loadLibrary(LibraryNode node)
for(uint i=0; i<node.messages.size(); i++) { for(uint i=0; i<node.messages.size(); i++) {
if(!node.messages[i].value.is(ValueNode::STRING)) { if(!node.messages[i].value.is(ValueNode::STRING)) {
errors.push_back(SourceError{node.messages[i].span, "expected `string`"}); errors.push_back(SourceError{node.messages[i].value.span, "expected `string`"});
} else { } else {
messages[node.messages[i].key.value] = node.messages[i].value.asString(); messages[node.messages[i].key.value] = node.messages[i].value.asString();
} }

View File

@ -1,18 +0,0 @@
#include "comdelvalidator.h"
namespace domain {
ComdelValidator::ComdelValidator(std::vector<FunctionSignature> signatures)
: signatures(signatures)
{}
std::vector<SourceError> ComdelValidator::getErrors() {
return errors;
}
void validateLibrary(Library library, ParseContext* parseContext, std::ostream& stream) {
}
} // namespace domain

View File

@ -1,34 +0,0 @@
#ifndef DOMAIN_COMDELVALIDATOR_H
#define DOMAIN_COMDELVALIDATOR_H
#include "functionsignature.h"
#include "library.h"
#include <vector>
#include <comdel/parser/parsecontext.h>
#include <comdel/parser/sourceerror.h>
namespace domain {
class ComdelValidator
{
private:
std::vector<SourceError> errors;
std::vector<FunctionSignature> signatures;
public:
ComdelValidator(std::vector<FunctionSignature> signatures);
std::vector<SourceError> getErrors() {
return errors;
}
void validateLibrary(Library library, ParseContext* parseContext, std::ostream& stream);
};
} // namespace domain
#endif // DOMAIN_COMDELVALIDATOR_H

View File

@ -6,6 +6,7 @@
#include <string> #include <string>
#include <optional> #include <optional>
namespace domain { namespace domain {
class Value class Value

View File

@ -66,7 +66,7 @@ struct AddressSpaceNode: public AstNode
}; };
class ValueNode: AstNode class ValueNode: public AstNode
{ {
public: public:
enum ValueType { enum ValueType {

View File

@ -11,6 +11,8 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
w.show(); w.show();