Overview
Features
Download
Documentation
Community
Add-Ons & Services

Building POCO with MSBuild

Please post support and help requests here.

Building POCO with MSBuild

Postby raulgd » 05 Jul 2012, 19:37

Hi everyone,

Does anyone know if there's a way for building POCO with MSBuild from the Windows SDK 7.1 CLI instead of having to install VS Express or MSVC2010?

I read here: http://msdn.microsoft.com/en-us/library/ff660764.aspx that there is a way using SetEnv.cmd and some other stuff to call vsprojs and slns but I don't really understand how the poco buildwin.cmd works.

I'm trying to write a small POCO tutorial with pure open source tools, but for multiplatform use, I was expecting the users to use Qt Creator as the IDE, and on windows use the Windows SDK with the x64 compilers.

Any help here? thanks!
raulgd
 
Posts: 19
Joined: 11 Mar 2011, 03:35
Location: Mexico

Re: Building POCO with MSBuild

Postby alex » 05 Jul 2012, 22:16

buildwin.cmd is using devenv.exe. I'm not sure what obstacles you may encounter with MSBuild, but we'd welcome the effort of adding MSBuild projects generation in POCO ProGen.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Building POCO with MSBuild

Postby raulgd » 05 Jul 2012, 23:38

What is ProGen? that folder is not in the zip download.
raulgd
 
Posts: 19
Joined: 11 Mar 2011, 03:35
Location: Mexico

Re: Building POCO with MSBuild

Postby alex » 06 Jul 2012, 02:36

It is POCO Project Generator. Takes a template VS project or solution (ver <= 2008) and generates other versions of projects/solutions. Code is in the SVN trunk.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Building POCO with MSBuild

Postby raulgd » 06 Jul 2012, 16:31

So it's like Premake but "in-house"

Ok, but still, I modified buildwin.cmd and managed to run the build commands for MSBuild, the problem now is that the project files are looking for MFC libraries (afxres.h, afxwin.h and others) that the Windows SDK doesn't have by default, so I'm now trying to figure out what to do to be able to resolve those dependencies. In a forum I found that instead of including directly those headers, that there should only be <windows.h> instead and that would resolve all of that, but I don't have a way to do that, I don't have MSVC professional nor express installed.

EDIT: by the way, I think that instead of using devenv or vcexpress for buildwin, we should only use MSBuild, as that would make the build script a lot easier to maintain, it will also make the build less dependable on having a specific IDE installed (which will help using something like premake to automatically generate windows solution files, project files and unix make files), and simplifies things for the CLI build process.

If someone wants to see how the buildwin.cmd modifications work, let me know, I'll post the file

EDIT 2: I found out why MFC is not included, and that's because MFC only exists in Win32 for the moment, there's no good support in x64, and because my machine is x64, the Windows SDK 7 only allows me to install the x64 SDK for my platform, that means it doesn't have the good MFC support, perhaps with a Win32 machine I wouldn't have those MFC issues.
raulgd
 
Posts: 19
Joined: 11 Mar 2011, 03:35
Location: Mexico

Re: Building POCO with MSBuild

Postby alex » 06 Jul 2012, 19:57

raulgd wrote:So it's like Premake but "in-house"

Yes, Premake did not know how to generate the filters. Now allegedly it can but generation of WinCE projects is not supported. Thus ProGen.
raulgd wrote:Ok, but still, I modified buildwin.cmd and managed to run the build commands for MSBuild, the problem now is that the project files are looking for MFC libraries (afxres.h, afxwin.h and others) that the Windows SDK doesn't have by default, so I'm now trying to figure out what to do to be able to resolve those dependencies. In a forum I found that instead of including directly those headers, that there should only be <windows.h> instead and that would resolve all of that, but I don't have a way to do that, I don't have MSVC professional nor express installed.

MFC is only needed for CppUnit window. If that is a showstopper, CppUnit can easily be modified to run on command line (like we run the posix version) but it will require some work. Let us know if you need any help.
raulgd wrote:EDIT: by the way, I think that instead of using devenv or vcexpress for buildwin, we should only use MSBuild, as that would make the build script a lot easier to maintain, it will also make the build less dependable on having a specific IDE installed (which will help using something like premake to automatically generate windows solution files, project files and unix make files), and simplifies things for the CLI build process.

I agree. We do, however, want to keep on shipping VS projects which are indispensable for Windows developers.
raulgd wrote:If someone wants to see how the buildwin.cmd modifications work, let me know, I'll post the file

Sure, upload it here or as a SF feature request.
raulgd wrote:EDIT 2: I found out why MFC is not included, and that's because MFC only exists in Win32 for the moment, there's no good support in x64, and because my machine is x64, the Windows SDK 7 only allows me to install the x64 SDK for my platform, that means it doesn't have the good MFC support, perhaps with a Win32 machine I wouldn't have those MFC issues.

I see; I guess some ifdef-ing could solve problems of that kind.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Building POCO with MSBuild

Postby raulgd » 08 Jul 2012, 21:02

alex wrote:MFC is only needed for CppUnit window. If that is a showstopper, CppUnit can easily be modified to run on command line (like we run the posix version) but it will require some work. Let us know if you need any help.

Yes, it's kind of a showstopper for the kind of things I want to achieve, which is a complete open source development environment without depending on any specific IDE.
alex wrote:
raulgd wrote:EDIT: by the way, I think that instead of using devenv or vcexpress for buildwin, we should only use MSBuild, as that would make the build script a lot easier to maintain, it will also make the build less dependable on having a specific IDE installed (which will help using something like premake to automatically generate windows solution files, project files and unix make files), and simplifies things for the CLI build process.

I agree. We do, however, want to keep on shipping VS projects which are indispensable for Windows developers.

Yes, you still need to ship the VS projects because MSBuild uses the solution and project files (.sln and .vcproj or .vxproj) for building the projects, so it's kind of building from the VS IDE without depending on having the actual IDE installed, also, MSBuild supports parallel builds and multicore CPUs, so it can even be faster to build from MSBuild than from the IDE (either IDE GUI or CLI).
alex wrote:
raulgd wrote:If someone wants to see how the buildwin.cmd modifications work, let me know, I'll post the file

Sure, upload it here or as a SF feature request.

I'll upload the file tomorrow, as today I'm on my home computer and the build file is on my work computer.
alex wrote:
raulgd wrote:EDIT 2: I found out why MFC is not included, and that's because MFC only exists in Win32 for the moment, there's no good support in x64, and because my machine is x64, the Windows SDK 7 only allows me to install the x64 SDK for my platform, that means it doesn't have the good MFC support, perhaps with a Win32 machine I wouldn't have those MFC issues.

I see; I guess some ifdef-ing could solve problems of that kind.

Ok, If you know where to put those ifdefs then I would really appreciate it.

Thanks
raulgd
 
Posts: 19
Joined: 11 Mar 2011, 03:35
Location: Mexico

Re: Building POCO with MSBuild

Postby alex » 09 Jul 2012, 05:07

raulgd wrote:Ok, If you know where to put those ifdefs then I would really appreciate it.

Here are the steps to avoid the problem with missing MFC on any Windows OS:

  • Do not build CppUnit/WinTestRunner project (that's the only component using MFC)
  • For every library (Foundation, XML, Util, etc), in the testsuite do something along these lines:
Code: Select all
#ifdef POCO_WIN_TEST_RUNNER // this define should be added in the Config.h
#include "WinTestRunner/WinTestRunner.h"
#include "FoundationTestSuite.h"

class TestDriver: public CppUnit::WinTestRunnerApp
{
   void TestMain()
   {
      CppUnit::WinTestRunner runner;
      runner.addTest(FoundationTestSuite::suite());
      runner.run();
   }
};

TestDriver theDriver;
#else // POCO_WIN_TEST_RUNNER
#include "CppUnit/TestRunner.h"
#include "FoundationTestSuite.h"

CppUnitMain(FoundationTestSuite)
#endif // POCO_WIN_TEST_RUNNER

I did not compile the above but that's the general idea. It should result in a command line testsuite executable and no MFC dependency at all.
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Building POCO with MSBuild

Postby raulgd » 09 Jul 2012, 17:48

Ok, here's the buildwin.cmd modification for using MSBuild.

Hope it's of any help to POCO, at least to feel at last I contributed with something ;)

The forum doesn't allow me to upload any files, do you think there's some problem with the forum software?

I'll post the buildwin file as code:

EDIT: It seems at last I managed to compile with the 64bit MFC without changing anything!, I added some parameters to msbuild and it seems to be working! if someone else can please help me test by using the windows 7 SDK 7.1 and with my buildwin with the command: buildwin msbuild 100 build all both x64 samples or buildwin msbuild 100 build all both Win32 samples And post the results, I would be really thankful!

EDIT 2: I updated the msbuildwin to work around a bug I found in a forum when building with msbuild in MSVC2005 solutions, I replaced /p:VCBuildUserEnvironment=true with /p:VCBuildAdditionalOptions="/useenv" because of a typo that msbuild 2005 had when passing the environment variables.
If there are any users from MSVC2005 please try and let me know if it worked.

Code: Select all
@echo off
setlocal

rem
rem buildwin.cmd
rem
rem POCO C++ Libraries command-line build script
rem for MS Visual Studio 2003 to 2010
rem
rem $Id: //poco/1.4/dist/buildwin.cmd#2 $
rem
rem Copyright (c) 2006-2010 by Applied Informatics Software Engineering GmbH
rem and Contributors.
rem
rem Original version by Aleksandar Fabijanic.
rem Modified by Guenter Obiltschnig.
rem
rem Usage:
rem ------
rem buildwin DEVENV VS_VERSION [ACTION] [LINKMODE] [CONFIG] [PLATFORM] [SAMPLES]
rem DEVENV:     devenv|vcexpress|msbuild
rem VS_VERSION: 71|80|90|100
rem ACTION:     build|rebuild|clean
rem LINKMODE:   static_mt|static_md|shared|all
rem CONFIG:     release|debug|both
rem PLATFORM:   Win32|x64|WinCE
rem SAMPLES:    samples|nosamples

rem
rem DEVENV and VS_VERSION are required arguments. Default is build all.

rem Change OPENSSL_DIR to match your setup
set OPENSSL_DIR=C:\OpenSSL-Win32
set OPENSSL_INCLUDE=%OPENSSL_DIR%\include
set OPENSSL_LIB=%OPENSSL_DIR%\lib\VC
set INCLUDE=%INCLUDE%;%OPENSSL_INCLUDE%
set LIB=%LIB%;%OPENSSL_LIB%

rem Change MYSQL_DIR to match your setup
set MYSQL_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.5
set MYSQL_INCLUDE=%MYSQL_DIR%\include
set MYSQL_LIB=%MYSQL_DIR%\lib
set INCLUDE=%INCLUDE%;%MYSQL_INCLUDE%
set LIB=%LIB%;%MYSQL_LIB%

set POCO_BASE=%CD%
set PATH=%POCO_BASE%\bin;%PATH%

rem Build environment
set BUILD_TOOL="%1"

rem if not msbuild, validate that there is a VS environment
if %BUILD_TOOL%=="msbuild" (
   if not defined WindowsSdkDir (
   echo Error: No Windows SDK environment found.
   echo Please run this script from a Windows SDK Command Prompt
   goto :EOF)
) else (
   if not defined VCINSTALLDIR (
   echo Error: No Visual C++ environment found.
   echo Please run this script from a Visual Studio Command Prompt
   echo or run "%%VSnnCOMNTOOLS%%\vcvars32.bat" first.
   goto :EOF)
)

rem VS version {71|80|90|100}
if "%2"=="" goto usage
set VS_VERSION=vs%2

rem Action [build|rebuild|clean]
set ACTION=%3
if not "%ACTION%"=="build" (
if not "%ACTION%"=="rebuild" (
if not "%ACTION%"=="" (
if not "%ACTION%"=="clean" goto usage)))

if "%ACTION%"=="" (set ACTION="build")

rem Link mode [static|shared|both]
set LINK_MODE=%4
if not "%LINK_MODE%"=="static_mt" (
if not "%LINK_MODE%"=="static_md" (
if not "%LINK_MODE%"=="shared" (
if not "%LINK_MODE%"=="" (
if not "%LINK_MODE%"=="all" goto usage))))

rem Configuration [release|debug|both]
set CONFIGURATION=%5
if not "%CONFIGURATION%"=="release" (
if not "%CONFIGURATION%"=="debug" (
if not "%CONFIGURATION%"=="" (
if not "%CONFIGURATION%"=="both" goto usage)))

rem Platform [Win32|x64|WinCE]
set PLATFORM=%6%

if not "%PLATFORM%"=="" (
if not "%PLATFORM%"=="Win32" (
if not "%PLATFORM%"=="x64" (
if not "%PLATFORM%"=="WinCE" goto usage)))

if "%PLATFORM%"=="" (set PLATFORM_SUFFIX=) else (
if "%PLATFORM%"=="Win32" (set PLATFORM_SUFFIX=) else (
if "%PLATFORM%"=="x64" (set PLATFORM_SUFFIX=_x64) else (
if "%PLATFORM%"=="WinCE" (set PLATFORM_SUFFIX=_CE))))

rem Samples [samples|nosamples]
set SAMPLES=%7
if "%SAMPLES%"=="" (set SAMPLES=samples)

set DEBUG_SHARED=0
set RELEASE_SHARED=0
set DEBUG_STATIC_MT=0
set RELEASE_STATIC_MT=0
set DEBUG_STATIC_MD=0
set RELEASE_STATIC_MD=0

if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="release" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_SHARED=1))))

if "%LINK_MODE%"=="shared" (
if "%CONFIGURATION%"=="debug" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_SHARED=1))))

if "%LINK_MODE%"=="static_mt" (
if "%CONFIGURATION%"=="release" (set RELEASE_STATIC_MT=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_STATIC_MT=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_STATIC_MT=1))))

if "%LINK_MODE%"=="static_md" (
if "%CONFIGURATION%"=="release" (set RELEASE_STATIC_MD=1) else (
if "%CONFIGURATION%"=="both" (set RELEASE_STATIC_MD=1) else (
if "%CONFIGURATION%"=="" (set RELEASE_STATIC_MD=1))))

if "%LINK_MODE%"=="static_mt" (
if "%CONFIGURATION%"=="debug" (set DEBUG_STATIC_MT=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_STATIC_MT=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_STATIC_MT=1))))

if "%LINK_MODE%"=="static_md" (
if "%CONFIGURATION%"=="debug" (set DEBUG_STATIC_MD=1) else (
if "%CONFIGURATION%"=="both" (set DEBUG_STATIC_MD=1) else (
if "%CONFIGURATION%"=="" (set DEBUG_STATIC_MD=1))))

if "%LINK_MODE%"=="all" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1)))))

if "%LINK_MODE%"=="" (
if "%CONFIGURATION%"=="debug" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1) else (
if "%CONFIGURATION%"=="release" (
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="both" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1) else (
if "%CONFIGURATION%"=="" (
set DEBUG_STATIC_MT=1
set DEBUG_STATIC_MD=1
set DEBUG_SHARED=1
set RELEASE_STATIC_MT=1
set RELEASE_STATIC_MD=1
set RELEASE_SHARED=1)))))

echo.
echo.
echo ########################################################################
echo ####
echo #### STARTING VISUAL STUDIO BUILD (%VS_VERSION%, %PLATFORM%)
echo ####
echo ########################################################################
echo.
echo.
echo The following configurations will be built:

if %DEBUG_SHARED%==1      (echo debug_shared)
if %RELEASE_SHARED%==1    (echo release_shared)
if %DEBUG_STATIC_MT%==1   (echo debug_static_mt)
if %DEBUG_STATIC_MD%==1   (echo debug_static_md)
if %RELEASE_STATIC_MT%==1 (echo release_static_mt)
if %RELEASE_STATIC_MD%==1 (echo release_static_md)

rem build for up to 4 levels deep
for /f %%G in ('findstr /R "." components') do (
 if exist %%G (
  cd %%G
  for /f "tokens=1,2,3,4 delims=/" %%Q in ("%%G") do (
   if exist %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
    echo.
    echo.
    echo ########################################################################
    echo ####
    echo #### Building %%G
    echo ####
    echo ########################################################################
    echo.
   if %BUILD_TOOL%=="msbuild" (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
   ) else (
    if %DEBUG_SHARED%==1      (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% /useenv /%ACTION% release_shared %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_mt %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_mt %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_md %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_md %%Q%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
   )
   )

   if exist %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
    echo.
    echo.
    echo ########################################################################
    echo ####
    echo #### Building %%G
    echo ####
    echo ########################################################################
    echo.
   if %BUILD_TOOL%=="msbuild" (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
   ) else (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% /useenv /%ACTION% release_shared %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_mt %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_mt %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_md %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_md %%R%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
   )
   )

   if exist %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
    echo.
    echo.
    echo ########################################################################
    echo ####
    echo #### Building %%G
    echo ####
    echo ########################################################################
    echo.
   if %BUILD_TOOL%=="msbuild" (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    ) else (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% /useenv /%ACTION% release_shared %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_mt %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_mt %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_md %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_md %%S%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
   )
   )

   if exist %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
    echo.
    echo.
    echo ########################################################################
    echo ####
    echo #### Building %%G
    echo ####
    echo ########################################################################
    echo.
   if %BUILD_TOOL%=="msbuild" (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
   ) else (
   if %DEBUG_SHARED%==1      (%BUILD_TOOL% /useenv /%ACTION% debug_shared %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_SHARED%==1    (%BUILD_TOOL% /useenv /%ACTION% release_shared %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_mt %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_mt %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_md %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_md %%T%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
    )
   )
  )
  cd %POCO_BASE%
 )
)



if "%SAMPLES%"=="no" goto :EOF

rem root level component samples
for /f %%G in ('findstr /R "." components') do (
 if exist %%G\samples\samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln (
  cd %%G\samples
    echo.
    echo.
    echo ########################################################################
    echo ####
    echo #### Building %%G/samples
    echo ####
    echo ########################################################################
    echo.
  if %BUILD_TOOL%=="msbuild" (
  if %DEBUG_SHARED%==1      (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  if %RELEASE_SHARED%==1    (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_shared /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_mt /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=debug_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln /m /p:Configuration=release_static_md /p:Platform=%PLATFORM% /verbosity:minimal /p:VCBuildAdditionalOptions="/useenv" /t:%ACTION% && echo. && echo. && echo.)
  ) else (
  if %DEBUG_SHARED%==1      (%BUILD_TOOL% /useenv /%ACTION% debug_shared samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  if %RELEASE_SHARED%==1    (%BUILD_TOOL% /useenv /%ACTION% release_shared samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  if %DEBUG_STATIC_MT%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_mt samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  if %RELEASE_STATIC_MT%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_mt samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  if %DEBUG_STATIC_MD%==1   (%BUILD_TOOL% /useenv /%ACTION% debug_static_md samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  if %RELEASE_STATIC_MD%==1 (%BUILD_TOOL% /useenv /%ACTION% release_static_md samples%PLATFORM_SUFFIX%_%VS_VERSION%.sln && echo. && echo. && echo.)
  )
 
  cd %POCO_BASE%
 )
)

goto :EOF

:usage
echo Usage:
echo ------
echo buildwin DEVENV VS_VERSION [ACTION] [LINKMODE] [CONFIGURATION] [PLATFORM] [SAMPLES]
echo DEVENV:     "devenv|vcexpress|msbuild"
echo VS_VERSION: "71|80|90|100"
echo ACTION:     "build|rebuild|clean"
echo LINKMODE:   "static_mt|static_md|shared|all"
echo CONFIG:     "release|debug|both"
echo PLATFORM:   "Win32|x64|WinCE"
echo SAMPLES:    "samples|nosamples"

echo.
echo Default is build all.
endlocal
raulgd
 
Posts: 19
Joined: 11 Mar 2011, 03:35
Location: Mexico

Re: Building POCO with MSBuild

Postby alex » 12 Jul 2012, 05:11

raulgd wrote:It seems at last I managed to compile with the 64bit MFC without changing anything!, I added some parameters to msbuild and it seems to be working! if someone else can please help me test by using the windows 7 SDK 7.1 and with my buildwin with the command: buildwin msbuild 100 build all both x64 samples or buildwin msbuild 100 build all both Win32 samples And post the results, I would be really thankful!

Windows 7 Professional, Service Pack 1, Windows SDK v7.1

Code: Select all
C:\poco>buildwin msbuild 100 build shared debug x64 nosamples
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.239]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

  CppUnit_x64_vs100.vcxproj -> C:\poco\CppUnit\..\bin64\CppUnit64d.dll
  ActiveTest.cpp
src\ActiveTest.cpp(8): fatal error C1083: Cannot open include file: 'afxwin.h':
 No such file or directory [C:\poco\CppUnit\WinTestRunner\WinTestRunner_x64_vs1
00.vcxproj]
alex
 
Posts: 1105
Joined: 11 Jul 2006, 16:27
Location: United_States

Next

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests