For instructions on building HTCondor with vs2008, see {wiki: BuildingHtcondorOnWindowsVsNine Building HTCondor with vs2008 on Windows}. -For instructions on building HTCondor in releases *prior to 7.5.5*, see {wiki: BuildingHtcondorPriorToCmakeOnWindows Building HTCondor prior to 7.5.5 on Windows}. +For instructions on building HTCondor in releases *prior to 8.8*, see {wiki: BuildingHtcondorPriorTo88nWindows Building HTCondor prior to 8.8 on Windows}. For information about the conversion of the build process from project files to cmake see {wiki: BuildModernization} {section: Building HTCondor with cmake on Windows} + +These instructions are designed for building *HTCondor 8.8 or later* on *Windows 10 64-bit* with *Visual Studio 2017*. + +{subsection: Obtaining Windows} + +You can download Windows VMs directly from Microsoft's developer site. These are free and full-featured, however they expire after 90 days. + +https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ + {subsection: Prerequisites } In order to build HTCondor on Windows, the following prerequisites are required. They need to be in the PATH before you can build. There is a batch file =msconfig\set_build_env.bat= in the HTCondor sources that will locate the installed prerequisites and set the PATH for you if you don't wish to add them to your global PATH. -1: Install 7-zip. Add it to your PATH. 7-zip is not needed to build, but it is needed to make the HTCondor .ZIP file. You will not be able to build the PACKAGE target witout 7-zip. +1: [Optional] Install 7-zip (64-bit). Add it to your PATH. 7-zip is not needed to build, but it is needed to make the HTCondor .ZIP file. You will not be able to build the PACKAGE target witout 7-zip. *::http://www.7-zip.org/download.html -1: [Optional] install git and add it to your PATH, git is one way to get the HTCondor sources. It is not needed if you already have the sources. +1: [Optional] Install git (64-bit) and add it to your PATH, git is one way to get the HTCondor sources. It is not needed if you already have the sources. *::http://git-scm.com/download - -1: Cmake 2.8.3 or later, the =Cmake\bin= directory should be added your PATH. For now, For HTCondor 8.8 or later, use Cmake 3 -*::http://www.cmake.org/cmake/resources/software.html +*::You need to set a configuration option to preserve existing line endings. You can either do this during installation, or later by running from the command line: +{code} +git config --global core.autocrlf false +{endcode} 1: Install Active Perl. Add it to your PATH. *::http://www.activestate.com/activeperl/downloads -1: Install Visual Studio. Add it to your PATH. -*::Visual Studio Express (Free to anyone) https://www.microsoft.com/express/Downloads/ -*::Visual Studio 2012. Paid. -*::: UW Madison staff can get it here: https://idp.cs.wisc.edu/idp/Authn/UserPassword. -*:: For HTCondor 8.8 or later, use Visual Studio 2015 or later. +1: NOTE: Cmake is now bundled with Visual Studio 2017. You don't need to install it separately anymore. + +1: Install Visual Studio 2017 Community Edition. +*::https://visualstudio.microsoft.com/free-developer-offers/ (free for all non-enterprise users) +*::During the installation, under Workloads->Windows check *Desktop Development with C++* +*::Under the list of Optional components on the right side of the screen (where several items are already selected), check *C++/CLI support*. 1: [Optional] Start Visual Studio and Open Tools->Options under "Projects and Solutions" click on VC++ Directories and add the following to the *Executable* directories. This is not needed if you use =msconfig\set_build_env.bat= to set the PATH before you build. *::$(SolutionDir)\msconfig *::Move $(PATH) to the bottom as sometimes C:\cygwin\bin is in the $(PATH) which can cause issues with HTCondor's bundled binaries. -1: [Optional] Install 32-bit Python 2.7. This is needed to build and/or use the python bindings. It *must* be the same bitness as the HTCondor binaries, which means 32-bit for now. If you build HTCondor 8.8 or later, installing 64-bit Python 2.7 or 3.6 and building 64-bit HTCondor. Prior to HTCondor 8.6 only 32-bit builds were possible. +1: [Optional] Install Python 3.6 64-bit. This is needed to build and/or use the python bindings. +*::https://www.python.org/downloads/release/python-360/ +*::The default installation directory is buried deep in your home directory. Recommend you install it to C:\Python36 instead. +*::Add the following environment variable: PYTHONPATH=C:\Python36;C:\Python36\DLLs;C:\scratch\condor\release_dir\lib\python 6: [Optional] Install WiX 3.0 on your windows machine (Depends on Visual Studio). WiX is not needed to build, but it is needed to create the MSI installer. *::http://wix.codeplex.com/ -{blockquote} -**IMPORTANT GIT CONFIG for windows** you most set a global git config -value or patch files will fail because the sources will be modified during -cloning of the repository. -From command line enter: -{endblockquote} -{code} -git config --global core.autocrlf false -{endcode} - {subsection: Building } -1.) Open a windows commmand prompt (you can use the command prompt provided by the Visual Studio installation "%appdata%\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools\Developer Command Prompt for VS2012") +These instructions for building HTCondor from source all assume the following: +*:: Your source files live in C:\scratch\condor\src +*:: Out-of-source builds live in C:\scratch\condor\src-build +*:: Your release/installation folder is C:\scratch\condor\release_dir -2.) Checkout origin/master from the git repository, or download the HTCondor Sources http://www.cs.wisc.edu/condor/downloads-v2/download.pl +1: Open the *Developer Command Prompt for VS 2017*. Note that using the regular command prompt has incorrect environment variables. -3.) navigate to the root directory of the sources, it is called CONDOR_SRC if you are a using a git clone. (The root directory has a file called configure_uw in it.) +1: Checkout origin/master from the git repository. +*::From AFS: +{code} +git clone /p/condor/repository/CONDOR_SRC +{endcode} +*::From Github: +{code} +git clone https://github.com/htcondor/htcondor +{endcode} -4.) add cmake\bin to your PATH if it is not already. One way to do this is to execute =msconfig\set_build_env.bat=. This will setup PATH, LIB, and INCLUDE environment variables to build HTCondor. If this batch file cannot find cmake.exe It will report an error. +1: Add the c:\scratch\condor\src\msconfig folder to your PATH. -5.) [Optional] If you want to use cached externals set the environment variable =CONDOR_BLD_EXTERNAL_STAGE= to the path of the externals cache. Using cached externals can save a lot of time if you plan to build HTCondor more than once. For example +1: [Optional] If you want to use cached externals set the environment variable =CONDOR_BLD_EXTERNAL_STAGE= to the PATH of the externals cache. Using cached externals can save a lot of time if you plan to build HTCondor more than once. For example: {code} -set CONDOR_BLD_EXTERNAL_STAGE=c:\scratch\condor_externals +set CONDOR_BLD_EXTERNAL_STAGE=c:\scratch\condor\externals {endcode} -6.) The the cmake build supports both in-source and out-of-source builds. Out- of-source is better if you are building from git. If you are building from a the source tarball, then in-source is simpler. - -for out-of-source builds, navigate to the build destination folder and execute cmake; passing it the path to the HTCondor sources. For example +1: Run cmake from your source folder. +*::For in-source builds: {code} -REM assuming that the current directory is CONDOR_SRC -set condorsources=%CD% -mkdir c:\scratch\condor\build -cd /d c:\scratch\condor\build -cmake CMakeLists.txt -G "Visual Studio 11" %condorsources% +cd C:\scratch\condor\src +cmake -G "Visual Studio 15 2017 Win64" {endcode} -For in-source just execute this +*:: For out-of-source builds: {code} -cmake -G "Visual Studio 11" . +mkdir C:\scratch\condor\src-build +cd C:\scratch\condor\src-build +cmake -G "Visual Studio 15 2017 Win64" C:\scratch\condor\src {endcode} -This will create Visual Studio Project and Solution files to build HTCondor. +*::This will create Visual Studio Project and Solution files to build HTCondor. Many options can be passed to cmake, see CondorCmakeBuildOptions for more information. You can also use the cmake-gui to set options. -6.) Once you have used cmake to build Condor.sln, you can build on the command line or interactively. The options are +1: Now start the actual build, from whichever folder you ran cmake from: {code} -devenv condor.sln /Rebuild RelWithDebInfo /project ALL_BUILD +msbuild /m:4 /p:Configuration=RelWithDebInfo /fl1 ALL_BUILD.vcxproj {endcode} -or open *Condor.sln* in Visual Studio and build interactively. -***Note - If the build fails remove external and local build folders*** +1: Finally, install your compiled binaries to the release folder. There is a cmake file that will copy the build products to the correct subdirectories of a HTCondor installation. From your source folder, run: +{code} +cmake -DBUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=c:\scratch\condor\release_dir -P cmake_install.cmake +{endcode} + +***Note - If the build fails, remove external and local build folders*** **Then start over. We don't recover well after a failed build.** @@ -95,12 +112,6 @@ Build the *tests* target in the Condor.sln Solution File. Once built you can run all the batch tests as before. -{subsection: Copying Build results to the release Directory} -There is a cmake file that will copy the build products to the correct subdirectories of a HTCondor installation. This can be used to overwrite an existing HTCondor install, or to layout the HTCondor files in preparation for making the installer. - -{code} -cmake -DBUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH=c:\scratch\condor\release_dir -P cmake_install.cmake -{endcode} Note: Building the *INSTALL* target in the Condor.sln solution file invokes this cmake file. It will copy build results to $(SolutionDir)\release_dir