Evolve icon indicating copy to clipboard operation
Evolve copied to clipboard

Doesn't build with clang

Open ctrlcctrlv opened this issue 10 years ago • 1 comments

I understand this project is probably abandoned but here's a patch if you want to build it in Clang on OS X

Pretty fun

screen shot 2015-03-18 at 3 47 05 pm

diff --git a/Evolve.pro b/Evolve.pro
index 9ed32f1..b81b409 100644
--- a/Evolve.pro
+++ b/Evolve.pro
@@ -37,5 +37,5 @@ FORMS    += widget.ui \
 CONFIG += c++11

 QMAKE_CXXFLAGS_RELEASE += -O3 -flto -march=native -mmmx # Crashes on some computers
-QMAKE_CXXFLAGS_DEBUG += -Og -g -march=native -mmmx # Crashes on some computers
+QMAKE_CXXFLAGS_DEBUG += -march=native -mmmx # Crashes on some computers
 #QMAKE_CXXFLAGS_DEBUG += -Og
diff --git a/settings.cpp b/settings.cpp
index 6eb53ea..20e2bce 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -1,7 +1,7 @@
 #include "settings.h"

 bool AUTOFOCUS_ENABLED = false;
-int AUTOFOCUS_SUBDIVS = 4, AUTOFOCUS_DELAY=1000;
+int AUTOFOCUS_DELAY=1000;

 int N_POLY_POINTS = 6;
 int N_COLOR_VAR = 5;
@@ -9,7 +9,6 @@ int N_POS_VAR = 15;
 int SHAPE_OPT_FREQ = 0;
 int GUI_REFRESH_RATE = 4;
 int AUTOFOCUS_RES = 2;
-int N_CORES = 4;

 int FOCUS_LEFT=0, FOCUS_RIGHT=100, FOCUS_TOP=0, FOCUS_BOTTOM=100;

diff --git a/settings.h b/settings.h
index 1f48a06..0c40518 100644
--- a/settings.h
+++ b/settings.h
@@ -2,7 +2,8 @@
 #define SETTINGS_H

 extern bool AUTOFOCUS_ENABLED;
-extern int AUTOFOCUS_SUBDIVS, AUTOFOCUS_DELAY;
+const int AUTOFOCUS_SUBDIVS = 4;
+extern int AUTOFOCUS_DELAY;

 extern int N_POLY_POINTS;
 extern int N_COLOR_VAR;
@@ -14,7 +15,7 @@ extern int GUI_REFRESH_RATE;
 extern int AUTOFOCUS_RES;
 extern int FOCUS_LEFT, FOCUS_RIGHT, FOCUS_TOP, FOCUS_BOTTOM;

-extern int N_CORES;
+const int N_CORES = 4;

 extern int POLYS_MIN, POLYS_MAX;

diff --git a/settingswidget.cpp b/settingswidget.cpp
index 83fdafd..aa9d437 100644
--- a/settingswidget.cpp
+++ b/settingswidget.cpp
@@ -64,11 +64,11 @@ void SettingsWidget::okClicked()
     FOCUS_BOTTOM = ui->focusBottom->value();
     SHAPE_OPT_FREQ = ui->shapeOptFreqSpin->value();
     GUI_REFRESH_RATE = ui->guiRefreshSpin->value();
-    N_CORES = ui->coreSpin->value();
+    /*N_CORES = ui->coreSpin->value();*/
     POLYS_MIN = ui->minPolySpin->value();
     POLYS_MAX = ui->maxPolySpin->value();
     AUTOFOCUS_ENABLED = ui->autofocusEnable->isChecked();
-    AUTOFOCUS_SUBDIVS = ui->autofocusSubdivs->value();
+    /*AUTOFOCUS_SUBDIVS = ui->autofocusSubdivs->value();*/
     AUTOFOCUS_DELAY = ui->autofocusDelay->value();
     Widget::setAutofocus(AUTOFOCUS_ENABLED);
     close();
diff --git a/widget.cpp b/widget.cpp
index 1106e4c..c1c6ab3 100644
--- a/widget.cpp
+++ b/widget.cpp
@@ -3,6 +3,7 @@
 #include "settings.h"
 #include "settingswidget.h"
 #include "analysis.h"
+#include <xmmintrin.h>
 #include <QDataStream>
 #include <QString>
 #include <QPixmap>
@@ -164,8 +165,8 @@ quint64 Widget::computeFitness(const QImage& target)
             // Sum of the differences of each pixel's color
             for (unsigned j=0; j+8<BPL; j+=8)
             {
-                __m64 mmOrig = _m_from_int64(*(quint64*)(origData+curLine+j));
-                __m64 mmTarget = _m_from_int64(*(quint64*)(targetData+curLine+j));
+                __m64 mmOrig = _m_from_int(*(quint64*)(origData+curLine+j));
+                __m64 mmTarget = _m_from_int(*(quint64*)(targetData+curLine+j));
                 tmp = _m_psadbw(mmOrig, mmTarget);
                 mmFitness = _mm_add_si64(mmFitness, tmp);
             }

ctrlcctrlv avatar Mar 18 '15 08:03 ctrlcctrlv

Thanks for the patch! I'll try to merge it so that it still builds with GCC/Clang on other platforms.

This project is not quite abandonned, but I'm not actively working on it at the moment, mostly due to lack of time.

tux3 avatar Mar 18 '15 10:03 tux3