VB6 script to build multiple vbp - build

I am using this script to build multiple vbp in a folder "TEST"
FOR /r "C:\TEST\" %%f IN (*.vbp) DO "C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe" /m /out C:\TEST\log.txt %%f
However, if the vbp project folder has spaces between the folder name, e.g. C:\TEST\vbp project1, the build script will be failed to build that vbp project.
How can I amend the script to support a vbp project folder with spaces within the folder name?

Related

MSYS2/MinGW64-makepkg installs the package in the wrong directories . Wrong PKGBUILD?

I create a PKGBUILD file to build 'bgfx' library and to create MSYS2/MinGW-64 package. The build goes well, the package is created too, but the package is installed in the wrong directories. I expect to be installed in c:/msys64/mingw64, but it is done in c:/msys64, * .exe files are installed in c:/msys64/bin . What should be done to install to c:/msys64/mingw64?
My PKGBUILD file:
# Maintainer: https://github.com/cppfever/bgfx-pkgbuild.git
_realname=bgfx
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.115.7933
pkgrel=1
pkgdesc="Cross-platform rendering library"
url=https://github.com/bkaradzic/bgfx.cmake.git
license=(BSD-2-Clause License)
arch=('any')
mingw_arch=('mingw64')
groups=()
depends=()
makedepends=("git" "${MINGW_PACKAGE_PREFIX}-cmake" "${MINGW_PACKAGE_PREFIX}-ninja")
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("${_realname}::git+https://github.com/bkaradzic/bgfx.cmake.git#tag=v1.115.7933-417f8b8")
noextract=()
md5sums=('SKIP')
validpgpkeys=()
prepare()
{
cd ${srcdir}/${_realname}
git submodule update --init --recursive
}
build() {
cmake -S ${_realname} -B build -DCMAKE_BUILD_TYPE='Release' -G"Ninja"
cmake --build build
}
package() {
cmake --install ${srcdir}/build --prefix=${pkgdir} --strip
}
My environment variables:
# printenv
ProgramFiles(x86)=C:\Program Files (x86)
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
SHELL=/usr/bin/bash
NUMBER_OF_PROCESSORS=4
PROCESSOR_LEVEL=6
TERM_PROGRAM_VERSION=3.5.0
MINGW_PREFIX=/mingw64
PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
USERDOMAIN_ROAMINGPROFILE=mans
HOSTNAME=mans
PROGRAMFILES=C:\Program Files
MSYSTEM=MINGW64
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
ORIGINAL_TEMP=/c/Users/man/AppData/Local/Temp
MINGW_CHOST=x86_64-w64-mingw32
OS=Windows_NT
HOMEDRIVE=C:
MSYSTEM_CARCH=x86_64
windows_tracing_flags=3
USERDOMAIN=mans
VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
PWD=/d/doc/cpp/bgfx/pkgbuild/bgfx.cmake/Release
USERPROFILE=C:\Users\man
MANPATH=/mingw64/local/man:/mingw64/share/man:/usr/local/man:/usr/share/man:/usr/man:/share/man
PRINTER=Microsoft XPS Document Writer
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
TZ=Asia/Novosibirsk
MINGW_PACKAGE_PREFIX=mingw-w64-x86_64
tmp=C:\Users\man\AppData\Local\Temp
ALLUSERSPROFILE=C:\ProgramData
ORIGINAL_PATH=/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/
CommonProgramW6432=C:\Program Files\Common Files
HOME=/home/man
USERNAME=man
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
COMSPEC=C:\Windows\system32\cmd.exe
APPDATA=C:\Users\man\AppData\Roaming
SYSTEMROOT=C:\Windows
LOCALAPPDATA=C:\Users\man\AppData\Local
COMPUTERNAME=MANS
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:/share/info
TERM=xterm
LOGONSERVER=\\MANS
ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
USER=man
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
FP_NO_HOST_CHECK=NO
MSYS_HOME=C:\msys64\usr
TEMP=/tmp
temp=C:\Users\man\AppData\Local\Temp
MSYSTEM_CHOST=x86_64-w64-mingw32
ORIGINAL_TMP=/c/Users/man/AppData/Local/Temp
SHLVL=1
PROCESSOR_REVISION=4e03
COMMONPROGRAMFILES=C:\Program Files\Common Files
LC_CTYPE=ru_RU.UTF-8
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
SESSIONNAME=Console
PS1=\[\e]0;\w\a\]\n\[\e[32m\]\u#\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n\[\e[1m\]#\[\e[0m\]
MINGW_HOME=C:\msys64\mingw64
HOMEPATH=\Users\man
XDG_DATA_DIRS=/mingw64/share/:/usr/local/share/:/usr/share/
MSYSCON=mintty.exe
TMP=/tmp
VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
CONFIG_SITE=/etc/config.site
PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
ProgramW6432=C:\Program Files
MSYSTEM_PREFIX=/mingw64
WINDIR=C:\Windows
PROCESSOR_ARCHITECTURE=AMD64
PUBLIC=C:\Users\Public
SYSTEMDRIVE=C:
OLDPWD=/d/doc/cpp/bgfx/pkgbuild
TERM_PROGRAM=mintty
ProgramData=C:\ProgramData
_=/usr/bin/printenv
When you call cmake the first time, add this argument:
-DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX

Specify working directory with MSVC compiler

So I have a project structure like this:
/
build/
data/
include/
src/
build.bat
My build.bat looks like this:
#echo off
pushd build
cl -Zi /EHsc ../src/*.cpp /I.. /Fepea1
It produces the executable, great. Now I have some data I have to read from data/ directory. Now the executable is in build/ directory, so I would have to copy it to the root directory or I would have to use relative path (like ../data). But I don't want to do that, cuz I don't know how will I be releasing this project (so I just want path = "data/). In Visual Studio there was a way to specify projects working directory. Can I do this with cl.exe? Or do I need to use relative paths?
You can just run the executable from the data folder.
..\build\out.exe and it will run from the data context.
You can do this using cmd.exe

MSBuild output directory

I'm trying to get absolute control over the output of MSBuild. If I run:
msbuild project.msbuild
or:
msbuild project.msbuild /p:configuration=Debug
I will get the folder:
Debug
If I run:
msbuild project.msbuild /p:configuration=Release
I will get the folder:
Release
The output directory structure I want is the following:
Win32\Debug
Win32\Release
x64\Debug
x64\Release
I first tried OutputPath but nothing happened. Then I tried the following:
<OutDir>$(Platform)\$(Configuration)\</OutDir>
Now I get the compiled binaries in the specified folder but for some reason the old directory structure is created to contain the object files. So if I run:
msbuild project.msbuild
What I end up with is:
Debug (contains object files)
Win32\Debug (contains binaries)
I want everything in the same folder, the one I specified, not the default MSBuild decides upon.
Object files are stored in 'Intermediate' directory.
By specifying OutDir - you specify location of binaries.
To specify location of .obj files you should additionally try specifying IntermediateOutputPath to the desired location of .obj files.
See reference, for example: https://blogs.msdn.microsoft.com/kirillosenkov/2015/04/04/using-a-common-intermediate-and-output-directory-for-your-solution/

How to build the project to specific folder with visual studio command line tools?

I've got this simplified folders structure for c++ project named project_name.
project_name
-build
-headers
-sources
-resources
If I do cl /EHsc /W4 sources/source1.cpp sources/source2.cpp /link /out:project_name ... it creates build files in current directory only which is project_name, resulting this:
project_name
-build
-headers
-sources
-resources
project_name.exe
source1.obj
source2.obj
etc
What I want is to specify the folder where all the build files have to be placed, in my case in a build folder.
What options are needed for cl or link to do that that from project_name directory ?
Place a .bat file in your project directory and use that to build your project.
pushd %~dp0/build
cl %~dp0/sources/source1.cpp %~dp0/sources/source2.cpp
popd
%~dp0 automatically expands to full path of your project directory so you can execute this .bat file from anywhere.

Visual Studio custom build event always executing

I am using the odb compiler as a custom build tool. The build tool is always executing even though the input file is not changing.
The command line:
odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient
-d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query
--generate-schema --schema-format separate
c:\menuplan\src\ingredient\ing_odb_category.hpp`
The input file is:
ing_odb_category.hpp.
The outputs:
ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx
The additional dependencies:
ing_odb_category.hpp
The description:
odb ing_odb_category.hpp
The output from Visual Studio 2010:
2>------ Build started: Project: vs_2010, Configuration: Debug Win32 ------
2> odb ing_odb_category.hpp
The odb tool takes the ing_odb_category.hpp as input and produces ing_odb_category-odb.hxx, ing_odb_category-odb.ixx,ing_odb_category-odb.cxx,ing_odb_category-schema.cxx files.
I can build the solution many times in a row and the custom build event will always run, even though the ing_odb_category.hpp file never changes.
How can I make Visual Studio only perform the custom build if the header file changes?
From the vcxproj file:
<CustomBuild Include="..\ing_odb_category.hpp">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb ing_odb_category.hpp</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb ing_odb_category.hpp</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category.hpp</AdditionalInputs>
</CustomBuild>
Environment:
Visual Studio 2010
Windows 7 - 64bit
Visual Studio was always building the files because it said they didn't exist.
Using the Visual Studio project logging article, especially running the DebugView showed that Visual Studio was using a different path for the dependencies. I did not specify the path of the output files and dependencies, so it was trying to locate them in the default project directory.
Also, Visual Studio expects only one output file, according to Specifying Custom Build Tools article. I was supplying all the output filenames.
Summary
In the Custom Build Tool window:
There should only be one output file.
Additional output files are listed in the Additional Dependencies
slot.
All output files should be prefixed with the path of their location,
relative or absolute.
Useful build process debugging aids can be found in the Visual Studio Project Logging article, especially the DebugView application.