Remove Visual C++ support


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4774 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/BUILDING.txt b/BUILDING.txt
index 044e7c4..85b434e 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -55,30 +55,7 @@
 Build Requirements (Windows)
 ============================
 
--- Microsoft Visual C++ 2005 or later
-
-   If you don't already have Visual C++, then the easiest way to get it is by
-   installing the Windows SDK:
-
-   http://msdn.microsoft.com/en-us/windows/bb980924.aspx
-
-   The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
-   everything necessary to build TigerVNC.
-
-   * For 32-bit builds, you can also use Microsoft Visual C++ Express
-     Edition.  Visual C++ Express Edition is a free download.
-   * If you intend to build TigerVNC from the command line, then add the
-     appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
-     environment variables.  This is generally accomplished by executing
-     vcvars32.bat or vcvars64.bat and SetEnv.cmd.  vcvars32.bat and
-     vcvars64.bat are part of Visual C++ and are located in the same directory
-     as the compiler.  SetEnv.cmd is part of the Windows SDK.  You can pass
-     optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
-     environment.
-
-... OR ...
-
--- MinGW
+-- MinGW or MinGW-w64
 
 -- Inno Setup (needed to build the TigerVNC installer)
    Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
@@ -220,49 +197,24 @@
 build configuration or module dependencies.
 
 
-Building the Windows TigerVNC Viewer/Server with Visual C++ (Command Line)
---------------------------------------------------------------------------
-
-  cd {build_directory}
-  cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}
-  nmake
-
-This will build either a 32-bit or a 64-bit version of TigerVNC, depending
-on which version of cl.exe is in the PATH.
-
-
-Building the Windows TigerVNC Viewer/Server with Visual C++ (IDE)
------------------------------------------------------------------
-
-Choose the appropriate CMake generator option for your version of Visual Studio
-(run "cmake" with no arguments for a list of available generators.)  For
-instance:
-
-  cd {build_directory}
-  cmake -G "Visual Studio 9 2008" [additional CMake flags] {source_directory}
-
-You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
-configurations in that project ("Debug", "Release", etc.) to generate a full
-build of TigerVNC.
-
-
 Building the Windows TigerVNC Viewer with MinGW
 -----------------------------------------------
 
+If building the Windows version of TigerVNC on a Windows build system, use
+the following procedure.
+
   cd {build_directory}
   cmake -G "MSYS Makefiles" [additional CMake flags] {source_directory}
   make
 
-This will generate only vncviewer.  Currently, Visual C++ must be used to build
-WinVNC.
+If cross-compiling on a Unix/Linux system, then see the "Build Recipes" section
+below.
 
 
 Debug Build
 -----------
 
-Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line.  Or, if building with
-NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
-NMake.)
+Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line.
 
 
 Self-Contained GCC Build
@@ -292,9 +244,9 @@
 
 To build a fully portable, cross-compatible version of TigerVNC with
 high-performance JPEG support, it is necessary to link against the
-libjpeg-turbo static library.  This is also necessary when building TigerVNC on
-Windows or OS X.  To link against the libjpeg-turbo static library, first
-install the libjpeg-turbo SDK, which is available from
+libjpeg-turbo static library.  This is also necessary when building the
+Windows or OS X versions of TigerVNC.  To link against the libjpeg-turbo static
+library, first install the libjpeg-turbo SDK, which is available from
 https://sourceforge.net/projects/libjpeg-turbo/files/.  Next, use the
 JPEG_INCLUDE_DIR and JPEG_LIBRARY CMake variables to specify the location of
 libjpeg-turbo.  For example, adding
@@ -308,15 +260,7 @@
 with "lib32" or "lib64" to use the 32-bit or 64-bit version of the library on
 64-bit Linux platforms.
 
-Adding
-
-  -DJPEG_INCLUDE_DIR=c:\libjpeg-turbo[64]\include \
-    -DJPEG_LIBRARY=c:\libjpeg-turbo[64]\lib\jpeg-static.lib
-
-to the CMake command line will link TigerVNC against the static version of
-libjpeg-turbo provided by the libjpeg-turbo SDK for Visual C++.
-
-Adding
+When building on Windows systems, adding
 
   -DJPEG_INCLUDE_DIR=/c/libjpeg-turbo-gcc[64]/include \
     -DJPEG_LIBRARY=/c/libjpeg-turbo-gcc[64]/lib/libjpeg.a
@@ -366,11 +310,9 @@
 Building Native Language Support (NLS)
 ======================================
 
-NLS requires gettext, which is supplied with most Linux distributions but not
-with most other operating systems.  Building gettext from source is
-straightforward on Mac and other Unix variants, but on Windows it requires
-MinGW.  Thus, it is not possible to enable NLS when building TigerVNC with
-Visual C++.
+NLS requires gettext, which is supplied with most Linux distributions and
+with MinGW for Windows and which can easily be built from source on OS X and
+other Unix variants.
 
 You can override the ICONV_LIBRARIES and LIBINTL_LIBRARY CMake variables to
 specify the locations of libiconv and libintl, respectively.  For instance,
@@ -470,34 +412,6 @@
 to the CMake command line will cause TigerVNC to be statically linked against
 GnuTLS libraries that are installed under c:\gnutls.
 
-Note that the use of MinGW means that only the TigerVNC viewer can be built,
-not the server.
-
-
-Visual C++
-----------
-
-There is generally no sane way to build GnuTLS and its dependencies using
-Visual C++.  Thus, it is necessary to either build the libraries with MinGW (or
-download 32-bit versions of these from the link above), generate Visual C++
-import libraries from the DLLs, then link TigerVNC against the Visual C++
-import libraries.
-
-In the instructions below, {gnutls_path} indicates the path under which GnuTLS
-is installed (Example: c:\Program Files\GnuTLS-2.10.1).
-
-To generate Visual C++ import libraries:
-
-cd {gnutls_path}\lib
-lib /def:..\bin\libgnutls-{version}.def /out:libgnutls.lib
-
-Now, you can add the following arguments to the CMake command line:
-
-  -DGNUTLS_INCLUDE_DIR={gnutls_path}\include \
-    -DGNUTLS_LIBRARY={gnutls_path}\lib\libgnutls.lib
-
-to build TigerVNC against the GnuTLS DLLs installed under {gnutls_path}.
-
 
 ===================
 Installing TigerVNC
@@ -508,9 +422,8 @@
 
   -DCMAKE_INSTALL_PREFIX={install_directory}
 
-to the CMake command line.  Then, you can run 'make install' or 'nmake install'
-(or build the "install" target in the Visual Studio IDE) to build and install
-it.
+to the CMake command line.  Then, you can run 'make install' to build and
+install it.
 
 If you don't specify CMAKE_INSTALL_PREFIX, then the default is
 c:\Program Files\TigerVNC on Windows and /usr/local on Unix.
@@ -555,27 +468,10 @@
 Windows
 -------
 
-If using NMake:
+make installer
 
-  cd {build_directory}
-  nmake installer
-
-If using MinGW:
-
-  cd {build_directory}
-  make installer
-
-If using the Visual Studio IDE, build the "installer" project.
-
-The installer package (TigerVNC[64].exe) will be located under
-{build_directory}.  If building using the Visual Studio IDE, then the installer
-package will be located in a subdirectory with the same name as the
-configuration you built (such as {build_directory}\Debug\ or
-{build_directory}\Release\).
-
-NOTE:  If TigerVNC is built with TLS support, then the build system will
-attempt to package the GnuTLS DLLs into the Windows installer.  It looks for
-these DLLs in a directory called "bin" one level up from GNUTLS_INCLUDE_DIR.
+  Create a Windows installer using Inno Setup.  The installer package
+  (TigerVNC[64].exe) will be located under {build_directory}.
 
 
 =============
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c37868..fbd1dc9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,17 +28,13 @@
 add_definitions(-DPACKAGE_VERSION="${VERSION}")
 add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale")
 
-# Try to encode today's date into the build id. We assume that MSVC
-# means we need to use a native Windows method, otherwise we assume
-# some kind of Unix system. The id will be empty if things fail.
-set(BUILD "")
 if(MSVC)
-  execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmake/getdate.bat"
-    OUTPUT_VARIABLE BUILD)
-else()
-  execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
+  message(FATAL "TigerVNC cannot be built with Visual Studio.  Please use MinGW")
 endif()
 
+set(BUILD "")
+execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
+
 if(NOT BUILD)
   set(BUILD "")
 else()
@@ -53,8 +49,6 @@
 
 message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
 
-# This only works if building from the command line.  There is currently no way
-# to set a variable's value based on the build type when using the MSVC IDE.
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   set(BUILD "${BUILD}d")
 endif()
@@ -66,27 +60,6 @@
   set(BUILD_WINVNC 1)
 endif()
 
-if(MSVC)
-  # Use the static C library for all build types
-  foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
-    CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
-    CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
-    CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
-    if(${var} MATCHES "/MD")
-      string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
-    endif()
-  endforeach()
-
-  # NOTE: 4244 and 4267 are 64-bit to 32-bit conversion warnings, so normally
-  # it is not a good idea to disable them, but we do this to duplicate the
-  # behavior of GCC, which is less strict.
-  add_definitions(-wd4244 -wd4267 -wd4800 -wd4996)
-
-  # Avoid linker warning when doing Debug build if dependent libraries are
-  # linked with the Release version of the static C library.
-  set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:LIBCMT")
-endif()
-
 # Minimum version is Windows 2000 (5.0)
 if(WIN32)
   if(NOT CMAKE_SIZEOF_VOID_P MATCHES 8)
@@ -163,7 +136,7 @@
 
 # MinGW64 has header support but no library support for IActiveDesktop, so we
 # need to check for both the header and library and use our own implementation
-# in common/os if either doesn't exist.  MSVC should have both.
+# in common/os if either doesn't exist.
 if(WIN32)
   check_c_source_compiles("#include <windows.h>\n#include <wininet.h>\n#include <shlobj.h>\nint main(int c, char** v) {IActiveDesktop iad; return 0;}" HAVE_ACTIVE_DESKTOP_H)
   check_c_source_compiles("#include <windows.h>\n#include <wininet.h>\n#include <shlobj.h>\nint main(int c, char** v) {GUID i = CLSID_ActiveDesktop; return 0;}" HAVE_ACTIVE_DESKTOP_L)
@@ -228,9 +201,6 @@
 # Warn if it doesn't seem to be the accelerated libjpeg that's found
 set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
-if(MSVC)
-  set(CMAKE_REQUIRED_DEFINITIONS -MT)
-endif()
 
 set(JPEG_TEST_SOURCE "\n
   #include <stdio.h>\n
diff --git a/cmake/BuildPackages.cmake b/cmake/BuildPackages.cmake
index 100ba05..33043a3 100644
--- a/cmake/BuildPackages.cmake
+++ b/cmake/BuildPackages.cmake
@@ -15,14 +15,6 @@
   set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
 endif()
 
-if(MSVC_IDE)
-  set(INSTALLERDIR "$(OutDir)")
-  set(BUILDDIRDEF "-DBUILD_DIR=${INSTALLERDIR}\\")
-else()
-  set(INSTALLERDIR .)
-  set(BUILDDIRDEF "-DBUILD_DIR=")
-endif()
-
 set(INST_DEPS vncviewer)
 
 if(BUILD_WINVNC)
@@ -37,8 +29,7 @@
 configure_file(release/tigervnc.iss.in release/tigervnc.iss)
 
 add_custom_target(installer
-  iscc -o${INSTALLERDIR} ${INST_DEFS} ${BUILDDIRDEF} -F${INST_NAME}
-    release/tigervnc.iss
+  iscc -o. ${INST_DEFS} -DBUILD_DIR= -F${INST_NAME} release/tigervnc.iss
   DEPENDS ${INST_DEPS}
   SOURCES release/tigervnc.iss)
 
diff --git a/cmake/getdate.bat b/cmake/getdate.bat
deleted file mode 100644
index 09956ba..0000000
--- a/cmake/getdate.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-@echo off
-
-if "%1"=="javadate" date /t & goto end
-if "%1"=="javatime" time /t & goto end
-
-for /f "tokens=1-4 eol=/ DELIMS=/ " %%i in ('date /t') do set BUILD=%%l%%j%%k
-echo %BUILD%
-
-:end
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 4010aa6..9a8a612 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -14,15 +14,8 @@
 set(JAVA_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/${CLASSPATH})
 set(JAVA_BINDIR ${CMAKE_CURRENT_BINARY_DIR}/${CLASSPATH})
 
-if(MSVC)
-  execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmake/getdate.bat" "javadate"
-    OUTPUT_VARIABLE JAVA_DATE)
-  execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmake/getdate.bat" "javatime"
-    OUTPUT_VARIABLE JAVA_TIME)
-else()
-  execute_process(COMMAND "date" "+%b %d %Y" OUTPUT_VARIABLE JAVA_DATE)
-  execute_process(COMMAND "date" "+%H:%M:%S" OUTPUT_VARIABLE JAVA_TIME)
-endif()
+execute_process(COMMAND "date" "+%b %d %Y" OUTPUT_VARIABLE JAVA_DATE)
+execute_process(COMMAND "date" "+%H:%M:%S" OUTPUT_VARIABLE JAVA_TIME)
 string(REGEX REPLACE "\n" "" JAVA_DATE ${JAVA_DATE})
 string(REGEX REPLACE "\n" "" JAVA_TIME ${JAVA_TIME})
 
@@ -40,18 +33,12 @@
   UserPrefs
   VncViewer)
 
-if(MSVC_IDE)
-  set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/$(OutDir)")
-else()
-  set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
 set(JAVA_SOURCES "")
 set(JAVA_CLASSES_FULL "")
 foreach(class ${JAVA_CLASSNAMES})
   set(JAVA_SOURCES ${JAVA_SOURCES} ${JAVA_SRCDIR}/${class}.java)
   set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL}
-    ${OBJDIR}/${CLASSPATH}/${class}.class)
+    ${CMAKE_CURRENT_BINARY_DIR}/${CLASSPATH}/${class}.class)
 endforeach()
 
 file(GLOB DEPEND_SOURCES
@@ -63,7 +50,8 @@
 add_custom_command(OUTPUT ${JAVA_CLASSES_FULL}
   DEPENDS ${JAVA_SOURCES} ${DEPEND_SOURCES}
   COMMAND ${JAVA_COMPILE}
-  ARGS ${JAVACFLAGS} -cp ${CMAKE_CURRENT_SOURCE_DIR} -d ${OBJDIR} ${JAVA_SOURCES})
+  ARGS ${JAVACFLAGS} -cp ${CMAKE_CURRENT_SOURCE_DIR}
+    -d ${CMAKE_CURRENT_BINARY_DIR} ${JAVA_SOURCES})
 
 configure_file(${CLASSPATH}/timestamp.in ${CLASSPATH}/timestamp)
 
@@ -99,8 +87,7 @@
   COMMAND ${CMAKE_COMMAND}
   ARGS -DJava_PATH=${Java_PATH}
     -DJAR_FILE=${CMAKE_CURRENT_BINARY_DIR}/VncViewer.jar
-    -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/SignJar.cmake
-  WORKING_DIRECTORY ${OBJDIR})
+    -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/SignJar.cmake)
 
 add_custom_target(java ALL DEPENDS VncViewer.jar)
 
diff --git a/release/tigervnc.iss.in b/release/tigervnc.iss.in
index 68d69df..71632b1 100644
--- a/release/tigervnc.iss.in
+++ b/release/tigervnc.iss.in
@@ -27,12 +27,6 @@
 Source: "@CMAKE_CURRENT_BINARY_DIR@\vncviewer\{#BUILD_DIR}vncviewer.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace; 
 Source: "@CMAKE_SOURCE_DIR@\README.txt"; DestDir: "{app}"; Flags: ignoreversion
 Source: "@CMAKE_SOURCE_DIR@\LICENCE.TXT"; DestDir: "{app}"; Flags: ignoreversion
-#ifdef HAVE_GNUTLS
-Source: "@GNUTLS_INCLUDE_DIRS@\..\bin\libgnutls-*.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "@GNUTLS_INCLUDE_DIRS@\..\bin\libgcrypt-*.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "@GNUTLS_INCLUDE_DIRS@\..\bin\libtasn1-*.dll"; DestDir: "{app}"; Flags: ignoreversion
-Source: "@GNUTLS_INCLUDE_DIRS@\..\bin\libgpg-error-*.dll"; DestDir: "{app}"; Flags: ignoreversion
-#endif
 
 
 [Icons]
diff --git a/win/vncconfig/CMakeLists.txt b/win/vncconfig/CMakeLists.txt
index 9883dbd..2cee4ee 100644
--- a/win/vncconfig/CMakeLists.txt
+++ b/win/vncconfig/CMakeLists.txt
@@ -1,10 +1,5 @@
 include_directories(${CMAKE_BINARY_DIR}/win)
 
-# Disable auto-generated manifests, since we have our own
-if(MSVC)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
-endif()
-
 add_executable(vncconfig WIN32
   Legacy.cxx
   PasswordDialog.cxx
diff --git a/win/winvnc/CMakeLists.txt b/win/winvnc/CMakeLists.txt
index dd9117b..72a007b 100644
--- a/win/winvnc/CMakeLists.txt
+++ b/win/winvnc/CMakeLists.txt
@@ -1,19 +1,12 @@
 include_directories(${CMAKE_BINARY_DIR}/win ${CMAKE_CURRENT_SOURCE_DIR})
 
-# Disable auto-generated manifests, since we have our own
-if(MSVC)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
-endif()
-
 add_library(wm_hooks SHARED
   ../wm_hooks/wm_hooks.cxx
   ../wm_hooks/wm_hooks.def
   ../wm_hooks/wm_hooks.rc)
 
 # We want the DLL to be named wm_hooks.dll rather than libwm_hooks.dll
-if(MINGW)
-  set_target_properties(wm_hooks PROPERTIES PREFIX "")
-endif()
+set_target_properties(wm_hooks PROPERTIES PREFIX "")
 
 set(VNCVIEWER_JAR_PATH ${CMAKE_BINARY_DIR}/java/VncViewer.jar)
 set(INDEX_VNC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/index.vnc)