Skip to content

Switch to cmake part1#2251

Open
peterNordin wants to merge 56 commits into
Hopsan:masterfrom
peterNordin:switch_to_cmake_part1
Open

Switch to cmake part1#2251
peterNordin wants to merge 56 commits into
Hopsan:masterfrom
peterNordin:switch_to_cmake_part1

Conversation

@peterNordin

Copy link
Copy Markdown
Member

This is part one of switch over to CMake, has been in progress for more than three years.
After adding DCP additional work is needed to be able to build release, but i will make a part2

This PR enables me to build all of Hopsan on Linux GCC, Windows MinGW and Windows MSVC 2019.
Including with DCP. But I do not know if it actually works in all these cases. Hopsan at least starts.

Deb build has been migrated to CMake. But flatpak/snap and Windows builds remain.

@peterNordin peterNordin requested a review from robbr48 December 10, 2024 22:58

@robbr48 robbr48 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work except for the DCPLib. It no is no longer compiled and linked since it is header-only. See separate comments in hopsandcp/CMakeLists.txt.

The conflict is just because I fixed the same typo, so it is very easy to fix.

Comment thread hopsandcp/CMakeLists.txt
Comment thread hopsandcp/CMakeLists.txt Outdated
Comment thread hopsandcp/CMakeLists.txt Outdated
Comment thread hopsandcp/CMakeLists.txt
@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch 2 times, most recently from e9fa0de to a54ee01 Compare August 12, 2025 21:09
@robbr48

robbr48 commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

There is something wrong with fmi4c, I get the following error:

[cmake] CMake Error in componentLibraries/defaultLibrary/CMakeLists.txt:
[cmake]   Imported target "fmi4c::fmi4c" includes non-existent path
[cmake] 
[cmake]     "/minizip"

@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch from bf5b415 to 1556ca9 Compare December 16, 2025 21:31
@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch 2 times, most recently from 7d3ea5e to 2a0a799 Compare March 19, 2026 19:47
@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch 5 times, most recently from 9126a74 to 0acd1ed Compare March 24, 2026 19:17
@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch from 0acd1ed to 9e5ca6d Compare March 27, 2026 21:51
@peterNordin peterNordin requested a review from robbr48 March 27, 2026 21:52
@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch 2 times, most recently from 7018bd9 to 56166eb Compare May 11, 2026 20:34
@robbr48

robbr48 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

@peterNordin I would want to make a release before summer. Is this ready to be merged?

@robbr48 robbr48 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works on Ubuntu. On Windows it compiles, but when I try to run from within Qt Creator it loops for the executables in the wrong folder. I was able to run Hopsan outside of Qt, but for some reason all default components failed to load.

@peterNordin peterNordin force-pushed the switch_to_cmake_part1 branch from 56166eb to a7bc403 Compare June 18, 2026 19:43
@peterNordin

peterNordin commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

@robbr48 It did seem to work last time a was working on it, I tried it on linux and windows mingw / msvc, But I cant be sure that it works in all cases. Release package builds also need to be verified and tested. They looked fine, but its hard to know for sure, I cant test all functions. I just dont have time.

But I will at least compare the contents of the new installer packages with the latest release to make sure that all files are included.

Your problem with running in QtCreator, which compiler. Mingw or MSVC build?

Anyway I rebased it on your latest release, and now everything is broken again. Mostly due to ssp4c build and config needing the same changes as the other dependencies, but it takes a while to work through. And ofcourse CI systems have changed the images again which causes additional problems....

I am trying to make it build for the flathub kde runtime update. After that we can (must) merge this branch.
It kind of builds now, but seem to be very broken on Windows due to zlib lookup, but I think its the same problem as the other dependencies had. I just have to remember how to fix it.

Snap will be updated later in part2

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.

2 participants