Removed old projects and build settings

Updated readme with new win32 build output
Fixed a couple of glitches in cmake config files
master
Lodle 2013-10-18 15:31:33 -07:00
parent 9ab7926269
commit b0c2c4fa26
13 changed files with 14 additions and 477 deletions

View File

@ -301,10 +301,6 @@ if(NOT BUILD_ONLY_CEF)
add_subdirectory(third_party/npwrapper)
endif()
if(WIN32)
add_subdirectory(third_party/desura_extra)
endif()
###############################################################################
# build desura
###############################################################################

View File

@ -83,11 +83,11 @@ Build Desura on Windows
Download and install:
* Svn http://www.sliksvn.com/en/download or http://tortoisesvn.net/downloads.html
* Msvc 2012 or higher
* Msvc 2013 or higher (as C++11 features are in use)
* Python 2.7 http://www.python.org/getit/
* CMake 2.8 http://www.cmake.org/
* Patch either from msysGit or git bash
* Windows DirectX 9 SDK for the CEF build https://www.microsoft.com/en-us/download/details.aspx?id=6812
* (Optional) Windows DirectX 9 SDK for the CEF build https://www.microsoft.com/en-us/download/details.aspx?id=6812
Note: Make sure you add svn and python to your environment PATH
@ -108,9 +108,9 @@ Open a 32bit cmd.exe with env vars set up by vc or other scripts (so we have a f
* Set BUILD_ALL as startup project
* In properties for BUILD_ALL set debugging options:
* Command to source code dir + "\build_out\desura.exe"
* Working Directory to source code dir + "\build_out"
* Build ThirdParty folder first (race condition some times if you dont
* Command to source code dir + "\build_vis\Debug_Out\desura.exe"
* Working Directory to source code dir + "\build_vis\Debug_Out"
* Build ThirdParty folder first (race condition some times if you dont)
* Build BUILD_ALL
Should be able to run and debug Desura now.

View File

@ -3,6 +3,6 @@ IF NOT EXIST build_vis (
)
cd build_vis
cmake .. -DCMAKE_INSTALL_PREFIX=../install_vis -G "Visual Studio 10" -DBUILD_CEF=OFF -DDEBUG=ON -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DDEBUG_V8=ON
cmake .. -DCMAKE_INSTALL_PREFIX=../install_vis -G "Visual Studio 12" -DBUILD_CEF=OFF -DDEBUG=ON -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DDEBUG_V8=ON
start Desura.sln
cd ..

View File

@ -70,6 +70,8 @@ if(WIN32 AND NOT MINGW)
source_dir
)
set_property(TARGET curl_s PROPERTY FOLDER "ThirdParty")
if(DEBUG)
set(CURL_INSTALL_DIR_S ${source_dir}/builds/libcurl-vc-x86-debug-static-sspi-winssl)
else()

View File

@ -1,7 +1,7 @@
ExternalProject_Add(
desura_extra_bin
URL "${DESURA_EXTRA_BIN}"
URL_MD5 ${DESURA_EXTRA_BIN}
URL "${DESURA_EXTRA_BIN_URL}"
URL_MD5 ${DESURA_EXTRA_BIN_MD5}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""

View File

@ -14,9 +14,9 @@ set(CMAKE_INSTALL_PREFIX ${DEFAULT_INSTALL_DIR}
CACHE STRING "Desura Install Prefix")
if(WIN32)
set(BINDIR "")
set(RUNTIME_LIBDIR "bin")
set(DATADIR "data")
set(BINDIR "${CMAKE_BUILD_TYPE}_Out")
set(RUNTIME_LIBDIR "${BINDIR}\\bin")
set(DATADIR "${BINDIR}\\data")
else()
set(BINDIR ""
CACHE STRING "Desura Bin Install Dir")

View File

@ -122,8 +122,6 @@ endif()
option(BUILD_TOOLS "Build various Desura tools." ON)
if(BUILD_TOOLS)
add_subdirectory(tools/mcf_upload_cli)
add_subdirectory(tools/mcf_extract)
add_subdirectory(tools/mcf_util)
endif()

View File

@ -21,4 +21,4 @@ target_link_libraries(dumpgen
)
SetStaticRuntime(dumpgen)
install_tool(dumpgen)
install_executable(dumpgen)

View File

@ -1,21 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/code
)
file(GLOB Sources code/*.cpp )
if(UNIX)
set(LINUX_LIBRARIES dl)
endif()
add_executable(mcf_extract ${Sources})
target_link_libraries(mcf_extract
mcfcore
${LINUX_LIBRARIES}
)
if(WIN32)
SetSharedRuntime(mcf_extract)
endif()
install_tool(mcf_extract)

View File

@ -1,56 +0,0 @@
/*
Desura is the leading indie game distribution platform
Copyright (C) 2012 Jookia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include <Common.h>
#include <mcfcore/MCFMain.h>
#include <cstdio>
void PrintfMsg(const char* format, ...)
{
va_list args;
va_start(args, format);
vprintf(format, args);
#ifdef DEBUG
char out[1024]={0};
vsnprintf(out, 1024, format, args);
OutputDebugString(out);
#endif
va_end(args);
}
int main(int argCount, const char* args[])
{
if(argCount != 3)
{
printf("Usage: mcf_extract FILE DIR\n");
return 1;
}
const char* filename = args[1];
const char* dirname = args[2];
McfHandle mcf((MCFCore::MCFI*)MCFCore::FactoryBuilder(MCF_FACTORY));
mcf->setFile(filename);
mcf->parseMCF();
mcf->saveFiles(dirname);
return 0;
}

View File

@ -1,22 +0,0 @@
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/code
)
file(GLOB Sources code/*.cpp )
add_executable(mcf_upload_cli ${Sources})
target_link_libraries(mcf_upload_cli
managers
managers_window
threads
usercore
util
util_fs
${CURL_LIBRARIES}
)
if(WIN32)
SetSharedRuntime(mcf_upload_cli)
endif()
install_tool(mcf_upload_cli)

View File

@ -1,342 +0,0 @@
/*
Desura is the leading indie game distribution platform
Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include "Common.h"
#include "usercore/UserCoreI.h"
#include "usercore/UserThreadManagerI.h"
#include "usercore/MCFThreadI.h"
#include "util_thread/BaseThread.h"
UserCore::UserI* g_pUserHandle;
Thread::WaitCondition g_WaitCon;
gcString g_strMcfOutPath;
gcString g_strUploadHash;
bool g_bUploadDone;
bool Login(std::string &strUsername, std::string &strPassword);
bool CreateMcf(DesuraId id, std::string &strFolderPath);
bool StartUpload(DesuraId id);
bool UploadMcf();
void PrintfMsg(const char* format, ...)
{
va_list args;
va_start(args, format);
vprintf(format, args);
#ifdef DEBUG
char out[1024]={0};
vsnprintf(out, 1024, format, args);
OutputDebugString(out);
#endif
va_end(args);
}
class Color;
void LogMsg(int type, std::string msg, Color *col)
{
printf("%s", msg.c_str());
}
void LogMsg(int type, std::wstring msg, Color *col)
{
wprintf(L"%s", msg.c_str());
}
void ShowHelp()
{
printf("----------------------------------------------------------------------------\n");
printf(" MCF Upload Utility By Lodle\n");
printf("----------------------------------------------------------------------------\n");
printf("\n");
printf("Usage:\n");
printf("\t--username (-u): Desura Username\n");
printf("\t--password (-p): Desura Password\n");
printf("\t--folder (-f): Folder of game files\n");
printf("\t--item (-i): Item site area id\n");
printf("\t--type (-t): Item site area (mods | games)\n");
}
std::map<std::string, std::string> ProcessArgs(int argc, char** argv)
{
std::map<std::string, std::string> args;
for (int x=1; x<argc; x++)
{
if (!argv[x] || argv[x][0] != '-')
continue;
if ((x+1) < argc && argv[x][0] == '-')
{
args[argv[x]] = argv[x+1];
x++;
}
else
{
args[argv[x]] = "";
}
}
std::for_each(args.begin(), args.end(), [&args](std::pair<std::string, std::string> p)
{
std::string strKey = p.first;
if (strKey.size() >= 3 && strKey[0] == '-' && strKey[1] == '-')
{
std::string strSort("-");
strSort += strKey[2];
args[strSort] = p.second;
}
});
return args;
}
bool ValidateArgs(std::map<std::string, std::string> &args)
{
if (args["-u"].size() == 0)
return false;
if (args["-p"].size() == 0)
return false;
if (args["-f"].size() == 0)
return false;
if (args["-i"].size() == 0)
return false;
if (args["-t"].size() == 0)
return false;
return true;
}
int main(int argc, char** argv)
{
std::map<std::string, std::string> args = ProcessArgs(argc, argv);
if (args.size() != 5 || !ValidateArgs(args))
{
ShowHelp();
return -5;
}
DesuraId id(args["-i"].c_str(), args["-t"].c_str());
if (!Login(args["-u"], args["-p"]))
return -1;
if (!CreateMcf(id, args["-f"]))
return -2;
if (!StartUpload(id))
return -3;
if (!UploadMcf())
return -4;
return 0;
}
void OnNeedCvar(UserCore::Misc::CVar_s &cvar)
{
}
bool Login(std::string &strUsername, std::string &strPassword)
{
gcString path = UTIL::OS::getAppDataPath();
g_pUserHandle = (UserCore::UserI*)UserCore::FactoryBuilderUC(USERCORE);
g_pUserHandle->init(path.c_str());
try
{
//need to do this here as news items will be passed onlogin
*g_pUserHandle->getNeedCvarEvent() += delegate(&OnNeedCvar);
g_pUserHandle->lockDelete();
g_pUserHandle->logIn(strUsername.c_str(), strPassword.c_str());
g_pUserHandle->unlockDelete();
}
catch (gcException e)
{
g_pUserHandle->logOut();
g_pUserHandle->unlockDelete();
safe_delete(g_pUserHandle);
Warning(gcString("Failed to login: {0}", e));
}
return !g_pUserHandle;
}
void OnMCFCreateProgress(MCFCore::Misc::ProgressInfo &prog)
{
static uint32 s_uiLastProg = -1;
if (s_uiLastProg == prog.percent)
return;
s_uiLastProg = prog.percent;
printf("\r[");
size_t tot = (prog.percent/2);
for (size_t x=0; x<50; x++)
{
if (x<tot)
printf("=");
else
printf(" ");
}
printf("] %u%%", prog.percent);
}
void OnMCFCreateError(gcException &e)
{
Warning(gcString("Failed to create mcf: {0}", e));
g_WaitCon.notify();
}
void OnMCFCreateComplete(gcString &strPath)
{
Msg("Completed creating Mcf.\n");
g_strMcfOutPath = strPath;
g_WaitCon.notify();
}
bool CreateMcf(DesuraId id, std::string &strFolderPath)
{
Msg("Creating Mcf....\n");
UserCore::Thread::MCFThreadI* pThread = g_pUserHandle->getThreadManager()->newCreateMCFThread(id, strFolderPath.c_str());
*pThread->getMcfProgressEvent() += delegate(&OnMCFCreateProgress);
*pThread->getErrorEvent() += delegate(&OnMCFCreateError);
*pThread->getCompleteStringEvent() += delegate(&OnMCFCreateComplete);
pThread->start();
safe_delete(pThread);
g_WaitCon.wait();
return g_strMcfOutPath.size() != 0;
}
void OnStartUploadError(gcException &e)
{
Warning(gcString("Failed to init upload of mcf: {0}", e));
g_WaitCon.notify();
}
void OnStartUploadComplete(gcString &strHash)
{
g_strUploadHash = strHash;
g_WaitCon.notify();
}
bool StartUpload(DesuraId id)
{
Msg("Starting Mcf Upload....\n");
//start upload
UserCore::Thread::MCFThreadI* pPrepThread = g_pUserHandle->getThreadManager()->newUploadPrepThread(id, g_strMcfOutPath.c_str());
*pPrepThread->getErrorEvent() += delegate(&OnStartUploadError);
*pPrepThread->getCompleteStringEvent() += delegate(&OnStartUploadComplete);
pPrepThread->start();
g_WaitCon.wait();
return g_strUploadHash.size() != 0;
}
void OnUploadProgress(UserCore::Misc::UploadInfo &info)
{
static uint32 s_uiLastProg = -1;
if (s_uiLastProg == info.percent)
return;
s_uiLastProg = info.percent;
printf("\r[");
size_t tot = (info.percent/2);
for (size_t x=0; x<50; x++)
{
if (x<tot)
printf("=");
else
printf(" ");
}
std::string done = UTIL::MISC::niceSizeStr(info.doneAmmount, true);
std::string total = UTIL::MISC::niceSizeStr(info.totalAmmount);
std::string lab = UTIL::MISC::genTimeString(info.hour, info.min, info.rate);
printf("] %u%% [done %s of %s] ETA: %s", info.percent, done.c_str(), total.c_str(), lab.c_str());
}
void OnUploadError(gcException &e)
{
Warning(gcString("Failed to upload of mcf: {0}", e));
g_WaitCon.notify();
}
void OnUploadComplete(uint32& status)
{
Msg("Upload complete\n");
g_bUploadDone = true;
g_WaitCon.notify();
}
bool UploadMcf()
{
Msg("Uploading Mcf....\n");
//upload
UserCore::Misc::UploadInfoThreadI* info = g_pUserHandle->getUploadManager()->findItem(g_strUploadHash.c_str());
assert(info);
*info->getUploadProgressEvent() += delegate(&OnUploadProgress);
*info->getErrorEvent() += delegate(&OnUploadError);
*info->getCompleteEvent() += delegate(&OnUploadComplete);
if (info->isPaused())
info->unpause();
info->start();
g_WaitCon.wait();
return g_bUploadDone;
}

View File

@ -1,18 +0,0 @@
ExternalProject_Add(
fetch_desura_extra_bin
URL "${DESURA_EXTRA_BIN_URL}"
URL_MD5 ${DESURA_EXTRA_BIN_MD5}
UPDATE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(
fetch_desura_extra_bin
source_dir
)
add_custom_command(TARGET fetch_desura_extra_bin POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_dir}\\." "${CMAKE_OUTPUT}\\bin\\.")
SET_PROPERTY(TARGET fetch_desura_extra_bin PROPERTY FOLDER "ThirdParty")