Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross platform builds and tests (MSBuild +VS, CMake+VS, Ninja+ zig c++ (Windows & Linux), GCC (Linux) #74

Conversation

JamesParrott
Copy link
Collaborator

@JamesParrott JamesParrott commented Jun 17, 2024

Cross platform

  • The MuParser .cpp files are as they are in the original MuParser repo (without #include stdafx.h).
  • They are dynamically prefixed with #include stdafx.h\n within a custom prebuild step
    within the .vcxproj.
  • The installer from (installerbits\advanced\sdna.aip using Cahyon's AdvancedInstaller) contains both Win32 and x64 .dlls
  • zig c++ on Windows (repackaged Clang) does not support Win32, so can only be used to
    produce an x64 output installation.
  • All an installer needs to be for Zig/Windows and Linux is a zip file of the output directory.
  • Compilation is achieved 5 different ways, but run time errors will be encountered on 3 of these builds.
  • The tests can run on all of them (uncomment the job in the workflow) but currently are only passed by the 2 Visual Studio builds (CMake and MSBuild).
  • Work needs to be done to dynamically link to the Geos DLLs and .so (and to provide the latter) on both
    the Zig for Windows build (entirely optional) and the Linux builds.

Fix:
/sdna_plus/sDNA/sdna_vs2008/edge.h:266:31: error: extra qualification on member 'traversal_events_begin'
  266 |         TraversalEventIterator Edge::traversal_events_begin() const;
      |                                ~~~~~~^
Fix /sdna_plus/sDNA/sdna_vs2008/edge.h:345:38: error: extra qualification on member 'get_linked_links'
  345 |         vector<SDNAPolyline*> SDNAPolyline::get_linked_links();
      |                               ~~~~~~~~~~~~~~^
/repos/sdna_plus/sDNA/sdna_vs2008/net.h:135:7: error: extra qualification on member 'Net'
  135 |         Net::Net();
      |         ~~~~~^
Try to fix:

/sdna_plus/sDNA/sdna_vs2008/tables.h:91:23: error: non-const lvalue reference to type 'vector<vector<float>>' cannot bind to a temporary of type 'vector<vector<float>> *'
   91 |                 index2_to_data.swap(new vector<vector<float>>(size,vector<float>(size,default_table_value)));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/PROGRA~2/Zig/ZIG-WI~1.0/lib/libcxx/include/vector:716:72: note: passing argument to parameter here
  716 |   _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(vector&)
…tor.swap(vector<s to vector.assign()s and .clear()s

Fix a myriad of:
 /sdna_plus/sDNA/sdna_vs2008/calculationbase.h:112:8: error: missing 'typename' prior to dependent type name 'vector<T>::iterator'
  112 |                 for (vector<T>::iterator it=v.begin();it!=v.end();it++)
      |                      ^~~~~~~~~~~~~~~~~~~
      |                      typename
… something into a reusable method (set_metadata)
Update tests to ignore tiny floating point diffrences
Create prepend_with_include_stdafx.h.py

Remove #include stdafx.hs to let the script do its job

Run script in Cmake build. Run worflows on this branch.  Drop cmd line arg glob.

Run Script from .vcxproj, and in CMake only on MSVC and if NO_PRECOMPILED_HEADERis not set

Revert "Run Script from .vcxproj, and in CMake only on MSVC and if NO_PRECOMPILED_HEADERis not set"

This reverts commit 03eec34.

Rename Batch file

Correct step name (Zig workflow uses ninja)

Correct Yaml syntax

Optionally pull in zigcross CMake tool chain file

Update version_generated.h.creator.py

Try to stop Visual Studio or MS Proj skipping the pre-build step

Set <PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>

Run MuParser adjuster script from .vcxproj

Don't preppend twice & ever preppend from CMake (it doesn't need it, it force includes PCH)

Update preppend_muparser_cpps_with_include_stdafx.h.py

Copy in changes from Zig branch

Revamp main batch file to make installers via Zig too

Fix syntax hopefully

Use %GENERATOR%

Support spaces in the default args test

Fix .bat files

Don't setlocal

Give platform to CMake config step

Remove trailing space in .bat file

Embellish error message

Can't build for Win32 with Ninja so can't make installer.  Use dedicated .bat files.

Remove trailing command connector

Set build dirs manually

Download built output installed tree to output

Make changes to download step to zig workflow

Try Ninja Multi-Config again

If not on MSVC generator, set Bin_sub_dir to x64/

Resolve repo dir in test script, to help zig test workflow find installation python files

Add new workflow to investigate tests on Zig build

Make pytest import lazy

Print batch files being tested.

Organise search for sdna bin directory

Output error path if Geos DLL not found

Ensures shapefile names end in geodesics etc., as in correctout_geom.txt

Update build_output.bat

fix bat files

Update go.bat

Update create_installer_with_Visual_Studio_17_2022.bat

Copy in sDNA_plus source code from main.

Define sDNAGeometryCollection::set_metadata and use it in its class's constructor.

Use .set_metadata instead of assignment

Use set_pre_and_post & and add_extra class functions. Plus lots of consts

Specify some typenames and const char *s

Add typenames and correct OMPTHREAD logic

Remove assertion error in Dijkstra re: priority queue behaviour change after C++99

More consts, a few swaps to assigns, and a typename

Add in operator=

Make address_in_this_module an instance variable

Mark arg as const

Lots of consts and .swaps to .assigns

Add consts to prepare operations

A few consts, make a few references more specific, replace a .swap with .clear

Revert "More consts, a few swaps to assigns, and a typename"

This reverts commit f966e5e.

Mark args as const

Update build_installer_using_cmake_and_test.yml

Mainly adds consts, and swaps a few .swaps with .assigns and .clears

Sig from sDNA Calculation Factory is required, with const char * config

Test in CI with Installer.

Update create_installer_with_Visual_Studio_17_2022.bat

Change .swaps to .assigns

Replace vector.swaps with .assigns, and add a typename

Make address_in_this_module  an instance variable, not a const class one

Make instance variable a class constant again

Run MSBuild and Zig workflows on this branch

Try just a 0 literal for address_in_this_module

Don't take ref of const

Try different dll loading strategy

Convert "geos_c.dll" to wide char str

Try getting dll module handle by its name

Revert to compileable version on MSVC

Update geos_sdna_wrapper.h

Copy in changes from GCC_Linux

Run VS workflows on this branch

Set VCPKG_ROOT to VCPKG_INSTALLATION_ROOT

Use VCPKG_INSTALLATION_ROOT if VCPKG_ROOT not available

Update CMakeLists.txt

Use IF(NOT DEFINED not IF(NOT

Print message

Set env variable with cmake -E env

Update compile_so_with_gcc.yml

Find VCPKG_ROOT or VCPKG_INSTALLATION_ROOT in CMake code

Remove message.  Install Ninja with apt-get

Try zig workflow without action  Define geos_dll_path_w on Linux

Install Ninja in zig workflow

Make geos .so path a const char * and give HybridMetricEvaluator= a nominal ret val.

CMake doesn't need MSBuild

Switch nominal ret val of HybridMetricEvaluator::operator=

Fix typo

Put command continuator on correct line in Cmake .bat file

Give Zig workflow compile step the dir with the build system

Update compile_so_with_zig.yml

Update build_installer_using_cmake_and_test.yml

Correct indentation

Rename workflows.

Rename steps.  Run Ubuntu Zig workflow on Ubuntu

Quote job names correctly

Remove trailing whitespace

Put CLI args at same indent level

Update build_installer_using_cmake_and_test.yml

Adjust dir to vcpkg dir to run bootstrap-vcpkg.bat

Fix path to .bat file

Correct spelling of bootstrap file

Specify env var paths relative to CMake source tree

Use workflow from ab63233

Revert "Use workflow from ab63233"

This reverts commit 10da4d6.

Run command manually in Bash

Use cmake_path(SET instead of set(

Try Zig Windows workflow

Test job doesn't need installer file name, as there is no installer.

Try testing jobs on the Linux workflows (they have not got Geos yet so some shall not pass)

Set Shell to bash on Linux workflows using the shell input of the test Action

Add compile definitions on Windows, even if not using MSVC.

Use posix style paths in test action, and specify sdna .so on Linux workflows

Switch address_in_module in instance var on Zig c++ on Windows

Use absolute dir to specify sdnadll

In the Linux, and Zig C++ Windows workflows, only compile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant