Search code examples
visual-studio-2010msbuildcmakedevenv

Portable Visual Studio 2010 and cmake


Good day everyone,

I'm trying to do the following:

1) Create portable version of Microsoft Visual Studio (vs2010 sp1) + platform SDK (winsdk 7.0a).
2) Drop those files on a machine, run cmake on the project and build the project
I'm assuming machines have .net framework 4.0, VS 2010 win32/x64 redistributables installed to the default location.

VS 2010 files:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
I put them into the d:\distr\msvc100sp1 directory.

WinSDK files:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A
I put them into the d:\distr\WinSDK\7.0a directory

I'm running this script before doing anything - it recreates environment exactly if vcvars (in this case amd64) was called:

@set NV_MSVC100INSTALLDIR=d:\distr\msvc100sp1
@set NV_WINSDK_70A=d:\distr\WinSDK\7.0a

@set CommandPromptType=Native
@set INCLUDE=%NV_MSVC100INSTALLDIR%\VC\INCLUDE;%NV_MSVC100INSTALLDIR%\VC\ATLMFC\INCLUDE;%NV_WINSDK_70A%\include;
@set LIB=%NV_MSVC100INSTALLDIR%\VC\LIB\amd64;%NV_MSVC100INSTALLDIR%\VC\ATLMFC\LIB\amd64;%NV_WINSDK_70A%\lib\x64;
@set LIBPATH=%NV_MSVC100INSTALLDIR%\VC\LIB\amd64;%NV_MSVC100INSTALLDIR%\VC\ATLMFC\LIB\amd64;
@set PATH=%NV_MSVC100INSTALLDIR%\VC\bin\amd64;%NV_MSVC100INSTALLDIR%\VC\VCPackages;%NV_MSVC100INSTALLDIR%\Common7\IDE;%NV_MSVC100INSTALLDIR%\Common7\Tools;%NV_WINSDK_70A%\bin\NETFX 4.0 Tools\x64;%NV_WINSDK_70A%\bin\x64;%NV_WINSDK_70A%\bin;%PATH%
@set Platform=x64
@set VCINSTALLDIR=%NV_MSVC100INSTALLDIR%\VC\
@set VSINSTALLDIR=%NV_MSVC100INSTALLDIR%\
@set WindowsSdkDir=%NV_WINSDK_70A%\
@set PROCESSOR_ARCHITECTURE=AMD64
@set VS100COMNTOOLS=%NV_MSVC100INSTALLDIR%\Common7\Tools

::framework

@set Framework35Version=v3.5
@set FrameworkDir=C:\Windows\Microsoft.NET\Framework64
@set FrameworkDIR64=C:\Windows\Microsoft.NET\Framework64
@set FrameworkVersion=v4.0.30319
@set FrameworkVersion64=v4.0.30319

@set NV_FRAMEWORK_INSTALL_DIR=%FrameworkDIR64%\%FrameworkVersion64%

@set LIBPATH=%NV_FRAMEWORK_INSTALL_DIR%;%NV_FRAMEWORK_INSTALL_DIR%\..\v3.5;%LIBPATH%
@set PATH=%NV_FRAMEWORK_INSTALL_DIR%;%NV_FRAMEWORK_INSTALL_DIR%\..\v3.5;%PATH%

However running devenv (it's on the path after script above) i'm getting this error:

Cannot find one or more components. Please reinstall the application.

I thought cmake could figure out what to do with compiler, but it complains on compiler version checking:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
  execute_process given COMMAND argument with no value.
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:9 (project)


The C compiler identification is unknown
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
  execute_process given COMMAND argument with no value.
    Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:9 (project)

The CXX compiler identification is unknown
Configuring incomplete, errors occurred!
See also "d:/vs2010_test/build/CMakeFiles/CMakeOutput.log".
See also "d:/vs2010_test/build/CMakeFiles/CMakeError.log".

There is same error in the output file about missing components.

Is the desired thing even possible? What are possible missing components?
What i'd like to have is to perform what i want and then clean up machine automatically, even if it will require registry keys changes.


Solution

  • Thanks to comments i figured out that there are definitely a lot of system files/registry keys that are requested by both msbuild and devenv. For me it's not worth to try to satisfy those needs and i will try to find other ways around to complete my build tasks.