Skip to content

Commit

Permalink
try to get it to build on arch linux
Browse files Browse the repository at this point in the history
linux compiles and runs
  • Loading branch information
Joris Goosen authored and JorisGoosen committed Jan 16, 2025
1 parent 2fda389 commit 07df33c
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 113 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if (UNIX)
add_compile_options(-Werror=return-type)
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(APPLE)

Expand Down
9 changes: 4 additions & 5 deletions Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ message(STATUS "appinfo.cpp is successfully generated...")
file(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/*.h")
file(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp")

add_library(Common ${SOURCE_FILES} ${HEADER_FILES})
add_library(Common SHARED ${SOURCE_FILES} ${HEADER_FILES})

if(LINUX)
target_link_libraries(Common PUBLIC ${_LIB_RT})
Expand All @@ -34,17 +34,16 @@ target_include_directories(

target_link_libraries(
Common
PUBLIC
PRIVATE
Boost::system
Boost::date_time
Boost::timer
Boost::chrono
$<$<BOOL:${WINDOWS}>:ntdll>
$<$<BOOL:${JASP_USES_QT_HERE}>:Qt::Core>
$<$<BOOL:${WINDOWS}>:ntdll>
)

target_compile_definitions(
Common PUBLIC $<$<BOOL:${JASP_USES_QT_HERE}>:JASP_USES_QT_HERE>
Common PUBLIC
$<$<BOOL:${JASP_TIMER_USED}>:PROFILE_JASP>
JSONCPP_NO_LOCALE_SUPPORT )

Expand Down
2 changes: 1 addition & 1 deletion Common/jaspColumnEncoder
12 changes: 6 additions & 6 deletions Common/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class Log
static void redirectStdOut();
static const char * getTimestamp();

static logType _default;
static logType _where;
static std::string _logFilePath;
static logError _logError;
static int _stdoutfd,
_engineNo;
static logType _default;
static logType _where;
static std::string _logFilePath;
static logError _logError;
static int _stdoutfd,
_engineNo;
static std::ostream* _nullStream;
static std::ofstream _logFile;

Expand Down
18 changes: 8 additions & 10 deletions CommonData/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ file(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/*.h")
file(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp")
file(GLOB_RECURSE SQL_FILES "${CMAKE_CURRENT_LIST_DIR}/*.sql")

add_library(CommonData ${SOURCE_FILES} ${HEADER_FILES} ${SQL_FILES})
add_library(CommonData SHARED ${SOURCE_FILES} ${HEADER_FILES} ${SQL_FILES})


if(LINUX)
Expand All @@ -36,18 +36,16 @@ target_include_directories(
)

target_link_libraries(
CommonData
PUBLIC
Common
LibArchive::LibArchive
$<$<BOOL:${JASP_USES_QT_HERE}>:Qt::Core>

PRIVATE
SQLite::SQLite3
CommonData
PUBLIC
LibArchive::LibArchive #desktop needs to be able to access it
PRIVATE
Common
SQLite::SQLite3
)

target_compile_definitions(
CommonData PUBLIC $<$<BOOL:${JASP_USES_QT_HERE}>:JASP_USES_QT_HERE>
CommonData PUBLIC
$<$<BOOL:${JASP_TIMER_USED}>:PROFILE_JASP>
JSONCPP_NO_LOCALE_SUPPORT )

Expand Down
19 changes: 10 additions & 9 deletions CommonData/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "dataset.h"
#include "columnutils.h"
#include "databaseinterface.h"
#include <cassert>

bool Column::_autoSortByValuesByDefault = true;

Expand Down Expand Up @@ -435,7 +436,7 @@ stringset Column::mergeOldMissingDataMap(const Json::Value &missingData)
stringset foundEmpty;

std::map<std::string, Label*> displayToLabel; //Keep track of which labels we added because only those could possibly be derived from missingDataMap
for(qsizetype r=0; r<_ints.size(); r++)
for(size_t r=0; r<_ints.size(); r++)
{
const std::string row = std::to_string(r);
if(missingData.isMember(row))
Expand Down Expand Up @@ -940,7 +941,7 @@ int Column::labelsTempCount()
_labelsTemp . push_back(doubleLabel);
_labelsTempDbls . push_back(dbl);
_labelsTempToIndex[doubleLabel] = _labelsTemp.size()-1;
_labelsTempMaxWidth = std::max(_labelsTempMaxWidth, qsizetype(_labelsTemp[_labelsTemp.size()-1].size()));
_labelsTempMaxWidth = std::max(_labelsTempMaxWidth, size_t(_labelsTemp[_labelsTemp.size()-1].size()));
_labelsTempNumerics ++;
}
}
Expand Down Expand Up @@ -1777,15 +1778,15 @@ bool Column::labelsRemoveOrphans()
return idsNotUsed.size();
}

std::set<size_t> Column::labelsMoveRows(std::vector<qsizetype> rows, bool up)
std::set<size_t> Column::labelsMoveRows(std::vector<size_t> rows, bool up)
{
JASPTIMER_SCOPE(Column::labelsMoveRows);

int mod = up ? -1 : 1;

std::sort(rows.begin(), rows.end(), [&](const auto & l, const auto & r) { return up ? l < r : r < l; });

replaceDoublesTillLabelsRowWithLabels(std::min(qsizetype(labelsTempCount()), rows.back() + 1));
replaceDoublesTillLabelsRowWithLabels(std::min(size_t(labelsTempCount()), rows.back() + 1));

std::vector<Label*> new_labels(_labels.begin(), _labels.end());

Expand Down Expand Up @@ -2020,7 +2021,7 @@ void Column::upgradeExtractDoublesIntsFromLabels()
{
_dbls.resize(_ints.size());

for(qsizetype r=0; r<_dbls.size(); r++)
for(size_t r=0; r<_dbls.size(); r++)
{
Label * label = labelByIntsId(_ints[r]);

Expand Down Expand Up @@ -2318,7 +2319,7 @@ bool Column::isEmptyValue(const double val) const
return _emptyValues->isEmptyValue(val);
}

qsizetype Column::getMaximumWidthInCharactersIncludingShadow()
size_t Column::getMaximumWidthInCharactersIncludingShadow()
{
bool thereIsAShadow = false;

Expand All @@ -2337,9 +2338,9 @@ qsizetype Column::getMaximumWidthInCharactersIncludingShadow()
}


qsizetype Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesPlease, qsizetype extraPad)
size_t Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesPlease, size_t extraPad)
{
qsizetype maxWidth = 0;
size_t maxWidth = 0;
std::string takeWidth;

//Call labelsTempCount() to both find out how many there are and generate them if necessary
Expand All @@ -2349,7 +2350,7 @@ qsizetype Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesP
for(Label * label : labels())
{
takeWidth = !valuesPlease ? label->label() : label->originalValueAsString(fancyEmptyValue);
maxWidth = std::max(maxWidth, qsizetype(stringUtils::approximateVisualLength(takeWidth)));
maxWidth = std::max(maxWidth, size_t(stringUtils::approximateVisualLength(takeWidth)));
}


Expand Down
10 changes: 5 additions & 5 deletions CommonData/column.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "utils.h"
#include <list>
#include "emptyvalues.h"

#include <cmath>
class DataSet;
class Analysis;

Expand Down Expand Up @@ -133,7 +133,7 @@ class Column : public DataSetBaseNode
stringvec nonFilteredLevels();
void nonFilteredCountersReset();

std::set<size_t> labelsMoveRows(std::vector<qsizetype> rows, bool up);
std::set<size_t> labelsMoveRows(std::vector<size_t> rows, bool up);
void labelsReverse();
void valuesReverse();
void labelsOrderByValue(bool doDbUpdateEtc=true);
Expand Down Expand Up @@ -226,8 +226,8 @@ class Column : public DataSetBaseNode
bool isEmptyValue( const std::string & val) const;
bool isEmptyValue( const double val) const;

qsizetype getMaximumWidthInCharactersIncludingShadow();
qsizetype getMaximumWidthInCharacters(bool shortenAndFancyEmptyValue, bool valuesPlease, qsizetype extraPad = 4); ///< Tries to take into consideration that utf-8 can have more characters than codepoints and compensates for it
size_t getMaximumWidthInCharactersIncludingShadow();
size_t getMaximumWidthInCharacters(bool shortenAndFancyEmptyValue, bool valuesPlease, size_t extraPad = 4); ///< Tries to take into consideration that utf-8 can have more characters than codepoints and compensates for it
columnType resetValues(int thresholdScale); ///< "Reimport" the values it already has with a possibly different threshold of values
stringset mergeOldMissingDataMap(const Json::Value & missingData); ///< <0.19 JASP collected the removed empty values values in a map in a json object... We need to be able to read at least 0.18.3 so here this function that absorbs such a map and adds any required labels. It does not add the empty values itself though!

Expand Down Expand Up @@ -258,7 +258,7 @@ class Column : public DataSetBaseNode
_labelsTempRevision = -1, ///< When were the "temporary labels" created?
_labelsTempNumerics = 0, ///< Use the labelsTemp step to calculate the amount of numeric labels
_highestIntsId = -1;
qsizetype _labelsTempMaxWidth = 0;
size_t _labelsTempMaxWidth = 0;
stringvec _labelsTemp; ///< Contains displaystring for labels. Used to allow people to edit "double" labels. Initialized when necessary
doublevec _labelsTempDbls;
strintmap _labelsTempToIndex;
Expand Down
3 changes: 0 additions & 3 deletions CommonData/columnutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
#define COLUMNUTILS_H

#include <string>
#include <vector>
#include <set>
#include <map>
#include "utils.h"

class ColumnUtils
Expand Down
3 changes: 2 additions & 1 deletion CommonData/databaseinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include "utils.h"
#include <json/json.h>
#include "version.h"

#include <functional>
#include <cassert>

class DataSet;
class Column;
Expand Down
2 changes: 1 addition & 1 deletion CommonData/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Column * DataSet::newColumn(const std::string &name)
return col;
}

qsizetype DataSet::getMaximumColumnWidthInCharacters(size_t columnIndex) const
size_t DataSet::getMaximumColumnWidthInCharacters(size_t columnIndex) const
{
if(columnIndex >= columnCount())
return 0;
Expand Down
2 changes: 1 addition & 1 deletion CommonData/dataset.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DataSet : public DataSetBaseNode

bool allColumnsPassFilter() const;

qsizetype getMaximumColumnWidthInCharacters(size_t columnIndex) const;
size_t getMaximumColumnWidthInCharacters(size_t columnIndex) const;
stringvec getColumnNames();

void setDataFile( const std::string & dataFilePath, long timestamp) { _dataFilePath = dataFilePath; _dataFileTimestamp = timestamp; dbUpdate(); }
Expand Down
1 change: 1 addition & 0 deletions CommonData/datasetbasenode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DATASETBASENODE_H

#include "enumutilities.h"
#include <functional>

DECLARE_ENUM(dataSetBaseNodeType, unknown, dataSet, data, filters, filter, column, label);

Expand Down
11 changes: 6 additions & 5 deletions Desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ target_include_directories(
PUBLIC
${CMAKE_CURRENT_LIST_DIR}
${PROJECT_SOURCE_DIR}/Common
${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder
${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder
${PROJECT_SOURCE_DIR}/CommonData
${PROJECT_SOURCE_DIR}/QMLComponents
# ReadStat
Expand All @@ -110,7 +110,8 @@ target_include_directories(

target_link_libraries(
JASP
PUBLIC
PRIVATE
Common
CommonData
QMLComponents
Qt::Core
Expand Down Expand Up @@ -164,9 +165,9 @@ if(NOT WINDOWS)

target_link_libraries(
JASP
PUBLIC
# When using Conan, we need to provide the static libraries directly, for some reason!
${Iconv_LIBRARY_LIST})
PRIVATE
# When using Conan, we need to provide the static libraries directly, for some reason!
${Iconv_LIBRARY_LIST})
endif()

if(LINUX)
Expand Down
20 changes: 10 additions & 10 deletions Desktop/data/columnmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,16 @@ void ColumnModel::setColumnType(QString type)
_undoStack->pushCommand(new SetColumnTypeCommand(this, {chosenColumn()}, int(cType)));
}

std::vector<qsizetype> ColumnModel::getSortedSelection() const
std::vector<size_t> ColumnModel::getSortedSelection() const
{
if (_virtual) return {};

std::map<QString, qsizetype> mapValueToRow;
std::map<QString, size_t> mapValueToRow;

for(qsizetype r=0; r<qsizetype(rowCount()); r++)
for(size_t r=0; r<size_t(rowCount()); r++)
mapValueToRow[data(index(r, 0), int(DataSetPackage::specialRoles::value)).toString()] = r;

std::vector<qsizetype> out;
std::vector<size_t> out;

for(const QString & v : _selected)
out.push_back(mapValueToRow[v]);
Expand All @@ -357,7 +357,7 @@ std::vector<qsizetype> ColumnModel::getSortedSelection() const

void ColumnModel::setValueMaxWidth()
{
qsizetype maxWidthChars = std::max((tr("Value").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, true));
size_t maxWidthChars = std::max(size_t(tr("Value").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, true));

double prevMaxWidth = _valueMaxWidth;
_valueMaxWidth = JaspTheme::fontMetrics().size(Qt::TextSingleLine, QString(maxWidthChars, 'X')).width();
Expand All @@ -368,7 +368,7 @@ void ColumnModel::setValueMaxWidth()

void ColumnModel::setLabelMaxWidth()
{
qsizetype maxWidthChars = std::max((tr("Label").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, false));
size_t maxWidthChars = std::max(size_t(tr("Label").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, false));

double prevMaxWidth = _labelMaxWidth;
_labelMaxWidth = JaspTheme::fontMetrics().size(Qt::TextSingleLine, QString(maxWidthChars, 'X')).width();
Expand All @@ -379,7 +379,7 @@ void ColumnModel::setLabelMaxWidth()

void ColumnModel::moveSelectionUp()
{
std::vector<qsizetype> indexes = getSortedSelection();
std::vector<size_t> indexes = getSortedSelection();
if (_beingRefreshed || indexes.size() < 1)
return;

Expand All @@ -389,7 +389,7 @@ void ColumnModel::moveSelectionUp()

void ColumnModel::moveSelectionDown()
{
std::vector<qsizetype> indexes = getSortedSelection();
std::vector<size_t> indexes = getSortedSelection();
if (_beingRefreshed || indexes.size() < 1)
return;

Expand Down Expand Up @@ -672,9 +672,9 @@ void ColumnModel::checkCurrentColumn(QStringList, QStringList missingColumns, QM

void ColumnModel::removeAllSelected()
{
QMap<QString, qsizetype> mapValueToRow;
QMap<QString, size_t> mapValueToRow;

for(qsizetype r=0; r<qsizetype(rowCount()); r++)
for(size_t r=0; r<size_t(rowCount()); r++)
mapValueToRow[data(index(r, 0), int(DataSetPackage::specialRoles::value)).toString()] = r;

QVector<QString> selectedValues;
Expand Down
4 changes: 2 additions & 2 deletions Desktop/data/columnmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ColumnModel : public DataSetTableProxy
static QString columnTypeFriendlyName( computedColumnType compColT);
static QVariant columnTypeFriendlyMapping( computedColumnType compColT);

bool labelNeedsFilter(qsizetype col);
bool labelNeedsFilter(size_t col);
QString columnNameQ();
QString columnTitle() const;
QString columnDescription() const;
Expand Down Expand Up @@ -161,7 +161,7 @@ public slots:
void hasSeveralNumericValuesChanged();

private:
std::vector<qsizetype> getSortedSelection() const;
std::vector<size_t> getSortedSelection() const;
void setValueMaxWidth();
void clearVirtual();

Expand Down
2 changes: 1 addition & 1 deletion Desktop/data/datasetpackage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ bool DataSetPackage::labelNeedsFilter(size_t columnIndex) const
}


void DataSetPackage::labelMoveRows(size_t colIdx, std::vector<qsizetype> rows, bool up)
void DataSetPackage::labelMoveRows(size_t colIdx, std::vector<size_t> rows, bool up)
{
Column * column = _dataSet->columns()[colIdx];
sizetset rowsChanged = column->labelsMoveRows(rows, up);
Expand Down
2 changes: 1 addition & 1 deletion Desktop/data/datasetpackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class DataSetPackage : public QAbstractItemModel //Not QAbstractTableModel becau
void resetFilterAllows( size_t columnIndex);
int filteredOut( size_t columnIndex) const;
bool labelNeedsFilter( size_t columnIndex) const;
void labelMoveRows( size_t columnIndex, std::vector<qsizetype> rows, bool up);
void labelMoveRows( size_t columnIndex, std::vector<size_t> rows, bool up);
void labelReverse( size_t columnIndex);
bool setFilterData(const std::string & filter, const boolvec & filterResult);
void resetAllFilters();
Expand Down
Loading

0 comments on commit 07df33c

Please sign in to comment.