diff --git a/.gitignore b/.gitignore index 9cc9556..ae26667 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,8 @@ ipch/ *.suo *.opensdf .DS_STORE -Binaries/ \ No newline at end of file +Binaries/ +*~ +CMakeFiles/ +cmake_install.cmake +CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9555f2d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,281 @@ +################################################################################ +## -------------------------------------------------------------------------- ## +## ## +## (C) 2010-2016 Robot Developers ## +## See LICENSE for licensing info ## +## ## +## -------------------------------------------------------------------------- ## +################################################################################ + +################################################################################ +# Project Setup + +cmake_minimum_required(VERSION 3.2) +project(Robot) + +################################################################################ +# Tools + +# A tool for troubleshooting, to make sure we got all the files +# can be removed without affecting built binaries +function(DisplayList Header ListToShow) + message(STATUS "\t${Header}") + foreach(ListItem ${ListToShow}) + message(STATUS "\t\t${ListItem}") + endforeach(ListItem ${ListToShow}) +endfunction(DisplayList) + +# Variables to allow us to change these things in the future +set(ProjectRootDir ${${PROJECT_NAME}_SOURCE_DIR}/) +set(ProjectBinaryDir ${${PROJECT_NAME}_BINARY_DIR}/) + +set(SourceDir "${ProjectRootDir}Source/") +set(HeaderDir "${ProjectRootDir}Source/") +set(TestSourceDir "${ProjectRootDir}Test/") +set(TestHeaderDir "${ProjectRootDir}Test/") + +################################################################################ +# Define Source Files + +# We could use a globbing expression, but is generally poor form, because +# eventually someone accidentally adds an incorrect file to their build and +# something hard to fix breaks. When there is only one place to update file list +# it is not that painful. +# +# Here are four globbing expressions that appear to work. + +#file(GLOB SourceFileList ${SourceDir}*.cc) +#DisplayList("Source Files" "${SourceFileList}") + +#file(GLOB HeaderFileList ${HeaderDir}*.h) +#DisplayList("Header Files" "${HeaderFileList}") + +#file(GLOB TestSourceFileList ${TestSourceDir}*.cc) +#DisplayList("Test Source Files" "${TestSourceFileList}") + +#file(GLOB TestHeaderFileList ${TestHeaderDir}*.h) +#DisplayList("Test Header Files" "${TestHeaderFileList}") + +set(SourceFileList + "${SourceDir}Bounds.cc" + "${SourceDir}Clipboard.cc" + "${SourceDir}Color.cc" + "${SourceDir}Hash.cc" + "${SourceDir}Image.cc" + "${SourceDir}Keyboard.cc" + "${SourceDir}Memory.cc" + "${SourceDir}Module.cc" + "${SourceDir}Mouse.cc" + "${SourceDir}Point.cc" + "${SourceDir}Process.cc" + "${SourceDir}Range.cc" + "${SourceDir}Screen.cc" + "${SourceDir}Size.cc" + "${SourceDir}Timer.cc" + "${SourceDir}Window.cc" +) +DisplayList("Source Files" "${SourceFileList}") + +set(HeaderFileList + "${HeaderDir}Bounds.h" + "${HeaderDir}Bounds.h" + "${HeaderDir}Clipboard.h" + "${HeaderDir}Color.h" + "${HeaderDir}Enum.h" + "${HeaderDir}Global.h" + "${HeaderDir}Hash.h" + "${HeaderDir}Image.h" + "${HeaderDir}Keyboard.h" + "${HeaderDir}Memory.h" + "${HeaderDir}Module.h" + "${HeaderDir}Mouse.h" + "${HeaderDir}Point.h" + "${HeaderDir}Process.h" + "${HeaderDir}Range.h" + "${HeaderDir}Robot.h" + "${HeaderDir}Screen.h" + "${HeaderDir}Size.h" + "${HeaderDir}Timer.h" + "${HeaderDir}Types.h" + "${HeaderDir}Window.h" + +) +DisplayList("Header Files" "${HeaderFileList}") + +set(TestSourceFileList + "${TestSourceDir}Clipboard.cc" + "${TestSourceDir}Keyboard.cc" + "${TestSourceDir}Main.cc" + "${TestSourceDir}Memory.cc" + "${TestSourceDir}Mouse.cc" +# "${TestSourceDir}Peon.cc" + "${TestSourceDir}Process.cc" + "${TestSourceDir}Screen.cc" + "${TestSourceDir}Targa.cc" + "${TestSourceDir}Timer.cc" + "${TestSourceDir}Types.cc" + "${TestSourceDir}Window.cc" +) +DisplayList("Test Source Files" "${TestSourceFileList}") + +set(TestHeaderFileList + "${TestHeaderDir}Targa.h" + "${TestHeaderDir}Test.h" +) + +DisplayList("Test Header Files" "${TestHeaderFileList}") + +################################################################################ +# Detect Platform + +set(SystemIsLinux OFF) +set(SystemIsWindows OFF) +set(SystemIsMacOSX OFF) + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + message(STATUS "\tDetected OS as 'Linux'.") + set(SystemIsLinux ON) +endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + message(STATUS "\tDetected OS as 'Windows'.") + set(SystemIsWindows ON) +endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + message(STATUS "\tDetected OS as 'Mac OS X'.") + set(SystemIsMacOSX ON) +endif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + +################################################################################ +# Detect Compiler + +set(CompilerIsGCC OFF) +set(CompilerIsClang OFF) +set(CompilerIsIntel OFF) +set(CompilerIsMsvc OFF) + +set(CompilerDesignNix OFF) +set(CompilerDesignMS OFF) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + message(STATUS "\tDetected compiler as 'GCC'.") + set(CompilerIsGCC ON) + set(CompilerDesignNix ON) +endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + message(STATUS "\tDetected compiler as 'Clang'.") + set(CompilerIsClang ON) + set(CompilerDesignNix ON) +endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + message(STATUS "\tDetected compiler as 'Intel'.") + set(CompilerIsIntel ON) + set(CompilerDesignNix ON) +endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + message(STATUS "\tDetected compiler as 'MSVC'.") + set(CompilerIsMsvc ON) + set(CompilerDesignMS ON) +endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + +################################################################################ +# Set up build + +# When using the CMake-gui this creates a checkbox +option(BuildStatic "Set for Static library, unset for Dynamic library." ON) +if(BuildStatic) + set(BuildType "STATIC") +else(BuildStatic) + set(BuildType "SHARED") +endif(BuildStatic) +message(STATUS "\tLibrary Build type '${BuildType}'.") + +if(CompilerIsGCC) + add_definitions("-iquote${HeaderDir}" "-iquote${TestHeaderDir}") +else(CompilerIsGCC) + include_directories("${HeaderDir}" "${TestHeaderDir}") +endif(CompilerIsGCC) + +################################################################################ +# System Specific Settings + + +if(CompilerDesignNix) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") +endif(CompilerDesignNix) + +if(CompilerIsMsvc) + # Put msvc compiler flags here. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") +endif(CompilerIsMsvc) + +if(SystemIsWindows AND CompilerIsGCC) + # Put mingw compiler flags here. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endif(SystemIsWindows AND CompilerIsGCC) + + +################################################################################ +# Make build targets + +# For those unfamiliar with CMake. When it spits out build files, like make +# files, ninja scripts or vs solutions, these are the top level objects +# presented to the developer. +# +# So a dev can type "make Robot" to build the library or can type "ninja Test" +# to build Test and everything it requires. +# +# If used to create files for IDEs like Code::Blocks, visual studio, or +# QtCreator these will show up appropriately as different projects or build +# targets. + +add_library(Robot "${BuildType}" "${HeaderFileList}" "${SourceFileList}") +add_executable(Test "${TestHeaderFileList}" "${TestSourceFileList}") + +################################################################################ +# Link Build Targets + +set(LinkLibraries "") + +if(SystemIsLinux) + set(LinkLibraries ${LinkLibraries} rt X11 Xtst Xinerama) +endif(SystemIsLinux) + +if(SystemIsWindows AND CompilerIsGCC) + set(LinkLibraries ${LinkLibraries} Shlwapi psapi) +endif(SystemIsWindows AND CompilerIsGCC) + +target_link_libraries(Robot "${LinkLibraries}") +target_link_libraries(Test Robot) + +if(NOT BuildStatic) + # Adds the definition when building robot + target_compile_definitions(Robot PRIVATE -DBUILDING_ROBOT_SHARED) + # Adds the definition when something else links against Robot + target_compile_definitions(Robot INTERFACE -DUSING_ROBOT_SHARED) +endif(NOT BuildStatic) + + + + +# TODO +# install process +# d in debug build +# objective C++ and other mac stuff +# All of Peon +# .BIN in the names +# Figure out any special VS specific logic. I don't think is any beyound /W3 + + + + + + + + + + diff --git a/Source/Clipboard.cc b/Source/Clipboard.cc index fd50f5a..da43ce9 100644 --- a/Source/Clipboard.cc +++ b/Source/Clipboard.cc @@ -21,7 +21,10 @@ using std::string; #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include using std::wstring; diff --git a/Source/Enum.h b/Source/Enum.h index b0f835c..16274d1 100644 --- a/Source/Enum.h +++ b/Source/Enum.h @@ -18,7 +18,7 @@ #include ROBOT_NS_BEGIN -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (push) // Ignore the VS C4251 warning #pragma warning (disable:4251) @@ -148,7 +148,7 @@ template class Enum static ValueMap mMap; }; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (pop) #endif diff --git a/Source/Global.h b/Source/Global.h index 78667f5..0e3847e 100644 --- a/Source/Global.h +++ b/Source/Global.h @@ -65,11 +65,47 @@ #else - #error Your operating system is not supported + #error Your operating system is not supported. #endif +//----------------------------------------------------------------------------// +// Compilers // +//----------------------------------------------------------------------------// + +#if(_MSC_VER) + + #define ROBOT_VS_COMPILER_GROUP + + #if (_MSC_VER == 1900) + #define ROBOT_VS_COMPILER_2015_14 + #elif (_MSC_VER == 1800) + #define ROBOT_VS_COMPILER_2013_12 + #elif (_MSC_VER == 1700) + #define ROBOT_VS_COMPILER_2011_11 + #elif (_MSC_VER == 1600) + #define ROBOT_VS_COMPILER_2010_10 + #else + #error Your version of microsoft visual C++ is not supported. + #endif + +#else + + #define ROBOT_NIX_COMPILER_GROUP + + #if defined(__clang__) + #define ROBOT_CLANG_COMPILER + #elif defined(__MINGW32__) + #define ROBOT_MINGW_COMPILER + #elif defined(__GNUC__) || defined(__GNUG__) + // Must be last because Clange will report as an old Version of GCC and + // who knows what MinGW will do that seems crazy but makes only on deep + // inspection of GCC interactions with windows. + #define ROBOT_GCC_COMPILER + #endif + +#endif //----------------------------------------------------------------------------// // Export // @@ -145,17 +181,20 @@ // Types // //----------------------------------------------------------------------------// + +#include + ROBOT_NS_BEGIN -typedef signed char int8; // Signed 8-Bit integer -typedef signed short int16; // Signed 16-Bit integer -typedef signed int int32; // Signed 32-Bit integer -typedef signed long long int64; // Signed 64-Bit integer +typedef std::int8_t int8; // Signed 8-Bit integer +typedef std::int16_t int16; // Signed 16-Bit integer +typedef std::int32_t int32; // Signed 32-Bit integer +typedef std::int64_t int64; // Signed 64-Bit integer -typedef unsigned char uint8; // Unsigned 8-Bit integer -typedef unsigned short uint16; // Unsigned 16-Bit integer -typedef unsigned int uint32; // Unsigned 32-Bit integer -typedef unsigned long long uint64; // Unsigned 64-Bit integer +typedef std::uint8_t uint8; // Unsigned 8-Bit integer +typedef std::uint16_t uint16; // Unsigned 16-Bit integer +typedef std::uint32_t uint32; // Unsigned 32-Bit integer +typedef std::uint64_t uint64; // Unsigned 64-Bit integer typedef float real32; // 32-Bit float value typedef double real64; // 64-Bit float value diff --git a/Source/Keyboard.cc b/Source/Keyboard.cc index 035a757..7d36a97 100644 --- a/Source/Keyboard.cc +++ b/Source/Keyboard.cc @@ -34,8 +34,10 @@ using std::string; #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX - #define WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX + #define NOMINMAX + #endif + #include #endif diff --git a/Source/Memory.cc b/Source/Memory.cc index 86d9a5a..f87252f 100644 --- a/Source/Memory.cc +++ b/Source/Memory.cc @@ -55,7 +55,10 @@ using std::unordered_map; #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include diff --git a/Source/Mouse.cc b/Source/Mouse.cc index 1210c08..1051106 100644 --- a/Source/Mouse.cc +++ b/Source/Mouse.cc @@ -30,10 +30,19 @@ #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include + #ifdef ROBOT_NIX_COMPILER_GROUP + // To make up for MinGW's winuser.h being incomplete + // Do MinGW not have horizontal mouse wheels? + #define MOUSEEVENTF_HWHEEL 0x01000 + #endif + #endif ROBOT_NS_BEGIN diff --git a/Source/Process.cc b/Source/Process.cc index e0f982d..1bd498d 100644 --- a/Source/Process.cc +++ b/Source/Process.cc @@ -62,7 +62,10 @@ using std::regex_match; #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include @@ -369,58 +372,68 @@ bool Process::Open (int32 pid) #endif #ifdef ROBOT_OS_WIN + #ifdef ROBOT_NIX_COMPILER_GROUP + + // This could be implemented, but will require some work and + // linking to at least one extra library. + // http://stackoverflow.com/questions/15554380/mingw-with-old-winbase-h-file + return false; + + #endif + #ifdef ROBOT_VS_COMPILER_GROUP + + mData->Handle = OpenProcess (PROCESS_VM_OPERATION | + PROCESS_VM_READ | PROCESS_QUERY_INFORMATION | + PROCESS_VM_WRITE | PROCESS_TERMINATE, FALSE, pid); + + // Check if handle is valid + if (mData->Handle != nullptr) + { + // Store the ProcID + mData->ProcID = pid; - mData->Handle = OpenProcess (PROCESS_VM_OPERATION | - PROCESS_VM_READ | PROCESS_QUERY_INFORMATION | - PROCESS_VM_WRITE | PROCESS_TERMINATE, FALSE, pid); + // Check if system 64-Bit + if (Process::IsSys64Bit()) + { + BOOL is32Bit = TRUE; + // Set whether process is 64-Bit + mData->Is64Bit = IsWow64Process + (mData->Handle, &is32Bit) && + is32Bit == FALSE; + } - // Check if handle is valid - if (mData->Handle != nullptr) - { - // Store the ProcID - mData->ProcID = pid; + #ifdef ROBOT_ARCH_32 + // Don't attach to x64 processes from x86 apps + if (mData->Is64Bit) { Close(); return false; } + #endif - // Check if system 64-Bit - if (Process::IsSys64Bit()) - { - BOOL is32Bit = TRUE; - // Set whether process is 64-Bit - mData->Is64Bit = IsWow64Process - (mData->Handle, &is32Bit) && - is32Bit == FALSE; - } + DWORD size = MAX_PATH; + TCHAR link [MAX_PATH]; + string name, path; - #ifdef ROBOT_ARCH_32 - // Don't attach to x64 processes from x86 apps - if (mData->Is64Bit) { Close(); return false; } - #endif + if (QueryFullProcessImageName + // Try and get process path name + (mData->Handle, 0, link, &size)) + { + path = _UTF8Encode (link); + // Convert any backslashes to normal slashes + replace (path.begin(), path.end(), '\\', '/'); - DWORD size = MAX_PATH; - TCHAR link [MAX_PATH]; - string name, path; + // Retrieve the file part of the path + auto last = path.find_last_of ('/'); + if (last == string::npos) name = path; + else name = path.substr (last + 1); - if (QueryFullProcessImageName - // Try and get process path name - (mData->Handle, 0, link, &size)) - { - path = _UTF8Encode (link); - // Convert any backslashes to normal slashes - replace (path.begin(), path.end(), '\\', '/'); - - // Retrieve the file part of the path - auto last = path.find_last_of ('/'); - if (last == string::npos) name = path; - else name = path.substr (last + 1); + // Store both the name and path values + mData->Name = name; mData->Path = path; + } - // Store both the name and path values - mData->Name = name; mData->Path = path; + return true; } - return true; - } - - return false; + return false; + #endif #endif } diff --git a/Source/Process.h b/Source/Process.h index 67a86e8..d495b53 100644 --- a/Source/Process.h +++ b/Source/Process.h @@ -24,7 +24,7 @@ ROBOT_NS_BEGIN class Module; class Window; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (push) // Ignore the VS C4251 warning #pragma warning (disable:4251) diff --git a/Source/Screen.cc b/Source/Screen.cc index 031b9e5..803e250 100644 --- a/Source/Screen.cc +++ b/Source/Screen.cc @@ -31,7 +31,10 @@ #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include diff --git a/Source/Screen.h b/Source/Screen.h index ecb1c4e..e8ba1ea 100644 --- a/Source/Screen.h +++ b/Source/Screen.h @@ -20,7 +20,7 @@ ROBOT_NS_BEGIN class Screen; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (push) // Ignore the VS C4251 warning #pragma warning (disable:4251) @@ -89,7 +89,7 @@ class ROBOT_EXPORT Screen static ScreenList mScreens; // System screens deque }; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (pop) #endif diff --git a/Source/Timer.cc b/Source/Timer.cc index aff484b..e0964b4 100644 --- a/Source/Timer.cc +++ b/Source/Timer.cc @@ -26,7 +26,10 @@ #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include @@ -218,8 +221,12 @@ uint64 Timer::GetCpuTime (void) return (time * 1000) / frequency; } - // Should never happen - return GetTickCount64(); + // Should never happen + #ifdef ROBOT_NIX_COMPILER_GROUP + return GetTickCount(); + #else + return GetTickCount64(); + #endif #endif } diff --git a/Source/Window.cc b/Source/Window.cc index 204f146..28a5259 100644 --- a/Source/Window.cc +++ b/Source/Window.cc @@ -49,7 +49,10 @@ using std::regex_match; #endif #ifdef ROBOT_OS_WIN - #define NOMINMAX + #ifndef NOMINMAX + #define NOMINMAX + #endif + #define WIN32_LEAN_AND_MEAN #include using std::wstring; diff --git a/Source/Window.h b/Source/Window.h index e029c49..290db27 100644 --- a/Source/Window.h +++ b/Source/Window.h @@ -22,7 +22,7 @@ ROBOT_NS_BEGIN class Process; class Window; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (push) // Ignore the VS C4251 warning #pragma warning (disable:4251) @@ -114,7 +114,7 @@ class ROBOT_EXPORT Window std::shared_ptr mData; // Shared information }; -#ifdef ROBOT_OS_WIN +#ifdef ROBOT_VS_COMPILER_GROUP #pragma warning (pop) #endif diff --git a/Test/Process.cc b/Test/Process.cc index ec14a12..65e31a5 100644 --- a/Test/Process.cc +++ b/Test/Process.cc @@ -43,6 +43,101 @@ //////////////////////////////////////////////////////////////////////////////// +static bool TestPreproc (void) +{ + cout << "Warning: The next set of tests cannot be automated\n" + << " Please validate your platform and compiler\n\n"; + + // Platform + bool platform_linux = false; + bool platform_mac = false; + bool platform_windows = false; + +#ifdef ROBOT_OS_LINUX + platform_linux = true; +#endif +#ifdef ROBOT_OS_MAC + platform_mac = true; +#endif +#ifdef ROBOT_OS_WIN + platform_windows = true; +#endif + + cout << "Check Platform:" << boolalpha + << "\n\tLinux - " << platform_linux + << "\n\tMac OS X - " << platform_mac + << "\n\tWindows - " << platform_windows; + + // Compiler group + bool compiler_nix = false; + bool compiler_vc = false; + +#ifdef ROBOT_NIX_COMPILER_GROUP + compiler_nix = true; +#endif +#ifdef ROBOT_VS_COMPILER_GROUP + compiler_vc = true; +#endif + + cout << "\n\nCheck Compiler Group (type of args and pragmas accepted):" << boolalpha + << "\n\tUnix like - " << compiler_nix + << "\n\tMsvc like - " << compiler_vc << endl; + + + // Unixy compiler detection + bool compiler_clang = false; + bool compiler_mingw = false; + bool compiler_gcc = false; + +#ifdef ROBOT_CLANG_COMPILER + compiler_clang = true; +#endif +#ifdef ROBOT_MINGW_COMPILER + compiler_mingw = true; +#endif +#ifdef ROBOT_GCC_COMPILER + compiler_gcc = true; +#endif + + cout << "\n\nSpecific compiler:" << boolalpha + << "\n\tClang - " << compiler_clang + << "\n\tMinGW - " << compiler_mingw + << "\n\tGCC - " << compiler_gcc << endl; + + + // microsoft compiler detection + bool compiler_vc10 = false; + bool compiler_vc11 = false; + bool compiler_vc12 = false; + bool compiler_vc14 = false; + +#ifdef ROBOT_VS_COMPILER_2010_10 + compiler_vc10 = true; +#endif +#ifdef ROBOT_VS_COMPILER_2011_11 + compiler_vc11 = true; +#endif +#ifdef ROBOT_VS_COMPILER_2013_12 + compiler_vc12 = true; +#endif +#ifdef ROBOT_VS_COMPILER_2015_14 + compiler_vc14 = true; +#endif + + cout << "\n\nMsvc versions:" << boolalpha + << "\n\tMsvc 2010 - " << compiler_vc10 + << "\n\tMsvc 2011 - " << compiler_vc11 + << "\n\tMsvc 2012 - " << compiler_vc12 + << "\n\tMsvc 2014 - " << compiler_vc14 << endl; + + + WaitForEnter(); + + return true; + +} + + static bool TestInvalid (void) { Process p1; @@ -348,9 +443,10 @@ static bool TestGetList (void) bool TestProcess (void) { cout << "BEGIN PROCESS TESTING\n------------------------------\n"; - if (!TestInvalid()) { cout << ">> Invalid Failed\n\n"; return false; } + if (!TestPreproc()) { cout << ">> Preproc Failed\n\n"; return false; } + if (!TestInvalid()) { cout << ">> Invalid Failed\n\n"; return false; } if (!TestSelect ()) { cout << ">> Select Failed \n\n"; return false; } - if (!TestCurrent()) { cout << ">> Current Failed\n\n"; return false; } - if (!TestGetList()) { cout << ">> GetList Failed\n\n"; return false; } + if (!TestCurrent()) { cout << ">> Current Failed\n\n"; return false; } + if (!TestGetList()) { cout << ">> GetList Failed\n\n"; return false; } cout << ">> Success\n\n"; return true; } diff --git a/Test/Test.h b/Test/Test.h index b5e5827..b468713 100644 --- a/Test/Test.h +++ b/Test/Test.h @@ -23,9 +23,12 @@ using std::endl; using std::ostream; using std::istream; -using std:: uppercase; +using std::uppercase; using std::nouppercase; +#include +using std::boolalpha; + #include using std::setw; using std::setfill; @@ -171,7 +174,13 @@ inline ostream& operator << (ostream& out, const Bounds& bounds) return out; } +//////////////////////////////////////////////////////////////////////////////// +inline void WaitForEnter(const string& message = string("Press enter to continue.")) +{ + cout << endl << message << endl; + getchar(); +} //----------------------------------------------------------------------------// // Functions //