diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 000000000..ceac7c74f
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,76 @@
+name: Librecad3 Builders
+'on':
+ workflow_dispatch: null
+ push:
+ branches:
+ - main
+jobs:
+ linux:
+ name: Building LibreCAD3 on ubuntu runner
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2.4.2
+ with:
+ submodules: 'recursive'
+
+ - run: ${{ github.workspace }}/scripts/ubuntu-install/installDependenciesAndBuildRepo.sh
+
+ - run: cd ${{ github.workspace }}
+
+ - run: sudo ${{ github.workspace }}/scripts/ubuntu-install/createAppImage.sh
+
+ - run: cd ${{ github.workspace }}
+
+ - run: ${{ github.workspace }}/scripts/ubuntu-install/createSnap.sh
+
+ - name: Uploading AppImage
+ uses: actions/upload-artifact@v3.1.0
+ with:
+ path: ${{ github.workspace }}/build/LibreCAD**AppImage
+ name: LibreCAD3.AppImage
+ - name: Uploading snap
+ uses: actions/upload-artifact@v3.1.0
+ with:
+ path: ${{ github.workspace }}/librecad**snap
+ name: LibreCAD3.snap
+ windows:
+ name: Building LibreCAD3 on windows runner
+ runs-on: windows-latest
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v2.4.2
+ with:
+ submodules: 'recursive'
+
+ - name: Install Visual Studio 2019 with tools
+ run: ${{ github.workspace }}/scripts/windows-install/installVisualStudio.bat
+
+ - run: cd ${{ github.workspace }}
+
+ - run: ${{ github.workspace }}/scripts/windows-install/installConan.bat
+
+ - run: ${{ github.workspace }}/scripts/windows-install/createConanDirAndInstallDependencies.bat
+
+ - run: cd ${{ github.workspace }}/..
+
+ - name: Install Qt5
+ uses: jurplel/install-qt-action@v2
+ with:
+ version: 5.12.2
+
+ - run: setx QTDIR "${{ env.Qt5_DIR }}\5.15.2\msvc2019_64"
+
+ - run: setx QT_QPA_PLATFORM_PLUGIN_PATH "${{ env.Qt5_DIR }}\plugins\platforms\"
+
+ - run: ${{ github.workspace }}/scripts/windows-install/addPathVariables.ps1
+
+ - run: cd ${{ github.workspace }}
+
+ - run: ${{ github.workspace }}/scripts/windows-install/buildLibrecadAndCreatePackage.bat
+ - name: Uploading exe
+ uses: actions/upload-artifact@v3.1.0
+ with:
+ path: '${{ github.workspace }}/out/build/windows-default/LibreCAD3**.exe'
+ name: LibreCAD3.exe
diff --git a/AppImage/librecad.desktop b/AppImage/librecad.desktop
new file mode 100644
index 000000000..4904b5fac
--- /dev/null
+++ b/AppImage/librecad.desktop
@@ -0,0 +1,59 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=LibreCAD
+GenericName=CAD system
+GenericName[da]=Computerhjulpet design (CAD)
+GenericName[de]=System für computerunterstützte Konstruktion
+GenericName[it]=Sistema CAD
+GenericName[ja]=コンピュータ支援設計 (CAD) システム
+GenericName[ru]=Система автоматизированного проектирования
+GenericName[sk]=CAD systém
+GenericName[uk]=Система автоматизованого проектування
+Comment=A professional CAD System
+Comment[es]=Un sistema CAD profesional
+Comment[ru]=Профессиональная CAD система
+Comment[sq]=Një sistem profesional CAD
+Comment[be]=Прафэсійная CAD-сыстэма
+Comment[ast]=Un sistema CAD profesional
+Comment[bn]=পেশাদারী CAD পদ্ধতি
+Comment[bs]=Profesionalni sistem CAD
+Comment[pt_BR]=Um sistema CAD profissional
+Comment[bg]=Професионална CAD система
+Comment[ca]=Un sistema CAD professional
+Comment[ca@valencia]=Un sistema CAD professional
+Comment[zh_HK]=專業 CAD 系統
+Comment[da]=Et professionelt CAD-system
+Comment[cs]=Profesionální CAD systém
+Comment[crh]=Profesyonel CAD Sistemi
+Comment[zh_TW]=專業 CAD 系統
+Comment[zh_CN]=一个专业的 CAD 系统
+Comment[nl]=Een professioneel CAD-systeem
+Comment[fi]=Ammattimainen CAD-järjestelmä
+Comment[fr]=Un système de CAO professionnel
+Comment[gl]=Un sistema de CAD profesional
+Comment[de]=Ein professionelles CAD-System
+Comment[el]=Ένα επαγγελματικό σύστημα σχεδίασης CAD
+Comment[is]=Hágæða teiknikerfi (CAD)
+Comment[hu]=Professzionális CAD-rendszer
+Comment[it]=Un sistema CAD professionale
+Comment[ja]=プロフェッショナル CAD システム
+Comment[ky]=Кесиптик CAD - тутуму
+Comment[ms]=Sistem CAD profesional
+Comment[nb]=Et profesjonelt CAD-system
+Comment[pt]=Um sistema CAD profissional
+Comment[pl]=Profesjonalny system CAD
+Comment[oc]=Un sistèma de CAO professional
+Comment[ro]=Un sistem profesional CAD
+Comment[tg]=Системаи касбии CAD
+Comment[sv]=Professionellt CAD-system
+Comment[sl]=Profesionalni sistem CAD
+Comment[uk]=Професійна САПР
+Comment[tr]=Profesyonel CAD Sistemi
+TryExec=librecad
+Exec=librecad %F
+Icon=librecad
+Categories=Graphics;Engineering;
+MimeType=image/vnd.dxf;
+X-AppImage-Version=da592de
+
diff --git a/AppImage/librecad.svg b/AppImage/librecad.svg
new file mode 100644
index 000000000..da0866e19
--- /dev/null
+++ b/AppImage/librecad.svg
@@ -0,0 +1,222 @@
+
+
+
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e4deaccf..802aec29e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,16 @@
cmake_minimum_required(VERSION 3.6)
project(LC)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+#https://stackoverflow.com/questions/7229571/cmake-visual-studio-debug-folder
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) #This for each is needed to avoid binary builds in bin/relDebWithInfo folder
+foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
+ string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
+ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin )
+endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(WITH_QT_UI "With QT user interface" ON)
-option(WITH_LUACMDINTERFACE "Build Lua command line interface" ON)
+option(WITH_LUACMDINTERFACE "Build Lua command line interface" ON) #TODO fails in Ubuntu 18.04, this is why OFF #Trying out it on ON again, since now we are using 20.04
option(WITH_UNITTESTS "Build unit tests" ON)
option(WITH_RENDERING_UNITTESTS "Build rendering unit tests (require GDK)" ON)
option(WITH_LIBOPENCAD "Use libopencad" OFF)
@@ -22,7 +28,7 @@ if (NOT MSVC) # Too much warnings on MSVC
endif()
include(GNUInstallDirs)
-set(FINAL_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
+set(FINAL_INSTALL_DIR "finalInstallDir")
if(EXISTS "${CMAKE_SOURCE_DIR}/conan/conanbuildinfo.cmake")
include(${CMAKE_SOURCE_DIR}/conan/conanbuildinfo.cmake)
@@ -82,8 +88,8 @@ set(CMAKE_CXX_STANDARD 14)
set(Boost_USE_MULTITHREADED ON)
-# settings path
-set(SETTINGS_PATH "${PROJECT_BINARY_DIR}/bin")
+set(SETTINGS_PATH "") #The settings will be at the same place as executable.
+
# Add dirent.h if compiler is MSVC
if(MSVC)
@@ -155,3 +161,69 @@ find_file(
/usr/bin
DOC "Path to clang-tidy executable"
)
+
+# Install all needed files in windows and set up some cpack variables
+IF (WIN32)
+
+#Cpack -> NSIS
+#General Vars
+set(CPACK_PACKAGE_NAME "LibreCAD3")
+set(CPACK_PACKAGE_VENDOR "LibreCAD")
+set(CPACK_PACKAGE_VERSION_MAJOR "0")
+set(CPACK_PACKAGE_VERSION_MINOR "1")
+set(CPACK_PACKAGE_VERSION_PATCH "1")
+set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}) #name of the install folder
+set(CPACK_PACKAGE_DESCRIPTION "LibreCAD is a free Open Source CAD application for Windows, Apple and Linux. Support and documentation are free from our large, dedicated community of users, contributors and developers.")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source 2D-CAD")
+set(CPACK_PACKAGE_HOMEPAGE_URL "https://librecad.org/")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
+#NSIS Vars
+set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
+set(CPACK_NSIS_MODIFY_PATH "ON")
+set(CPACK_CREATE_DESKTOP_LINKS "ON")
+set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_NAME})
+set(CPACK_NSIS_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
+set(CPACK_NSIS_HELP_LINK "https://github.com/LibreCAD/LibreCAD_3")
+set(CPACK_NSIS_URL_INFO_ABOUT ${CPACK_PACKAGE_HOMEPAGE_URL})
+set(CPACK_NSIS_CONTACT "https://librecad.zulipchat.com/login/")
+set(CPACK_NSIS_FINISH_TITLE "Thanks for installing LibreCAD 3")
+#For the shortcut
+set(CPACK_PACKAGE_EXECUTABLES
+ "librecad" "Librecad shortcut"
+)
+set(CPACK_CREATE_DESKTOP_LINKS
+ "librecad"
+)
+include(CPack)
+
+
+install(
+ DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ DESTINATION ${CMAKE_INSTALL_BINDIR}/.. # Since we get the folder(bin) instead of the files, we must "paste" to the root install folder
+ PATTERN "*.pdb" EXCLUDE
+ PATTERN "*.exe" EXCLUDE
+ PATTERN "path.lua" EXCLUDE
+)
+install(
+ FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/librecad.exe
+ DESTINATION ${CMAKE_INSTALL_BINDIR} # install librecad in the bin folder of the installer
+)
+
+ENDIF()
+
+install(FILES "${CMAKE_SOURCE_DIR}/path.lua"
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
+
+#Get shaders and fonts
+install(
+ DIRECTORY ${CMAKE_SOURCE_DIR}/lcviewernoqt/painters/opengl/resources/shaders
+ DESTINATION ${CMAKE_INSTALL_BINDIR}/../resources
+)
+
+install(
+ DIRECTORY ${CMAKE_SOURCE_DIR}/lcviewernoqt/painters/opengl/resources/fonts
+ DESTINATION ${CMAKE_INSTALL_BINDIR}/../resources
+)
+
+include(InstallRequiredSystemLibraries)
diff --git a/desktop/librecad.svg b/desktop/librecad.svg
new file mode 100644
index 000000000..da0866e19
--- /dev/null
+++ b/desktop/librecad.svg
@@ -0,0 +1,222 @@
+
+
+
+
diff --git a/lcUI/CMakeLists.txt b/lcUI/CMakeLists.txt
index 0b32f4246..625b614b9 100644
--- a/lcUI/CMakeLists.txt
+++ b/lcUI/CMakeLists.txt
@@ -4,6 +4,7 @@ PROJECT (LC)
message("***** LibreCAD Qt user interface *****")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+set (SETTINGS_PATH "${CMAKE_INSTALL_BINDIR}")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -273,7 +274,7 @@ if(WITH_UNITTESTS)
target_link_libraries(lcui ${EXTRA_LIBS})
endif(WITH_UNITTESTS)
-add_executable(librecad ${UI_srcs} ${UI_hdrs} ${UI_HEADERS} ${UI_RESOURCES})
+add_executable(librecad ${UI_srcs} ${UI_hdrs} ${UI_HEADERS} ${UI_RESOURCES})
qt5_use_modules(librecad Core Gui Widgets OpenGL Svg)
@@ -282,6 +283,6 @@ ${GLEW_LIBRARY})
# INSTALLATION
install(TARGETS librecad DESTINATION "${CMAKE_INSTALL_BINDIR}")
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/lcUI/ui" DESTINATION "usr/share/librecad/lcUI")
-file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/default_ui_settings.json" DESTINATION "${SETTINGS_PATH}")
-file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/settings_schema.json" DESTINATION "${SETTINGS_PATH}")
+install(DIRECTORY "${CMAKE_SOURCE_DIR}/lcUI/ui" DESTINATION "${FINAL_INSTALL_DIR}/usr/share/librecad/lcUI")
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/default_ui_settings.json" DESTINATION "${CMAKE_INSTALL_BINDIR}")
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/settings_schema.json" DESTINATION "${CMAKE_INSTALL_BINDIR}")
diff --git a/lcUI/lcadviewer.cpp b/lcUI/lcadviewer.cpp
index be2262533..6405d90bc 100644
--- a/lcUI/lcadviewer.cpp
+++ b/lcUI/lcadviewer.cpp
@@ -7,6 +7,7 @@
#include
#include "widgets/guiAPI/menu.h"
#include "managers/contextmenumanager.h"
+#include "viewersettings.h"
using namespace lc;
using namespace lc::ui;
@@ -108,6 +109,15 @@ LCADViewer::~LCADViewer()
void LCADViewer::initializeGL()
{
+ QString sPathToShaders = QCoreApplication::applicationDirPath() + "/../resources/shaders/";
+ QString sPathToFonts = QCoreApplication::applicationDirPath() + "/../resources/fonts/";
+
+ auto pathToShaders = lc::storage::settings::StringSettingValue(sPathToShaders.toStdString());
+ auto pathToFonts = lc::storage::settings::StringSettingValue(sPathToFonts.toStdString());
+
+ (lc::viewer::setShader(pathToShaders));
+ (lc::viewer::setFont(pathToFonts));
+
QOpenGLWidget::makeCurrent();
QOpenGLContext *CC= QOpenGLContext::currentContext();
diff --git a/lcUI/lcadviewer.h b/lcUI/lcadviewer.h
index 3ecf8f51d..d637e15cb 100644
--- a/lcUI/lcadviewer.h
+++ b/lcUI/lcadviewer.h
@@ -187,4 +187,4 @@ public slots:
int _contextMenuManagerId;
};
}
-}
+}
\ No newline at end of file
diff --git a/lcUI/luainterface.cpp b/lcUI/luainterface.cpp
index 9bf1c9f79..c57e4209e 100644
--- a/lcUI/luainterface.cpp
+++ b/lcUI/luainterface.cpp
@@ -30,11 +30,11 @@ void LuaInterface::initLua(QMainWindow* mainWindow) {
_L["luaInterface"] = this;
registerGlobalFunctions(mainWindow);
-
QString luaFile = QCoreApplication::applicationDirPath() + "/path.lua";
bool s = _L.dofile(luaFile.toStdString().c_str());
std::string luaPath = _L["lua_path"];
+ luaPath = QCoreApplication::applicationDirPath().toStdString() + "/" + luaPath;
lc::ui::OperationLoader opLoader(luaPath, mainWindow, _L);
if (s) {
diff --git a/lcUI/managers/uisettings.cpp b/lcUI/managers/uisettings.cpp
index 47ce092b8..fb5c1a01b 100644
--- a/lcUI/managers/uisettings.cpp
+++ b/lcUI/managers/uisettings.cpp
@@ -5,9 +5,11 @@
#include
#include
#include
+#include
#include
+
using namespace lc::ui;
void UiSettings::writeSettings(widgets::CustomizeToolbar* customizeToolbar) {
@@ -28,7 +30,7 @@ void UiSettings::readSettings(widgets::CustomizeToolbar* customizeToolbar, bool
}
bool UiSettings::validateSettingsDocument(rapidjson::Document& inputDocument) {
- std::ifstream schemaFile(_filePaths["settings_load"] + schemaFileName);
+ std::ifstream schemaFile(QCoreApplication::applicationDirPath().toStdString() + _filePaths["settings_load"] + schemaFileName);
if (schemaFile.fail()) {
std::cout << "Schema file not found" << std::endl;
@@ -112,13 +114,13 @@ std::map UiSettings::readDockSettings(std::mapgetString());
- _font_path=(lc::viewer::viewerSettings.get(SETTINGS_GL_FONT_PATH)->getString());
+ _ctm = glm::mat4(1.0f);
+ _view = _ctm;
+ _shader_path = (lc::viewer::viewerSettings.get(SETTINGS_GL_SHADER_PATH)->getString());
+ _font_path = (lc::viewer::viewerSettings.get(SETTINGS_GL_FONT_PATH)->getString());
}
Renderer::~Renderer()
@@ -16,32 +16,32 @@ Renderer::~Renderer()
void Renderer::createResources()
{
_shaders.basic_shader = new Shader();
- _shaders.basic_shader->gen(_shader_path+"basic_shader.shader");
+ _shaders.basic_shader->gen(_shader_path + "basic_shader.shader");
_shaders.basic_shader->unbind();
_shaders.gradient_shader = new Shader();
- _shaders.gradient_shader->gen(_shader_path+"color_vertex_shader.shader", [](GLuint programId) {
+ _shaders.gradient_shader->gen(_shader_path + "color_vertex_shader.shader", [](GLuint programId) {
glBindAttribLocation(programId, 0, "pos");
glBindAttribLocation(programId, 1, "prev_distance");
glBindAttribLocation(programId, 2, "col");
- });
+ });
_shaders.gradient_shader->unbind();
_shaders.thickline_shader = new Shader();
- _shaders.thickline_shader->gen(_shader_path+"thickline_shader.shader");
+ _shaders.thickline_shader->gen(_shader_path + "thickline_shader.shader");
_shaders.thickline_shader->unbind();
_shaders.linepattern_shader = new Shader();
- _shaders.linepattern_shader->gen(_shader_path+"dash_pattern_shader.shader");
+ _shaders.linepattern_shader->gen(_shader_path + "dash_pattern_shader.shader");
_shaders.linepattern_shader->unbind();
_shaders.text_shader = new Shader();
- _shaders.text_shader->gen(_shader_path+"text_shader.shader");
+ _shaders.text_shader->gen(_shader_path + "text_shader.shader");
_shaders.text_shader->unbind();
_cacherPtr->setShaderBook(_shaders);
- _fonts.createDefaultFont("ABeeZee-Regular",_font_path+"ABeeZee-Regular.otf");
+ _fonts.createDefaultFont("ABeeZee-Regular", _font_path + "ABeeZee-Regular.otf");
_fonts.createFontsFromDir(_font_path);
_cacherPtr->setFontBook(_fonts);
@@ -52,56 +52,56 @@ void Renderer::createResources()
void Renderer::setCacherRef(Cacher* ch)
{
- _cacherPtr=ch;
+ _cacherPtr = ch;
}
//-------------------------------------------------
-void Renderer::updateProjection(float l,float r,float b,float t)
+void Renderer::updateProjection(float l, float r, float b, float t)
{
- _projB=glm::ortho(-r/2,r/2,b/2,-b/2,-1.0f,1.0f);
- _proj=glm::ortho(l,r,b,t,-1.0f,1.0f);
+ _projB = glm::ortho(-r / 2, r / 2, b / 2, -b / 2, -1.0f, 1.0f);
+ _proj = glm::ortho(l, r, b, t, -1.0f, 1.0f);
- if(_shaders.thickline_shader!=NULL)
+ if (_shaders.thickline_shader != NULL)
{
_shaders.thickline_shader->bind();
- _shaders.thickline_shader->setUniform2f("WIN_SCALE",r,b);
+ _shaders.thickline_shader->setUniform2f("WIN_SCALE", r, b);
_shaders.thickline_shader->unbind();
}
- if(_shaders.linepattern_shader!=NULL)
+ if (_shaders.linepattern_shader != NULL)
{
_shaders.linepattern_shader->bind();
- _shaders.linepattern_shader->setUniform2f("WIN_SCALE",r,b);
+ _shaders.linepattern_shader->setUniform2f("WIN_SCALE", r, b);
_shaders.linepattern_shader->unbind();
}
}
void Renderer::updateView()
{
- _view=_ctm;
+ _view = _ctm;
}
//------------------------
void Renderer::updateScale(float scale_f)
{
- _ctm=glm::scale(_ctm,glm::vec3(scale_f,scale_f,scale_f));
- _view=_ctm;
+ _ctm = glm::scale(_ctm, glm::vec3(scale_f, scale_f, scale_f));
+ _view = _ctm;
}
-void Renderer::updateTranslate(float x,float y)
+void Renderer::updateTranslate(float x, float y)
{
- _ctm=glm::translate(_ctm,glm::vec3(x,y,0.0));
- _view=_ctm;
+ _ctm = glm::translate(_ctm, glm::vec3(x, y, 0.0));
+ _view = _ctm;
}
void Renderer::updateRotate(float angle)
{
- _ctm=glm::rotate(_ctm, angle, glm::vec3(0.0f,0.0f,1.0f) );
- _view=_ctm;
+ _ctm = glm::rotate(_ctm, angle, glm::vec3(0.0f, 0.0f, 1.0f));
+ _view = _ctm;
}
void Renderer::resetTransformations()
{
- _ctm=glm::mat4(1.0f);
- _view=_ctm;
+ _ctm = glm::mat4(1.0f);
+ _view = _ctm;
}
double Renderer::getScale()
@@ -123,40 +123,40 @@ double Renderer::getTranslateY()
void Renderer::deviceToUser(double* x, double* y)
{
- glm::vec4 temp=glm::vec4(*x,*y,0,1);
- temp=glm::inverse(_ctm) * temp;
- *x=temp.x;
- *y=temp.y;
+ glm::vec4 temp = glm::vec4(*x, *y, 0, 1);
+ temp = glm::inverse(_ctm) * temp;
+ *x = temp.x;
+ *y = temp.y;
}
void Renderer::deviceToUserDistance(double* x, double* y)
{
- glm::vec4 temp_vec=glm::vec4(*x,*y,0,1);
- glm::mat4 temp_mat=_ctm;
- temp_mat[3][0]=0;
- temp_mat[3][1]=0;
- temp_vec=glm::inverse( temp_mat ) * temp_vec;
- *x=temp_vec.x;
- *y=temp_vec.y;
+ glm::vec4 temp_vec = glm::vec4(*x, *y, 0, 1);
+ glm::mat4 temp_mat = _ctm;
+ temp_mat[3][0] = 0;
+ temp_mat[3][1] = 0;
+ temp_vec = glm::inverse(temp_mat) * temp_vec;
+ *x = temp_vec.x;
+ *y = temp_vec.y;
}
void Renderer::userToDevice(double* x, double* y)
{
- glm::vec4 temp=glm::vec4(*x,*y,0,1);
- temp=glm::mat4(_ctm) * temp;
- *x=temp.x;
- *y=temp.y;
+ glm::vec4 temp = glm::vec4(*x, *y, 0, 1);
+ temp = glm::mat4(_ctm) * temp;
+ *x = temp.x;
+ *y = temp.y;
}
void Renderer::userToDeviceDistance(double* x, double* y)
{
- glm::vec4 temp_vec=glm::vec4(*x,*y,0,1);
- glm::mat4 temp_mat=_ctm;
- temp_mat[3][0]=0;
- temp_mat[3][1]=0;
- temp_vec=glm::inverse( temp_mat ) * temp_vec;
- *x=temp_vec.x;
- *y=temp_vec.y;
+ glm::vec4 temp_vec = glm::vec4(*x, *y, 0, 1);
+ glm::mat4 temp_mat = _ctm;
+ temp_mat[3][0] = 0;
+ temp_mat[3][1] = 0;
+ temp_vec = glm::inverse(temp_mat) * temp_vec;
+ *x = temp_vec.x;
+ *y = temp_vec.y;
}
//------------------------------------------
@@ -173,7 +173,7 @@ void Renderer::restore()
context_att prev_context = _context_stack.top();
this->_ctm = prev_context.ctm;
_context_stack.pop();
- _view=_ctm;
+ _view = _ctm;
}
//----------------------------------------------------
void Renderer::readyCurrentEntity()
@@ -183,28 +183,28 @@ void Renderer::readyCurrentEntity()
getCurrentEntity()->setFont(_fonts, _font_style, _font_type);
}
-void Renderer::selectColor(float R,float G,float B,float A)
+void Renderer::selectColor(float R, float G, float B, float A)
{
_shaders.basic_shader->bind();
- _shaders.basic_shader->setUniform4f("u_Color",R,G,B,A);
+ _shaders.basic_shader->setUniform4f("u_Color", R, G, B, A);
_shaders.basic_shader->unbind();
_shaders.thickline_shader->bind();
- _shaders.thickline_shader->setUniform4f("u_Color",R,G,B,A);
+ _shaders.thickline_shader->setUniform4f("u_Color", R, G, B, A);
_shaders.thickline_shader->unbind();
_shaders.linepattern_shader->bind();
- _shaders.linepattern_shader->setUniform4f("u_Color",R,G,B,A);
+ _shaders.linepattern_shader->setUniform4f("u_Color", R, G, B, A);
_shaders.linepattern_shader->unbind();
_shaders.text_shader->bind();
- _shaders.text_shader->setUniform4f("u_Color",R,G,B,A);
+ _shaders.text_shader->setUniform4f("u_Color", R, G, B, A);
_shaders.text_shader->unbind();
}
GL_Text_Extend Renderer::getTextExtend(const char* text_val)
{
- GL_Text_Extend TE=(_fonts.pickFont(_font_style))->getTextExtend(std::string(text_val),_text_height);
+ GL_Text_Extend TE = (_fonts.pickFont(_font_style))->getTextExtend(std::string(text_val), _text_height);
return TE;
}
@@ -213,7 +213,7 @@ void Renderer::render()
//load data to current entity
readyCurrentEntity();
// Send the _proj & _view matrix needed to draw
- getCurrentEntity()->draw(_proj,_projB,_view);
+ getCurrentEntity()->draw(_proj, _projB, _view);
//Free the GPU memory
getCurrentEntity()->freeGPU();
//Clear data in buffer(CPU)
@@ -227,18 +227,18 @@ void Renderer::renderCachedEntity(GL_Entity* cached_entity)
{
getCurrentEntity()->unbind();
save();
- cached_entity->draw(_proj,_projB,_view);
+ cached_entity->draw(_proj, _projB, _view);
restore();
}
void Renderer::renderCachedPack(GL_Pack* pack)
{
- int l=pack->packSize();
+ int l = pack->packSize();
GL_Entity* gl_entity_in_pack;
- for(int i=0; igetEntityAt(i);
+ gl_entity_in_pack = pack->getEntityAt(i);
renderCachedEntity(gl_entity_in_pack);
}
}
diff --git a/lcviewernoqt/painters/opengl/resources/res.cpp.in b/lcviewernoqt/painters/opengl/resources/res.cpp.in
deleted file mode 100644
index 490d17aa7..000000000
--- a/lcviewernoqt/painters/opengl/resources/res.cpp.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "res.h"
-
-namespace lc
-{
- namespace viewer
- {
- namespace opengl
- {
- const char* SHADER_PATH = "${SHADER_PATH}";
- const char* FONT_PATH = "${FONT_PATH}";
- }
-
- }
-
-}
diff --git a/lcviewernoqt/painters/opengl/resources/res.h b/lcviewernoqt/painters/opengl/resources/res.h
index 870382dc0..3972baae0 100644
--- a/lcviewernoqt/painters/opengl/resources/res.h
+++ b/lcviewernoqt/painters/opengl/resources/res.h
@@ -1,15 +1,13 @@
#ifndef RES_H
#define RES_H
-
-
namespace lc
{
namespace viewer
{
namespace opengl
{
-extern const char* SHADER_PATH; // the absolute path of Shader folder of OpenGL
-extern const char* FONT_PATH; // the absolute path of Font folder of OpenGL
+const char* SHADER_PATH = "DefaultInvalidPath"; // the absolute path of Shader folder of OpenGL
+const char* FONT_PATH = "DefaultInvalidPath"; // the absolute path of Font folder of OpenGL
}
}
diff --git a/lcviewernoqt/viewersettings.cpp b/lcviewernoqt/viewersettings.cpp
index b1da00c41..22018231a 100644
--- a/lcviewernoqt/viewersettings.cpp
+++ b/lcviewernoqt/viewersettings.cpp
@@ -5,9 +5,16 @@ using namespace lc::storage::settings;
auto shaderpath = StringSettingValue(lc::viewer::opengl::SHADER_PATH);
auto fontpath = StringSettingValue(lc::viewer::opengl::FONT_PATH);
+void lc::viewer::setShader(lc::storage::settings::StringSettingValue pathToShaders) {
+ lc::viewer::viewerSettings.set(SETTINGS_GL_SHADER_PATH, pathToShaders);
+}
+
+void lc::viewer::setFont(lc::storage::settings::StringSettingValue pathToFonts) {
+ lc::viewer::viewerSettings.set(SETTINGS_GL_FONT_PATH, pathToFonts);
+}
+
ModuleSettings lc::viewer::viewerSettings({
{SETTINGS_GL_SHADER_PATH, &shaderpath},
{SETTINGS_GL_FONT_PATH, &fontpath}
-});
-
+ });
diff --git a/lcviewernoqt/viewersettings.h b/lcviewernoqt/viewersettings.h
index ce69d3366..6408fe718 100644
--- a/lcviewernoqt/viewersettings.h
+++ b/lcviewernoqt/viewersettings.h
@@ -5,7 +5,14 @@
#define SETTINGS_GL_FONT_PATH "fontpath"
namespace lc {
-namespace viewer {
-extern lc::storage::settings::ModuleSettings viewerSettings;
+ namespace viewer {
+ extern lc::storage::settings::ModuleSettings viewerSettings;
+
+ #ifndef VIEWERSETTINGS_SETTERS
+ #define VIEWERSETTINGS_SETTERS
+ void setShader(lc::storage::settings::StringSettingValue pathToShaders);
+
+ void setFont(lc::storage::settings::StringSettingValue pathToFonts);
+ #endif //VIEWERSETTINGS_SETTERS
+ }
}
-}
\ No newline at end of file
diff --git a/path.lua b/path.lua
new file mode 100644
index 000000000..de52a4da9
--- /dev/null
+++ b/path.lua
@@ -0,0 +1,4 @@
+package.path = package.path .. ';../finalInstallDir/usr/share/librecad/lcUILua/?.lua'
+ui_path='../finalInstallDir/usr/share/librecad/lcUI/ui'
+plugin_path='../finalInstallDir/usr/share/librecad/lcUILua/plugins'
+lua_path='../finalInstallDir/usr/share/librecad/lcUILua'
\ No newline at end of file
diff --git a/scripts/ubuntu-install/createAppImage.sh b/scripts/ubuntu-install/createAppImage.sh
new file mode 100755
index 000000000..7b5057679
--- /dev/null
+++ b/scripts/ubuntu-install/createAppImage.sh
@@ -0,0 +1,20 @@
+
+mkdir build
+cd build
+cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=On
+make -j 4
+
+sudo make install DESTDIR=AppDir
+
+sudo cp ../AppImage/librecad.* AppDir/
+wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
+wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
+
+chmod a+x linuxdeploy-x86_64.AppImage
+chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
+
+sudo cp ../AppImage/librecad.* AppDir/
+sudo cp /usr/local/lib/libdxfrw.so.1 AppDir/usr/lib
+
+
+sudo LD_LIBRARY_PATH=AppDir/usr/lib/x86_64-linux-gnu/:AppDir/usr/lib64:AppDir/usr/lib ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage --executable AppDir/usr/bin/librecad --desktop-file AppDir/librecad.desktop --icon-file AppDir/librecad.svg --plugin qt
\ No newline at end of file
diff --git a/scripts/ubuntu-install/createSnap.sh b/scripts/ubuntu-install/createSnap.sh
new file mode 100755
index 000000000..4f1dcc2fe
--- /dev/null
+++ b/scripts/ubuntu-install/createSnap.sh
@@ -0,0 +1,6 @@
+sudo snap install snapcraft --classic
+
+snap run snapcraft --destructive-mode
+
+sudo snap install librecad_0.0.9_amd64.snap --devmode --dangerous
+
diff --git a/scripts/ubuntu-install/installDependenciesAndBuildRepo.sh b/scripts/ubuntu-install/installDependenciesAndBuildRepo.sh
new file mode 100755
index 000000000..743743acd
--- /dev/null
+++ b/scripts/ubuntu-install/installDependenciesAndBuildRepo.sh
@@ -0,0 +1,33 @@
+sudo apt update
+sudo apt upgrade
+sudo apt install cmake qt5-default qttools5-dev qttools5-dev-tools libqt5opengl5-dev liblua5.2-dev git g++ libcairo2-dev libpango-1.0-0 libpango1.0-dev libboost-dev libboost-log-dev libboost-program-options-dev libqt5svg5-dev libgtest-dev libeigen3-dev libcurl4-gnutls-dev libgtk-3-dev libglew-dev rapidjson-dev libbz2-dev libglfw3-dev libglm-dev
+
+#This is for versions older that 20.04, like ubuntu 18.04
+
+#sudo apt remove --purge --auto-remove cmake
+#sudo apt update && \
+#sudo apt install -y software-properties-common lsb-release && \
+#sudo apt clean all
+#wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
+#sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
+#sudo apt update
+#sudo apt install kitware-archive-keyring
+#sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
+#sudo apt update
+#sudo apt install cmake
+
+cd /usr/src/gtest
+sudo cmake CMakeLists.txt
+sudo make
+
+cd lib #meeded in ubuntu 20.04+
+sudo cp ./*.a /usr/lib
+
+cd
+git clone --branch LibreCAD_3 https://github.com/LibreCAD/libdxfrw
+cd libdxfrw
+mkdir release
+cd release
+cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
+make
+sudo make install
diff --git a/scripts/windows-install/addPathVariables.ps1 b/scripts/windows-install/addPathVariables.ps1
new file mode 100644
index 000000000..9841f7e86
--- /dev/null
+++ b/scripts/windows-install/addPathVariables.ps1
@@ -0,0 +1 @@
+[Environment]::SetEnvironmentVariable('Path', $env:Path + ';${{ env.Qt5_DIR }}\5.15.2\msvc2019_64;${{ github.workspace }}\LibreCAD_3\out\build\x64-Debug\lib;${{ env.Qt5_DIR }}\5.15.2\msvc2019_64\bin', 'User')
\ No newline at end of file
diff --git a/scripts/windows-install/buildLibrecadAndCreatePackage.bat b/scripts/windows-install/buildLibrecadAndCreatePackage.bat
new file mode 100755
index 000000000..e6e0b0231
--- /dev/null
+++ b/scripts/windows-install/buildLibrecadAndCreatePackage.bat
@@ -0,0 +1,18 @@
+cd ${{ github.workspace }}
+
+cmake -S %cd% -B %cd%\out\build\windows-default -DCMAKE_BUILD_TYPE=RelWithDebInfo --install-prefix %cd%\installprefix
+
+cmake -S %cd% -B %cd%\out\build\windows-default -DCMAKE_BUILD_TYPE=RelWithDebInfo --install-prefix %cd%\installprefix
+
+cd out\build\windows-default
+
+cmake --build . --config RelWithDebInfo
+
+cd bin
+
+WinDeployQt librecad.exe
+
+cd ..
+
+cpack -C RelWithDebInfo
+
diff --git a/scripts/windows-install/createConanDirAndInstallDependencies.bat b/scripts/windows-install/createConanDirAndInstallDependencies.bat
new file mode 100755
index 000000000..fcc27c3eb
--- /dev/null
+++ b/scripts/windows-install/createConanDirAndInstallDependencies.bat
@@ -0,0 +1,8 @@
+mkdir conan
+cd conan
+conan install .. -s build_type=RelWithDebInfo --build missing
+if NOT %errorlevel% == "0" (
+conan profile update settings.compiler.version=16 default
+conan install .. -s build_type=RelWithDebInfo --build missing
+)
+cd ..\..
diff --git a/scripts/windows-install/installConan.bat b/scripts/windows-install/installConan.bat
new file mode 100755
index 000000000..10f51f4bc
--- /dev/null
+++ b/scripts/windows-install/installConan.bat
@@ -0,0 +1 @@
+pip install conan
\ No newline at end of file
diff --git a/scripts/windows-install/installVisualStudio.bat b/scripts/windows-install/installVisualStudio.bat
new file mode 100755
index 000000000..3a6a100d2
--- /dev/null
+++ b/scripts/windows-install/installVisualStudio.bat
@@ -0,0 +1 @@
+choco install visualstudio2019community --package-parameters='"--add Microsoft.VisualStudio.Component.VC.CMake.Project Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.Windows10SDK.19041"'
\ No newline at end of file
diff --git a/snapcraft.yaml b/snapcraft.yaml
new file mode 100644
index 000000000..6f5c6f0c3
--- /dev/null
+++ b/snapcraft.yaml
@@ -0,0 +1,70 @@
+name: librecad
+version: '0.0.9'
+grade: stable
+base: core20
+confinement: devmode
+summary: "librecad: is a cad"
+description: |
+ it really is.
+environment:
+ LD_LIBRARY_PATH: $SNAP/usr/local/lib/:$SNAP/usr/lib/x86_64-linux-gnu/:$SNAP/usr/lib64/:$LD_LIBRARY_PATH
+
+apps:
+ librecad:
+ command: usr/bin/librecad
+ extensions:
+ - kde-neon
+parts:
+ librecad:
+ plugin: cmake
+ build-snaps:
+ - kde-frameworks-5-core18-sdk
+ - kde-frameworks-5-core18
+ source: .
+ build-packages:
+ - qttools5-dev
+ - qttools5-dev-tools
+ - libqt5opengl5-dev
+ - liblua5.2-dev
+ - git
+ - g++
+ - libcairo2-dev
+ - libpango-1.0-0
+ - libpango1.0-dev
+ - libboost-dev
+ - libboost-log-dev
+ - libboost-program-options-dev
+ - libqt5svg5-dev
+ - libgtest-dev
+ - libeigen3-dev
+ - libcurl4-gnutls-dev
+ - libgtk-3-dev
+ - libglew-dev
+ - rapidjson-dev
+ - libbz2-dev
+ - libglfw3-dev
+ - libglm-dev
+ - cmake
+ stage-packages:
+ - libboost-dev
+ - libboost-log-dev
+ - libboost-program-options-dev
+ - libglew2.1
+ cmake-parameters:
+ - "-DCMAKE_INSTALL_PREFIX=/usr"
+ - "-DBUILD_SHARED_LIBS=ON"
+ #For 18.04
+ #configflags:
+ # - "-DCMAKE_INSTALL_PREFIX=/usr"
+ # - "-DBUILD_SHARED_LIBS=On"
+ libdxfrw:
+ plugin: cmake
+ source: /home/runner/libdxfrw
+ cmake-parameters:
+ - "-DBUILD_SHARED_LIBS=ON"
+
+
+ #For 18.04
+ #configflags:
+ # - "-DBUILD_SHARED_LIBS=On"
+