From 261b3c073521dbe1a173f8e662511fedb4af3a15 Mon Sep 17 00:00:00 2001 From: Lukas K Date: Sun, 2 Jul 2023 14:28:27 +0200 Subject: [PATCH] wip --- .github/workflows/all.yml | 2 +- meson.build | 20 +++++++++++++++++--- src/export_pdf/canvas_pdf.hpp | 2 +- src/export_pdf/export_pdf.cpp | 2 +- src/export_pdf/export_pdf_board.cpp | 2 +- src/export_pdf/export_pdf_util.hpp | 2 +- src/imp/pdf_export_window.cpp | 2 +- src/python_module/board.cpp | 2 +- src/python_module/schematic.cpp | 2 +- src/util/podofo_inc.hpp | 5 +++++ 10 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 src/util/podofo_inc.hpp diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 21b0c52b5..d637752a1 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -160,7 +160,7 @@ jobs: run: | mkdir ../build CXX=${{ matrix.os.cxx }} CC=${{ matrix.os.cc }} meson setup ../build - LD_PRELOAD=$PWD/close_range.so ninja -C ../build ${{ matrix.target }} + ninja -C ../build ${{ matrix.target }} - name: Check version run: python3 check_version.py - name: Test python module diff --git a/meson.build b/meson.build index 7e40489e3..571bc9346 100644 --- a/meson.build +++ b/meson.build @@ -27,8 +27,15 @@ if not opencascade.found() opencascade = dependency('OCE', method : 'cmake') endif -# on ubuntu 20.04, the link args are broken and are missing the -l for some reason?? -opencascade = declare_dependency(dependencies: opencascade.partial_dependency(compile_args: true, includes:true), link_args:['-lTKSTEP', '-lTKernel', '-lTKXCAF', '-lTKXSBase', '-lTKBRep', '-lTKCDF', '-lTKXDESTEP', '-lTKLCAF', '-lTKMath', '-lTKMesh', '-lTKTopAlgo', '-lTKPrim', '-lTKBO', '-lTKShHealing', '-lTKBRep', '-lTKG3d', '-lTKGeomBase', '-lTKHLR']) +if not cxx.links('int main(void) {return 0;}', dependencies: opencascade) + message('opencascade link args are broken, replacing') + # on ubuntu 20.04, the link args are broken and are missing the -l for some reason?? + opencascade = declare_dependency(dependencies: opencascade.partial_dependency(compile_args: true, includes:true), link_args:['-lTKSTEP', '-lTKernel', '-lTKXCAF', '-lTKXSBase', '-lTKBRep', '-lTKCDF', '-lTKXDESTEP', '-lTKLCAF', '-lTKMath', '-lTKMesh', '-lTKTopAlgo', '-lTKPrim', '-lTKBO', '-lTKShHealing', '-lTKBRep', '-lTKG3d', '-lTKGeomBase', '-lTKHLR']) +endif + + + + spnav = dependency('spnav', required: false) if not spnav.found() @@ -58,9 +65,16 @@ podofo = declare_dependency ( include_directories: include_directories('/usr/include/podofo-0.9') ) else - podofo = dependency('libpodofo') + podofo = dependency('libpodofo09', required:false) + if podofo.found() + cpp_args += '-DINC_PODOFO_WITHOUT_DIRECTORY' + else + podofo = dependency('libpodofo') + endif endif +#podofo_minor = cxx.get_define('PODOFO_VERSION_MINOR', prefix: '#include "util/podofo_inc.hpp"', include_directories: include_directories('src'), dependencies:podofo) + stdlibs = [] is_libstdcpp = cxx.get_define('__GLIBCXX__', prefix: '#include ') != '' if is_libstdcpp diff --git a/src/export_pdf/canvas_pdf.hpp b/src/export_pdf/canvas_pdf.hpp index 752b1d6b6..ff3013087 100644 --- a/src/export_pdf/canvas_pdf.hpp +++ b/src/export_pdf/canvas_pdf.hpp @@ -1,6 +1,6 @@ #pragma once #include "canvas/canvas.hpp" -#include +#include "util/podofo_inc.hpp" namespace horizon { diff --git a/src/export_pdf/export_pdf.cpp b/src/export_pdf/export_pdf.cpp index 6d7d80dc8..cf8514fac 100644 --- a/src/export_pdf/export_pdf.cpp +++ b/src/export_pdf/export_pdf.cpp @@ -1,6 +1,6 @@ #include "export_pdf.hpp" #include "canvas_pdf.hpp" -#include +#include "util/podofo_inc.hpp" #include "util/util.hpp" #include "schematic/schematic.hpp" #include "export_pdf_util.hpp" diff --git a/src/export_pdf/export_pdf_board.cpp b/src/export_pdf/export_pdf_board.cpp index 7eac98a6f..644104229 100644 --- a/src/export_pdf/export_pdf_board.cpp +++ b/src/export_pdf/export_pdf_board.cpp @@ -1,6 +1,6 @@ #include "export_pdf.hpp" #include "canvas_pdf.hpp" -#include +#include "util/podofo_inc.hpp" #include "util/util.hpp" #include "board/board.hpp" #include "export_pdf_util.hpp" diff --git a/src/export_pdf/export_pdf_util.hpp b/src/export_pdf/export_pdf_util.hpp index f7a87780f..a87580eff 100644 --- a/src/export_pdf/export_pdf_util.hpp +++ b/src/export_pdf/export_pdf_util.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include "util/podofo_inc.hpp" #include "util/placement.hpp" namespace horizon { diff --git a/src/imp/pdf_export_window.cpp b/src/imp/pdf_export_window.cpp index 4fac05874..c03e2d5ac 100644 --- a/src/imp/pdf_export_window.cpp +++ b/src/imp/pdf_export_window.cpp @@ -8,7 +8,7 @@ #include "util/util.hpp" #include "widgets/spin_button_dim.hpp" #include "common/layer_provider.hpp" -#include +#include "util/podofo_inc.hpp" #include "util/win32_undef.hpp" #include diff --git a/src/python_module/board.cpp b/src/python_module/board.cpp index 05f79c065..34265ceb0 100644 --- a/src/python_module/board.cpp +++ b/src/python_module/board.cpp @@ -9,7 +9,7 @@ #include "image_3d_exporter_wrapper.hpp" #include "document/document_board.hpp" #include "rules/cache.hpp" -#include +#include "util/podofo_inc.hpp" #include "blocks/blocks.hpp" #include "board/board.hpp" #include "project/project.hpp" diff --git a/src/python_module/schematic.cpp b/src/python_module/schematic.cpp index 37263a78f..de61bba9d 100644 --- a/src/python_module/schematic.cpp +++ b/src/python_module/schematic.cpp @@ -6,7 +6,7 @@ #include "export_pdf/export_pdf.hpp" #include "export_bom/export_bom.hpp" #include "util.hpp" -#include +#include "util/podofo_inc.hpp" SchematicWrapper::SchematicWrapper(const horizon::Project &prj) : pool(prj.pool_directory, false), blocks(horizon::BlocksSchematic::new_from_file(prj.blocks_filename, pool)) diff --git a/src/util/podofo_inc.hpp b/src/util/podofo_inc.hpp new file mode 100644 index 000000000..041a5f4ee --- /dev/null +++ b/src/util/podofo_inc.hpp @@ -0,0 +1,5 @@ +#ifdef INC_PODOFO_WITHOUT_DIRECTORY + #include +#else + #include +#endif