From 9cbb9987371627841a8c508c0880f901a78e844a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 17 Sep 2007 15:21:47 -0400 Subject: ENH: add support for vs 2008 beta 2 --- Modules/CMakeVS8FindMake.cmake | 1 + Modules/CMakeVS9FindMake.cmake | 16 +++++++ Modules/Platform/Windows-cl.cmake | 22 +++++++--- Source/CMakeLists.txt | 2 + Source/MFCDialog/StdAfx.h | 3 +- Source/cmGlobalVisualStudio9Generator.cxx | 61 +++++++++++++++++++++++++++ Source/cmGlobalVisualStudio9Generator.h | 55 ++++++++++++++++++++++++ Source/cmLocalVisualStudio7Generator.cxx | 13 ++---- Source/cmLocalVisualStudio7Generator.h | 1 + Source/cmake.cxx | 3 ++ Utilities/cmcurl/CMake/CurlTests.c | 5 ++- Utilities/cmcurl/Platforms/WindowsCache.cmake | 1 - Utilities/cmcurl/select.h | 7 +-- 13 files changed, 167 insertions(+), 23 deletions(-) create mode 100644 Modules/CMakeVS9FindMake.cmake create mode 100644 Source/cmGlobalVisualStudio9Generator.cxx create mode 100644 Source/cmGlobalVisualStudio9Generator.h diff --git a/Modules/CMakeVS8FindMake.cmake b/Modules/CMakeVS8FindMake.cmake index 79aa5a8..d6ca4aa 100644 --- a/Modules/CMakeVS8FindMake.cmake +++ b/Modules/CMakeVS8FindMake.cmake @@ -13,3 +13,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC80 1) +SET(MSVC_VERSION 1400) diff --git a/Modules/CMakeVS9FindMake.cmake b/Modules/CMakeVS9FindMake.cmake new file mode 100644 index 0000000..a2c8e72 --- /dev/null +++ b/Modules/CMakeVS9FindMake.cmake @@ -0,0 +1,16 @@ +FIND_PROGRAM(CMAKE_MAKE_PROGRAM + NAMES VCExpress devenv + PATHS + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup\\VS;EnvironmentDirectory] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\9.0\\Setup;Dbghelp_path] + "$ENV{ProgramFiles}/Microsoft Visual Studio .NET/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio 9/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio9/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio .NET/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 9/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio9/Common7/IDE" + "/Program Files/Microsoft Visual Studio 9/Common7/IDE/" + ) +MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) +SET(MSVC90 1) +SET(MSVC_VERSION 1500) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 0c8e718..c9b2822 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -13,16 +13,20 @@ SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") SET (CMAKE_NO_BUILD_TYPE 1) ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") SET (CMAKE_NO_BUILD_TYPE 1) SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") MARK_AS_ADVANCED(CMAKE_CONFIGURATION_TYPES) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") +ENDIF(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") # does the compiler support pdbtype and is it the newer compiler IF(CMAKE_GENERATOR MATCHES "Visual Studio 8") SET(CMAKE_COMPILER_2005 1) ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8") +IF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + SET(CMAKE_COMPILER_2005 1) +ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 9") + # make sure to enable languages after setting configuration types ENABLE_LANGUAGE(RC) @@ -87,6 +91,14 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") SET(MSVC80 1) SET(CMAKE_COMPILER_2005 1) ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1400) + SET(MSVC80 1) + SET(CMAKE_COMPILER_2005 1) + ENDIF("${compilerVersion}" GREATER 1400) + IF("${compilerVersion}" GREATER 1500) + SET(MSVC90 1) + SET(MSVC80 0) + ENDIF("${compilerVersion}" GREATER 1500) SET(MSVC_VERSION "${compilerVersion}") ELSE(NOT CMAKE_COMPILER_RETURN) MESSAGE(STATUS "Check for CL compiler version - failed") @@ -154,7 +166,7 @@ ENDIF(CMAKE_FORCE_WIN64) # default to Debug builds -IF(MSVC80) +IF(MSVC_VERSION GREATER 1310) # Not used by generator directly but referenced below. SET(CMAKE_CREATE_LIB_MANIFEST "$(CMAKE_COMMAND) -DTARGET= -DCMAKE_CL_NOLOGO=${CMAKE_CL_NOLOGO} -P \"${CMAKE_ROOT}/Modules/CMakeVCManifest.cmake\"") @@ -188,7 +200,7 @@ IF(MSVC80) SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /MANIFEST") -ELSE(MSVC80) +ELSE(MSVC_VERSION GREATER 1310) IF(CMAKE_USING_VC_FREE_TOOLS) MESSAGE(STATUS "Using FREE VC TOOLS, NO DEBUG available") SET(CMAKE_BUILD_TYPE_INIT Release) @@ -217,7 +229,7 @@ ELSE(MSVC80) SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") ENDIF(CMAKE_USING_VC_FREE_TOOLS) -ENDIF(MSVC80) +ENDIF(MSVC_VERSION GREATER 1310) SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 31bb4fb..23bbd8f 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -213,6 +213,8 @@ IF (WIN32) cmGlobalVisualStudio7Generator.h cmGlobalVisualStudio8Generator.cxx cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio9Generator.cxx + cmGlobalVisualStudio9Generator.h cmGlobalVisualStudio8Win64Generator.cxx cmGlobalVisualStudio8Win64Generator.h cmGlobalVisualStudioGenerator.cxx diff --git a/Source/MFCDialog/StdAfx.h b/Source/MFCDialog/StdAfx.h index 6169ea9..b939926 100644 --- a/Source/MFCDialog/StdAfx.h +++ b/Source/MFCDialog/StdAfx.h @@ -21,7 +21,8 @@ #if !defined(AFX_STDAFX_H__AC17A6F8_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_) #define AFX_STDAFX_H__AC17A6F8_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_ -#define WINVER 0x0400 +#define _WIN32_WINNT 0x0400 +#define _WIN32_IE 0x0400 #if _MSC_VER > 1000 #pragma once diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx new file mode 100644 index 0000000..1a1981a --- /dev/null +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -0,0 +1,61 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "windows.h" // this must be first to define GetCurrentDirectory +#include "cmGlobalVisualStudio9Generator.h" +#include "cmLocalVisualStudio7Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + + + +cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() +{ + this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; +} + + +void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) +{ + fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; + fout << "# Visual Studio 2008\n"; +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator; + lg->SetVersion9(); + lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); + lg->SetGlobalGenerator(this); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio9Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.name = this->GetName(); + entry.brief = "Generates Visual Studio 9 2008 project files."; + entry.full = ""; +} + +void cmGlobalVisualStudio9Generator +::EnableLanguage(std::vectorconst & lang, + cmMakefile *mf, bool optional) +{ + cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); +} diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h new file mode 100644 index 0000000..565d762 --- /dev/null +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -0,0 +1,55 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmGlobalVisualStudio9Generator_h +#define cmGlobalVisualStudio9Generator_h + +#include "cmGlobalVisualStudio8Generator.h" + + +/** \class cmGlobalVisualStudio9Generator + * \brief Write a Unix makefiles. + * + * cmGlobalVisualStudio9Generator manages UNIX build process for a tree + */ +class cmGlobalVisualStudio9Generator : + public cmGlobalVisualStudio8Generator +{ +public: + cmGlobalVisualStudio9Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio9Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio9Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 9 2008";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vectorconst& languages, + cmMakefile *, bool optional); + virtual void WriteSLNHeader(std::ostream& fout); +}; +#endif diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5f9ab7a..4893012 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -609,7 +609,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // manifest tool to use a workaround for FAT32 file systems, which can cause // an empty manifest to be embedded into the resulting executable. // See CMake bug #2617. - if ( this->Version == 8 ) + if ( this->Version > 8 ) { fout << "\t\t\tVersion == 8) - { - fout << "\tVersion=\"8.00\"\n"; - } - else - { - fout << "\tVersion=\"7.00\"\n"; - } + fout << "\tVersion=\"" << this->Version << ".00\"\n"; } const char* projLabel = target.GetProperty("PROJECT_LABEL"); if(!projLabel) @@ -1456,7 +1449,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); fout << "\tName=\"" << projLabel << "\"\n"; - if(this->Version == 8) + if(this->Version > 8) { fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 508c368..0ed9d28 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -57,6 +57,7 @@ public: void SetVersion71() {this->Version = 71;} void SetVersion8() {this->Version = 8;} + void SetVersion9() {this->Version = 9;} void SetPlatformName(const char* n) { this->PlatformName = n;} virtual void ConfigureFinalPass(); void GetTargetObjectFileDirectories(cmTarget* target, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bc1d381..d6dd6a6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -62,6 +62,7 @@ # include "cmGlobalVisualStudio7Generator.h" # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" +# include "cmGlobalVisualStudio9Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" @@ -2153,6 +2154,8 @@ void cmake::AddDefaultGenerators() &cmGlobalVisualStudio71Generator::New; this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = &cmGlobalVisualStudio8Generator::New; + this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = + &cmGlobalVisualStudio9Generator::New; this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = &cmGlobalVisualStudio8Win64Generator::New; this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = diff --git a/Utilities/cmcurl/CMake/CurlTests.c b/Utilities/cmcurl/CMake/CurlTests.c index fed3894..c5ba7c2 100644 --- a/Utilities/cmcurl/CMake/CurlTests.c +++ b/Utilities/cmcurl/CMake/CurlTests.c @@ -306,9 +306,12 @@ gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); } #endif #ifdef HAVE_SOCKLEN_T +#ifdef _WIN32 +#include +#else #include #include - +#endif int main () { diff --git a/Utilities/cmcurl/Platforms/WindowsCache.cmake b/Utilities/cmcurl/Platforms/WindowsCache.cmake index 1e115c1..b4515ce 100644 --- a/Utilities/cmcurl/Platforms/WindowsCache.cmake +++ b/Utilities/cmcurl/Platforms/WindowsCache.cmake @@ -106,7 +106,6 @@ IF(NOT UNIX) SET(TIME_WITH_SYS_TIME 0) SET(HAVE_O_NONBLOCK 0) SET(HAVE_IN_ADDR_T 0) - SET(HAVE_SOCKLEN_T 0) SET(HAVE_INET_NTOA_R_DECL 0) SET(HAVE_INET_NTOA_R_DECL_REENTRANT 0) SET(HAVE_GETADDRINFO 0) diff --git a/Utilities/cmcurl/select.h b/Utilities/cmcurl/select.h index e0844b1..7573b1f 100644 --- a/Utilities/cmcurl/select.h +++ b/Utilities/cmcurl/select.h @@ -25,12 +25,8 @@ #ifdef HAVE_SYS_POLL_H #include -#elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) -/* for Vista, use WSAPoll(). */ -#include -#define CURL_HAVE_WSAPOLL #else - +#ifndef POLLIN #define POLLIN 0x01 #define POLLPRI 0x02 #define POLLOUT 0x04 @@ -44,6 +40,7 @@ struct pollfd short events; short revents; }; +#endif #endif -- cgit v0.12