How to install pbrt-v3 on windows10 with Visual Studio 2017? - c++

I fork the repo and download it, then open it in the Visual Studio 2017 community and did as follows:
1:right-click the MakeLists.txt and click the Rebuild All. (x64 Debug)
2:Then, i found the build directory at here:C:\Users\SHIZU-NOTEBOOK\AppData\Local\CMakeBuild\233159a3-9dca-9735-91fc-be7911e3ef6d\build\x64-Debug\Debug
I can't find the directory like *\bin, also in cmd "pbrt" dosen't work.
Am I wrong with build?and solution!
Sincerely!

Use the cmake-gui or cmake command line tool to generate Visual Studio solution file, then build the solution.
If you choose the command line, here are steps:
Generate solution files
mkdir build && cd build
cmake .. -G "Visual Studio 15 Win64"
Now, open PBRT-V3.sln with Visual Studio 2017
Buile the solution
PS: from the readme in pbrt-v3 project, you need run git submodule update --init --recursive to fetch the dependencies.

Related

How can I import a CLion C++ project into Visual Studio?

It seems like this should be easy and I've spent hours trying to find this answer online but haven't had any luck.
I can open the CLion folder path in Visual Studio, but that option doesn't give me the usual options to build and start the project. To do that, I need to open CLion as a Project/Solution, but I can't seem to do this.
My professor requires that my C++ code be executable in Visual Studio, but I prefer CLion. So I've done all my work in CLion and want to test that it runs in Visual Studio. How can I import my CLion project?
Thanks!
The link provided describes Visual Studio's CMake integration, which (similar to CLion) will install a version of CMake that Visual Studio will use. These instructions are pretty thorough and should provide everything needed to get your CMake project working in Visual Studio.
Now, you probably have two versions of CMake installed on your machine, one that came with CLion and one that came with Visual Studio. I would recommend installing the latest version of CMake on your machine separately, and configuring both Visual Studio and CLion to use that version instead. However, this is probably getting outside the scope of your immediate problem.
As you follow the Microsoft's instructions for "CMake projects in Visual Studio", you mentioned receiving the error:
1> [CMake] CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:173 (file):
1> [CMake] file failed to open for writing (No such file or directory):
This looks like a permissions issue, specifically while running CMake within Visual Studio, so be sure you have read/write access to all the files in your project, and the CMake packages in your Visual Studio installation. Hopefully, this doesn't require you re-install Visual Studio in another location on your machine, or run Visual Studio with elevated privileges, but perhaps that is necessary.
If you decide to install CMake separately, the instructions would be the following:
Install the latest CMake on your machine (somewhere you have adequate permissions), and ensure it is available in your Path environment variable. You can verify this by running cmake -version from the command line to see it is the version you just installed.
Using Windows command prompt, navigate to your CMake project directory (containing the top-level CMakeLists.txt file), and run the following:
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 ..
You may run -A Win32 with the cmake command instead if your project is a 32-bit build.
Open the .sln Visual Studio Solution file that was generated in the build directory. Once, the Solution is loaded in Visual Studio, you can build the project (CTRL + SHIFT + B).

cmake incremental build with vs 2015 and llvm-vs2014 toolset

When i use VS 2015 with llvm-vs2014 toolset on my project (project generated by cmake 3.9) the incremental build is not available: if i restart build or modify only one cpp file, the whole solution is built and it takes time...
In this case, incremental build is not available in VS2015 ? How can i activate it.
An example of my toolchain commands:
cmake -G"Visual Studio 14 2015" -T"LLVM-vs2014" myBuild
msbuild myBuild.sln /t:myPrpoject /maxcpucpunt
I tried to modify msbuild parameters but nothing happen

Compiling Cling with Visual Studio

I am trying to build cling for Windows using Visual Studio. After all the steps were completed as shown below, I don't seem to have the cling.exe in the directory /cling/build/Debug/bin for some reason. There's a clang.exe, clang++.exe and a bunch of random llvm ones but it seems that only cling.exe is missing. Does anyone know if I am missing some steps or what went wrong?
// Install CMake 3.6.0 and Visual Studio Express 2015 for Windows desktop
git clone root.cern.ch/git/llvm.git src
cd src
git checkout cling-patches
cd tools
git clone root.cern.ch/git/cling.git
git clone root.cern.ch/git/clang.git
cd clang
git checkout cling-patches
cd ../..
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=[Install Path] ..\src -G "Visual Studio 14"
//Go inside build directory and open LLVM.sln, run "Build Solution" on "Debug" and "Win32"
I guess it doesn't work for Windows currently but it will be ready in a couple of week.
https://root.cern.ch/phpBB3/viewtopic.php?f=21&t=22006&sid=b9bc976106f30bdd02d48427a88aa04e

visual studio build application from the source code

I have an application to build using the code source but i have a problem with that because i didn't understand what they mean by:
On Windows, add -G "Visual Studio 14 Win64". Also, you will probably
need to add -C ../4dface/initial_cache.cmake as first argument -
copy the file from initial_cache.cmake.template and adjust the
paths.
Here is the third step which i can't realize it:
3.
Build the app:
Run from outside the source directory:
1. mkdir build && cd build
2. `cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc-5 -DCMAKE_CXX_COMPILER=g++-5 -DOpenCV_haarcascades_DIR=/usr/share/opencv/haarcascades/ ../4dface/`
On Windows, add `-G "Visual Studio 14 Win64"`. Also, you will probably need to add `-C ../4dface/initial_cache.cmake` as first
argument - copy the file from initial_cache.cmake.template and
adjust the paths.
If you get an error about OpenCV\_haarcascades\_DIR, adjust `-DOpenCV_haarcascades_DIR` to point to the directory of
haarcascade_frontalface_alt2.xml from OpenCV.
I am on windows 8 and i had the code source from this "https://github.com/patrikhuber/4dface"
and here is the link for the readme "https://github.com/patrikhuber/4dface/blob/master/README.md"
Thank you.
Looks like you need to use CMake. Install it.
From the Visual Studio "Tools" Menu, choose "Visual Studio Command Prompt".
In the window, change directories to the project.
Now enter the command "CMake -G "Visual Studio 14 2015 Win64".
Note: Cmake wants the "2015" in the phrase.

libzip with Visual Studio 2010

How can I compile libzip for Visual Studio 2010?
Edit:
Before starting on the answer provided here, it appears that this may no longer be an issue going by #Thomas Klausner's answer below.
The following should get you a VS10 solution:
If you've not already done so, install CMake
Download and extract zlib to e.g. C:\devel. The download links are about halfway down the homepage. Currently this provides zlib version 1.2.7.
To work around this CMake bug which affects 64-bit Windows only, add
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC)
set_target_properties(zlibstatic PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
endif()
to the end of C:\devel\zlib-1.2.7\CMakeLists.txt
Download and extract libzip to e.g. C:\devel
In a VS10 command prompt, cd C:\devel\zlib-1.2.7
mkdir build && cd build
cmake .. -G"Visual Studio 10" -DCMAKE_INSTALL_PREFIX="C:\devel\installed\zlib" This sets the install path to C:\devel\installed\zlib rather than the default C:\Program Files\zlib. For 64-bit Windows, use "Visual Studio 10 Win64" as the -G parameter.
msbuild /P:Configuration=Debug INSTALL.vcxproj
msbuild /P:Configuration=Release INSTALL.vcxproj
cd C:\devel\libzip-0.10.1
mkdir build && cd build
cmake .. -G"Visual Studio 10" -DCMAKE_PREFIX_PATH="C:\devel\installed\zlib" Set the path to wherever you installed zlib so that CMake can find zlib's include files and libs. Again, for 64-bit Windows, use "Visual Studio 10 Win64" as the -G parameter.
This should result in C:\devel\libzip-0.10.1\build\libzip.sln. It looks like there are a few POSIX-specific problems in the code, but they should hopefully be fairly easy to resolve (e.g. in zipconf.h #include <inttypes.h> needs replaced with #include <stdint.h>; there are some snprintf calls needing replaced e.g. with _snprintf).
I can't comment, so just in addition to Fraser's answer: In the last days, libzip's latest repository version should compile on VS without additional patches. Please try it out and let the developers know if parts are still missing.
Can't comment on answer above but was trying to get this to work and in the end found that the Output directory under the configuration properties and the comand in debugging.
You can remove ALL_BUILD, ZERO_CHECK, INSTALL and PACKAGE and it will build fine without any of the linking errors or linux specific errors.
Using libzip-1.0.1, zlib-1.2.8, and VS Community 2013.
Added to path:
C:\Program Files (x86)\CMake\bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
The cmake line became:
cmake .. -G"Visual Studio 12 Win64" -DCMAKE_INSTALL_PREFIX="C:\devel\installed\zlib"
devel\libzip-1.0.1\lib\zip_source_filep.c:189 changed:
mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
to:
mask = umask(_S_IREAD | _S_IWRITE);
Using
an environment variable %ZLIB_DIR% for the path to zlib-1.2.8,
%LIBZIP_DIR% for the path to libzip-1.0.1
VS 2015 Express Edition, and
the file %LIBZIP_DIR%/lib/zip_source_filep.c patched according to http://hg.nih.at/libzip/rev/80457805a1e7 ,
the process for building zlib and libzip becomes this:
Building zlib
> cd /d %ZLIB_DIR% && md build & cd build
> cmake .. -G"Visual Studio 14 2015 Win64"- DCMAKE_INSTALL_PREFIX="%ZLIB_DIR%"
> msbuild /P:Configuration=Debug INSTALL.vcxproj
> msbuild /P:Configuration=Release INSTALL.vcxproj
Building libzip
> cd /d %LIBZIP_DIR% && md build & cd build
> cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_PREFIX_PATH="%ZLIB_DIR%"
> msbuild /P:Configuration=Debug ALL_BUILD.vcxproj
> msbuild /P:Configuration=Release ALL_BUILD.vcxproj
Done!
(So you see, #MikeLischke, CMake does indeed work out-of-the-box sometimes...)
In current zlib version, there is a contrib for this:
zlib-1.2.8\contrib\vstudio\vc10\zlibvc.sln
I got an error on load because one of the configurations wasn't valid on my machine, but a recompile took care of that. I also had to change the project properties>Configuration Properties>Linker>Input>Additional Dependencies for the Debug configuration to change zlibwapi.lib to zlibwapid.lib.
In Visual Studio 2015, Win64:
If building libzip failing with a message like this:
Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8").
All you have to do is copy the generated 'zlib.dll/zlibd.zll' and 'zlib.lib/zlibd.lib' to the top of the zlib directory (where the .h/.c files are).
The answer given by Christian Severin helped me a lot, but needed some updates for VS2019 and 32-bit:
When building with VS 2019, you must use the -A option, not use "Win64".
When building with VS 2019, the 32-bit archive is "Win32", not x86.
The "Building zlib" section has a typo, it must be Win64" -DCMAKE_..., with a space before the dash
Here is a working example with VS2019 and 32-bit build:
cd /d %ZLIB_DIR% && md build & cd build
cmake .. -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX="%ZLIB_DIR%" -AWin32
msbuild /P:Configuration=Release INSTALL.vcxproj
cd /d %LIBZIP_DIR% && md build & cd build
cmake .. -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX="%ZLIB_DIR%" -AWin32
msbuild /P:Configuration=Release ALL_BUILD.vcxproj