From b0c2c4fa26e3e79b3c31301e5274d189962d6db8 Mon Sep 17 00:00:00 2001 From: Lodle Date: Fri, 18 Oct 2013 15:31:33 -0700 Subject: [PATCH] Removed old projects and build settings Updated readme with new win32 build output Fixed a couple of glitches in cmake config files --- CMakeLists.txt | 4 - README.md | 10 +- build_desura_vis.bat | 2 +- cmake/modules/BuildCURL.cmake | 2 + cmake/modules/BuildDesuraExtraBin.cmake | 4 +- cmake/modules/SetInstallPaths.cmake | 6 +- src/CMakeLists.txt | 2 - src/executable/dumpgen_win/CMakeLists.txt | 2 +- src/tools/mcf_extract/CMakeLists.txt | 21 -- src/tools/mcf_extract/code/main.cpp | 56 ---- src/tools/mcf_upload_cli/CMakeLists.txt | 22 -- src/tools/mcf_upload_cli/code/main.cpp | 342 ---------------------- third_party/desura_extra/CMakeLists.txt | 18 -- 13 files changed, 14 insertions(+), 477 deletions(-) delete mode 100644 src/tools/mcf_extract/CMakeLists.txt delete mode 100644 src/tools/mcf_extract/code/main.cpp delete mode 100644 src/tools/mcf_upload_cli/CMakeLists.txt delete mode 100644 src/tools/mcf_upload_cli/code/main.cpp delete mode 100644 third_party/desura_extra/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 368b5278..02fd1f6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ############################################################################### diff --git a/README.md b/README.md index 66eb8a03..16d0e915 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build_desura_vis.bat b/build_desura_vis.bat index 47832306..c5d9909f 100644 --- a/build_desura_vis.bat +++ b/build_desura_vis.bat @@ -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 .. \ No newline at end of file diff --git a/cmake/modules/BuildCURL.cmake b/cmake/modules/BuildCURL.cmake index d28e9c95..a0a97b0f 100644 --- a/cmake/modules/BuildCURL.cmake +++ b/cmake/modules/BuildCURL.cmake @@ -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() diff --git a/cmake/modules/BuildDesuraExtraBin.cmake b/cmake/modules/BuildDesuraExtraBin.cmake index 969c9c40..3623369c 100644 --- a/cmake/modules/BuildDesuraExtraBin.cmake +++ b/cmake/modules/BuildDesuraExtraBin.cmake @@ -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 "" diff --git a/cmake/modules/SetInstallPaths.cmake b/cmake/modules/SetInstallPaths.cmake index 00c08e7b..a39e6ac5 100644 --- a/cmake/modules/SetInstallPaths.cmake +++ b/cmake/modules/SetInstallPaths.cmake @@ -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") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de1d8f3e..d5a6a6d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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() diff --git a/src/executable/dumpgen_win/CMakeLists.txt b/src/executable/dumpgen_win/CMakeLists.txt index 54b94fbf..8dfd1c8b 100644 --- a/src/executable/dumpgen_win/CMakeLists.txt +++ b/src/executable/dumpgen_win/CMakeLists.txt @@ -21,4 +21,4 @@ target_link_libraries(dumpgen ) SetStaticRuntime(dumpgen) -install_tool(dumpgen) +install_executable(dumpgen) diff --git a/src/tools/mcf_extract/CMakeLists.txt b/src/tools/mcf_extract/CMakeLists.txt deleted file mode 100644 index f2fdcd44..00000000 --- a/src/tools/mcf_extract/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/tools/mcf_extract/code/main.cpp b/src/tools/mcf_extract/code/main.cpp deleted file mode 100644 index fcc14eaa..00000000 --- a/src/tools/mcf_extract/code/main.cpp +++ /dev/null @@ -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 -*/ - -#include -#include -#include - -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; -} diff --git a/src/tools/mcf_upload_cli/CMakeLists.txt b/src/tools/mcf_upload_cli/CMakeLists.txt deleted file mode 100644 index c4acd02c..00000000 --- a/src/tools/mcf_upload_cli/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/tools/mcf_upload_cli/code/main.cpp b/src/tools/mcf_upload_cli/code/main.cpp deleted file mode 100644 index cc846c8f..00000000 --- a/src/tools/mcf_upload_cli/code/main.cpp +++ /dev/null @@ -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 -*/ - -#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 ProcessArgs(int argc, char** argv) -{ - std::map args; - - for (int x=1; x 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 &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 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 (xgetThreadManager()->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 (xgetUploadManager()->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; -} diff --git a/third_party/desura_extra/CMakeLists.txt b/third_party/desura_extra/CMakeLists.txt deleted file mode 100644 index 0cfaa7ca..00000000 --- a/third_party/desura_extra/CMakeLists.txt +++ /dev/null @@ -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")