From 49e508042ca65fcb0482f2105bcb7f94a96d88c2 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Fri, 9 Jan 2015 13:45:40 -0500 Subject: [PATCH 1/2] Update VS copy files stage to include DLLs --- src/BoE.vsproj/Common/Common.vcxproj | 4 +-- src/BoE.vsproj/Common/CopyFiles.bat | 28 ++++++++++++++++++--- src/BoE.vsproj/PcEdit/Char Editor.vcxproj | 1 + src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj | 1 + 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/BoE.vsproj/Common/Common.vcxproj b/src/BoE.vsproj/Common/Common.vcxproj index b916c8b4..4af955b4 100644 --- a/src/BoE.vsproj/Common/Common.vcxproj +++ b/src/BoE.vsproj/Common/Common.vcxproj @@ -164,7 +164,7 @@ false - call $(ProjectDir)CopyFiles.bat $(SolutionDir)$(Configuration) + call "$(ProjectDir)CopyFiles.bat" "$(SolutionDir)" "$(Configuration)" "$(VCInstallDir)" Copy resource files @@ -188,7 +188,7 @@ true - call $(ProjectDir)CopyFiles.bat $(SolutionDir)$(Configuration) + call "$(ProjectDir)CopyFiles.bat" "$(SolutionDir)" "$(Configuration)" "$(VCInstallDir)" Copy resource files diff --git a/src/BoE.vsproj/Common/CopyFiles.bat b/src/BoE.vsproj/Common/CopyFiles.bat index fe167814..a59fafa3 100644 --- a/src/BoE.vsproj/Common/CopyFiles.bat +++ b/src/BoE.vsproj/Common/CopyFiles.bat @@ -1,9 +1,14 @@ @echo off echo Copying files... -set ResourceDir=%1\..\..\..\rsrc -set TargetDir=%1 +set SolutionDir=%1 +set Config=%2 +set VCDir=%~f3 + +set ResourceDir=%SolutionDir%%Config%\..\..\..\rsrc +set TargetDir=%SolutionDir%%Config% set ScenEdDir=%TargetDir%\"Scenario Editor" +set DllSrcDir=%VCDir%bin @echo on @echo Copying graphics... @@ -28,4 +33,21 @@ xcopy %1\..\..\tools\mask.* %TargetDir%\data\shaders /s /y /i /d xcopy %ResourceDir%\"Blades of Exile Bases" %ScenEdDir%\"Blades of Exile Base" /s /y /i /d @echo Copying scenario files... -xcopy %ResourceDir%\"Blades of Exile Scenarios" %TargetDir%\"Blades of Exile Scenarios" /s /y /i /d \ No newline at end of file +xcopy %ResourceDir%\"Blades of Exile Scenarios"\*.exs %TargetDir%\"Blades of Exile Scenarios" /s /y /i /d +xcopy %ResourceDir%\"Blades of Exile Scenarios"\*.bmp %TargetDir%\"Blades of Exile Scenarios" /s /y /i /d + +@echo Copying required DLLs... +if %Config% == "Debug" ( + xcopy "%DllSrcDir%\sfml-audio-d-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-graphics-d-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-system-d-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-window-d-2.dll" %TargetDir% /s /y /i /d +) else ( + xcopy "%DllSrcDir%\sfml-audio-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-graphics-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-system-2.dll" %TargetDir% /s /y /i /d + xcopy "%DllSrcDir%\sfml-window-2.dll" %TargetDir% /s /y /i /d +) + +xcopy "%DllSrcDir%\zlib1.dll" %TargetDir% /s /y /i /d +xcopy "%DllSrcDir%\libsndfile-1.dll" %TargetDir% /s /y /i /d \ No newline at end of file diff --git a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj index 16fa7010..b01d72ab 100644 --- a/src/BoE.vsproj/PcEdit/Char Editor.vcxproj +++ b/src/BoE.vsproj/PcEdit/Char Editor.vcxproj @@ -42,6 +42,7 @@ true $(SolutionDir)$(Configuration)\ + Character Editor false diff --git a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj index e1d58d31..82cd0fed 100644 --- a/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj +++ b/src/BoE.vsproj/ScenEdit/Scen Editor.vcxproj @@ -42,6 +42,7 @@ true $(SolutionDir)$(Configuration)\ + Scenario Editor false From 057f271fe737d8a8b8b1e7c874a7659dedd69fc1 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Fri, 9 Jan 2015 14:22:40 -0500 Subject: [PATCH 2/2] Redirect VS release build log to a file in %APPDATA% rather than in the program directory - Will be important once there's an installer, since apps may not have permission to modify the program directory --- src/tools/fileio.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/tools/fileio.cpp b/src/tools/fileio.cpp index f92db21f..bd03f1f1 100644 --- a/src/tools/fileio.cpp +++ b/src/tools/fileio.cpp @@ -57,20 +57,6 @@ std::filebuf logfile; void init_directories(const char* exec_path) { progDir = fs::canonical(exec_path); -#ifdef _MSC_VER -#ifdef DEBUG - void set_debug_buffers(); - set_debug_buffers(); -#else - std::string logpath = (progDir.parent_path()/"bladeslog.txt").string(); - logfile.open(logpath.c_str(), std::ios::out); - std::cout.rdbuf(&logfile); - std::cerr.rdbuf(&logfile); -#endif - std::cout << "Testing cout" << std::endl; - std::cerr << "Testing cerr" << std::endl; - sf::err().rdbuf(std::cerr.rdbuf()); -#endif #ifdef __APPLE__ // Need to back up out of the application package // We're pointing at .app/Contents/MacOS/exec_name, so back out three steps @@ -78,7 +64,6 @@ void init_directories(const char* exec_path) { #endif progDir = progDir.parent_path(); if(progDir.filename() == "Scenario Editor") progDir = progDir.parent_path(); - std::cout << progDir << std::endl; // Initialize the resource manager paths ResMgr::pushPath(progDir/"Scenario Editor"/"graphics.exd"/"mac"); ResMgr::pushPath(progDir/"Scenario Editor"/"graphics.exd"/"mac"/"cursors"); @@ -100,6 +85,23 @@ void init_directories(const char* exec_path) { #endif // __APPLE__ #endif // _Win32||_Win64 tempDir /= "Temporary Files"; + + // Depending on the build environment, we may need to redirect stdout and stderr. +#ifdef _MSC_VER +#ifdef DEBUG + void set_debug_buffers(); + set_debug_buffers(); +#else + std::string logpath = (tempDir.parent_path()/"bladeslog.txt").string(); + logfile.open(logpath.c_str(), std::ios::out); + std::cout.rdbuf(&logfile); + std::cerr.rdbuf(&logfile); +#endif + std::cout << "Testing cout" << std::endl; + std::cerr << "Testing cerr" << std::endl; + sf::err().rdbuf(std::cerr.rdbuf()); +#endif + std::cout << progDir << std::endl; } void check_for_intel() {