设置VS2013以在CUDA项目中构建和运行Cura?

时间:2014-11-20 19:03:29

标签: python c++ linux visual-studio cuda

我正在尝试构建此处https://github.com/Ultimaker/CuraEngine

中的CuraEngine软件

Cura是一个开源3D打印实用程序,用于将3D CAD模型转换为G代码以导出到各种3D打印机。对于一个学校项目,我试图用CUDA加速这个过程。 Cura由GUI“Cura”和生成引擎“CuraEngine”组成,它们分别用Python和C ++编写。

首先,我只是从Git页面下载了源代码,并将源代码添加到了VS中的一个新的CUDA项目中(在我的生命中我无法弄清楚VS Git)。然后我构建了项目并收到以下错误

enter image description here

我将#include <string>添加到settings.cpp并出现以下错误

enter image description here

以下是来自回购的gettime.h逐字的来源。

/** Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License*/
#ifndef GETTIME_H
#define GETTIME_H

#ifdef __WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <stddef.h>
#endif

static inline double getTime()
{
#ifdef __WIN32
    return double(GetTickCount()) / 1000.0;
#else
    struct timeval tv;
    gettimeofday(&tv, nullptr);
    return double(tv.tv_sec) + double(tv.tv_usec) / 1000000.0;
#endif
}

class TimeKeeper
{
private:
    double startTime;
public:
    TimeKeeper();

    double restart();
};

#endif//GETTIME_H

现在经过一些研究后,似乎sys/time.h是一个linux文件,因此windows没有它。我找到this question引导我this answer,对我有意义,我从答案中复制了一些代码并提出(保持TimeKeeper类不变)

/**Copyright (C) 2013 David Braam -Released under terms of the AGPLv3 License*/
#ifndef GETTIME_H
#define GETTIME_H

#ifdef __WIN32
#include <windows.h>
#else
//#include <sys/time.h>
//#include "stdafx.h"
//#include <time.h>
#include <windows.h> 

#include <stddef.h>
#endif

const __int64 DELTA_EPOCH_IN_MICROSECS = 11644473600000000;

static inline double getTime()
{
#ifdef __WIN32
    return double(GetTickCount()) / 1000.0;
#else
    struct timeval tv;
    //gettimeofday(&tv, nullptr);

    // -- NeoCoder: https://stackoverflow.com/a/5197874/2985796
    FILETIME ft;
    __int64 tmpres = 0;
    int rez = 0;

    ZeroMemory(&ft, sizeof(ft));

    GetSystemTimeAsFileTime(&ft);

    tmpres = ft.dwHighDateTime;
    tmpres <<= 32;
    tmpres |= ft.dwLowDateTime;

    //converting file time to unix epoch
    tmpres /= 10;  //convert into microseconds
    tmpres -= DELTA_EPOCH_IN_MICROSECS;
    tv.tv_sec = (__int32)(tmpres*0.000001);
    tv.tv_usec = (tmpres % 1000000);
    // --

    return double(tv.tv_sec) + double(tv.tv_usec) / 1000000.0;
#endif
} 

现在这个问题以及我现在迷失的地方是windows.h包含在gettime.h FILETIME ZeroMemoryGetSystemTimeAsFile时和timeval)产生了几百个错误http://imgur.com/vGbb0i2。我不知道为什么,问题是什么,或者如何进一步追求它。

此外,如果您按照最初指向此代码的问题,还有一些其他人试图编写一些代码来填充windows.h结构,但所有人都使用{{1}}来获取它完成了。

无论如何要解决这个问题或找出我没有面对的问题?对于返回时间的主要问题,是否有更简单的解决方法?

0 个答案:

没有答案