Windows compile fix

This commit is contained in:
Alexander Bock
2017-12-28 14:15:06 -05:00
parent 8c7d220335
commit b337c3aa1e
6 changed files with 66 additions and 71 deletions

View File

@@ -22,13 +22,10 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/renderable.h>
#include <openspace/scene/translation.h>
#include <openspace/scene/rotation.h>
#include <openspace/scene/scale.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/util/factorymanager.h>
#include <openspace/util/progressbar.h>
#include <openspace/util/resourcesynchronization.h>
@@ -61,65 +58,35 @@ namespace {
constexpr const char* _loggerCat = "Sync";
}
int main(int, char** argv) {
int main(int argc, char** argv) {
using namespace openspace;
ghoul::initialize();
ghoul::logging::LogManager::initialize(
ghoul::logging::LogLevel::Debug,
ghoul::logging::LogManager::ImmediateFlush::Yes
);
LogMgr.addLog(std::make_unique<ghoul::logging::ConsoleLog>());
LDEBUG("Initialize FileSystem");
ghoul::filesystem::Directory launchDirectory = FileSys.currentDirectory();
#ifdef __APPLE__
ghoul::filesystem::File app(argv[0]);
std::string dirName = app.directoryName();
LINFO("Setting starting directory to '" << dirName << "'");
FileSys.setCurrentDirectory(dirName);
#endif
// ghoul::initialize();
//
// ghoul::logging::LogManager::initialize(
// ghoul::logging::LogLevel::Debug,
// ghoul::logging::LogManager::ImmediateFlush::Yes
// );
// LogMgr.addLog(std::make_unique<ghoul::logging::ConsoleLog>());
//
// LDEBUG("Initialize FileSystem");
//
// ghoul::filesystem::Directory launchDirectory = FileSys.currentDirectory();
//
//#ifdef __APPLE__
// ghoul::filesystem::File app(argv[0]);
// std::string dirName = app.directoryName();
// LINFO("Setting starting directory to '" << dirName << "'");
// FileSys.setCurrentDirectory(dirName);
//#endif
// initTextureReaders();
FactoryManager::initialize();
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<Renderable>>(),
"Renderable"
);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<Task>>(),
"Task"
);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<Translation>>(),
"Translation"
);
std::vector<std::string> unusedStringlist;
bool unusedBool;
OpenSpaceEngine::create(argc, argv, nullptr, unusedStringlist, unusedBool);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<Rotation>>(),
"Rotation"
);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<Scale>>(),
"Scale"
);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<ResourceSynchronization>>(),
"ResourceSynchronization"
);
FactoryManager::ref().addFactory(
std::make_unique<ghoul::TemplateFactory<DashboardItem>>(),
"DashboardItem"
);
openspace::ConfigurationManager configuration;
/*openspace::ConfigurationManager configuration;
std::string configurationFile = configuration.findConfiguration(ConfigurationFile);
configuration.loadFromFile(configurationFile);
@@ -131,11 +98,11 @@ int main(int, char** argv) {
ConfigurationManager::KeyModuleConfigurations,
moduleConfigurations
);
}
}*/
ModuleEngine moduleEngine;
moduleEngine.initialize(moduleConfigurations);
LINFO("Initialization done.");
//ModuleEngine moduleEngine;
//moduleEngine.initialize(moduleConfigurations);
//LINFO("Initialization done.");
TaskLoader taskLoader;
std::vector<std::unique_ptr<Task>> tasks = taskLoader.tasksFromFile(

View File

@@ -81,6 +81,8 @@ public:
static OpenSpaceEngine& ref();
static bool isCreated();
~OpenSpaceEngine();
// callbacks
void initialize();
void initializeGL();

View File

@@ -740,18 +740,21 @@ scripting::LuaLibrary IswaManager::luaLibrary() {
{
"addCygnet",
&luascriptfunctions::iswa_addCygnet,
{},
"int, string, string",
"Adds a IswaCygnet",
},
{
"addScreenSpaceCygnet",
&luascriptfunctions::iswa_addScreenSpaceCygnet,
{},
"int, string, string",
"Adds a Screen Space Cygnets",
},
{
"addKameleonPlanes",
&luascriptfunctions::iswa_addKameleonPlanes,
{},
"string, int",
"Adds KameleonPlanes from cdf file.",
},
@@ -765,30 +768,35 @@ scripting::LuaLibrary IswaManager::luaLibrary() {
{
"addCdfFiles",
&luascriptfunctions::iswa_addCdfFiles,
{},
"string",
"Adds a cdf files to choose from.",
},
{
"removeCygnet",
&luascriptfunctions::iswa_removeCygnet,
{},
"string",
"Remove a Cygnets",
},
{
"removeScreenSpaceCygnet",
&luascriptfunctions::iswa_removeScrenSpaceCygnet,
{},
"int",
"Remove a Screen Space Cygnets",
},
{
"removeGroup",
&luascriptfunctions::iswa_removeGroup,
{},
"int",
"Remove a group of Cygnets",
},
{
"setBaseUrl",
&luascriptfunctions::iswa_setBaseUrl,
{},
"string",
"sets the base url",
}

View File

@@ -24,10 +24,11 @@
#include <modules/sync/tasks/syncassettask.h>
#include <openspace/moduleregistration.h>
#include <openspace/openspace.h>
#include <openspace/documentation/core_registration.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/util/synchronizationwatcher.h>
#include <openspace/scripting/scriptengine.h>
@@ -67,8 +68,8 @@ void SyncAssetTask::perform(const Task::ProgressCallback & progressCallback) {
scripting::ScriptEngine scriptEngine;
registerCoreClasses(scriptEngine);
for (OpenSpaceModule* m : AllModules()) {
;
for (OpenSpaceModule* m : OsEng.moduleEngine().modules()) {
scriptEngine.addLibrary(m->luaLibrary());
for (scripting::LuaLibrary& l : m->luaLibraries()) {

View File

@@ -185,7 +185,9 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
_globalPropertyNamespace->addPropertySubOwner(_navigationHandler.get());
_globalPropertyNamespace->addPropertySubOwner(_settingsEngine.get());
_globalPropertyNamespace->addPropertySubOwner(_renderEngine.get());
_globalPropertyNamespace->addPropertySubOwner(_windowWrapper.get());
if (_windowWrapper) {
_globalPropertyNamespace->addPropertySubOwner(_windowWrapper.get());
}
_globalPropertyNamespace->addPropertySubOwner(_parallelConnection.get());
_globalPropertyNamespace->addPropertySubOwner(_console.get());
_globalPropertyNamespace->addPropertySubOwner(_dashboard.get());
@@ -237,6 +239,8 @@ OpenSpaceEngine& OpenSpaceEngine::ref() {
return *_engine;
}
OpenSpaceEngine::~OpenSpaceEngine() {}
bool OpenSpaceEngine::isCreated() {
return _engine != nullptr;
}
@@ -247,7 +251,7 @@ void OpenSpaceEngine::create(int argc, char** argv,
bool& requestClose, bool consoleLog)
{
ghoul_assert(!_engine, "OpenSpaceEngine was already created");
ghoul_assert(windowWrapper != nullptr, "No Window Wrapper was provided");
//ghoul_assert(windowWrapper != nullptr, "No Window Wrapper was provided");
requestClose = false;

View File

@@ -342,11 +342,24 @@ bool HttpFileDownload::initDownload() {
if (_file.fail()) {
#ifdef WIN32
// GetLastError() gives more details than errno.
if (GetLastError() != 0) {
LERROR(
"Cannot open file " << destinationFile <<
": " << FormatSystemMessage(GetLastError()
DWORD errorId = GetLastError();
if (errorId != 0) {
char Buffer[256];
size_t size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr,
errorId,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
Buffer,
256,
nullptr
);
std::string message(Buffer, size);
LERROR("Cannot open file " << destinationFile << ": " << message);
return false;
}
else {