Skip to content

Commit

Permalink
Some changes to enable building with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
sebjameswml committed Sep 5, 2024
1 parent 07e48bd commit ae39afc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
16 changes: 16 additions & 0 deletions README.build.compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ clang. Entries in the table for clang on Mac and Linux are to follow.
| Fedora 40 | gcc | 14 | Yes* |

*Well, probably/hopefully/presumably :)

## Building with clang on Linux

Install clang (which on Ubuntu provides clang++) and a suitable version of libstdc++.

On Ubuntu 24, I used `clang-18` and `libstdc++-14-dev` together.

You then call cmake with

```bash
mkdir build_clang
cd build_clang
CC=clang CXX=clang++ cmake ..
make
```
(You probably don't need CC=clang)
10 changes: 5 additions & 5 deletions morph/qt/viswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace morph {
v.render();
}

void mousePressEvent (QMouseEvent* event)
void mousePressEvent (QMouseEvent* event) override
{
v.set_cursorpos (event->x(), event->y());
int bflg = event->button();
Expand All @@ -107,15 +107,15 @@ namespace morph {
event->accept();
}

void mouseMoveEvent (QMouseEvent* event)
void mouseMoveEvent (QMouseEvent* event) override
{
if (v.cursor_position_callback (event->x(), event->y())) {
this->update();
}
event->accept();
}

void mouseReleaseEvent (QMouseEvent* event)
void mouseReleaseEvent (QMouseEvent* event) override
{
v.set_cursorpos (event->x(), event->y());
int bflg = event->button();
Expand All @@ -126,7 +126,7 @@ namespace morph {
event->accept();
}

void wheelEvent (QWheelEvent* event)
void wheelEvent (QWheelEvent* event) override
{
QPoint numSteps = event->angleDelta() / 120;
v.scroll_callback (numSteps.x(), numSteps.y());
Expand All @@ -135,7 +135,7 @@ namespace morph {
}

// Keyboard events...
void keyPressEvent (QKeyEvent* event)
void keyPressEvent (QKeyEvent* event) override
{
int mflg = event->modifiers();
int mods = 0;
Expand Down

0 comments on commit ae39afc

Please sign in to comment.