Visual Studio and cmake errors when compiling openexr for windows - windows

Apologies because I'm pretty new and inexperienced at this but I'm trying to compile OpenExr-2.3.0 (downloaded from http://www.openexr.com/downloads.html and extracted to a 'exr_2_3_0' directory) on Windows with cmake and Visual Studio 15. I'm just going to outline the basic questions I have before going into detail:
Should the ilmbase build do more than just create some header files in the relevant include directory? (I know the 2.2.0 build did and I've a feeling this is what's missing).
I'm confused as to how to tell the openexr build where these header files are. It never seems to be able to find them so I'm pretty sure I'm either building them to the wrong place or missing a step.
The README file suggests the following:
Launch a command window, navigate to the IlmBase folder with CMakeLists.txt,and type command: setlocal del /f CMakeCache.txt cmake
-DCMAKE_INSTALL_PREFIX= -G "Visual Studio 10 Win64" ..\ilmbase
Navigate to IlmBase folder in Windows Explorer, open ILMBase.sln and build the solution. When it build successfully, right click
INSTALL project and build. It will install the output to the path you
set up at the previous step.
Go to http://www.zlib.net and download zlib
Launch a command window, navigate to the OpenEXR folder with CMakeLists.txt, and type command: setlocal del /f CMakeCache.txt cmake
-DZLIB_ROOT= -DILMBASE_PACKAGE_PREFIX= -DCMAKE_INSTALL_PREFIX= -G "Visual Studio 10 Win64" ^ ..\openexr
Navigate to OpenEXR folder in Windows Explorer, open OpenEXR.sln and build the solution. When it build successfully, right click
INSTALL project and build. It will install the output to the path you
set up at the previous step.
So I create a deploy folder inside the source directory and from the source directory I run:
cd ilmbase-2.3.0
setlocal
del /f CMakeCache.txt
cmake -DCMAKE_INSTALL_PREFIX="../deploy" -G "Visual Studio 15 Win64" ../ilmbase-2.3.0
This builds a sln file in the ilmbase folder, which builds with no errors but the install project inside that solution only creates a bunch of header files inside the 'source/deploy/include/OpenEXR' folder. Again, is this all it's supposed to do or is there supposed to be a lib directory with dll files etc built as a result at this stage?
I've successfully built zlib with no errors but when I try point 4 I run into errors of:
CMake Error at IlmImfExamples/CMakeLists.txt:3 (ADD_EXECUTABLE) Target
"IlmImfExamples" links to target "IlmBase::IlmThread" but the target
was not found. Perhaps a find_package() call is missing for an
IMPORTED target or an ALIAS is missing?
I'm guessing I should be adding a path from cmake to the new files? Even if I open the openexr.sln that is generated and try to build, IlmImfExamples fails to build. If I manually add the header files that it complains about it still won't build, complaining that it can't find OpenEXR::IlmImf.lib It's right that this hasn't been built but I've no idea why, or at least I can't find it if it has.
I did see this thread on github:
https://github.com/openexr/openexr/issues/355
that says there are errors in the CMakeLists.txt which I have also changed. But I'm rapidly hitting a brick wall of knowledge at this stage so any help is greatly appreciated.
Thanks,
Paddy

Related

Copying executable using CMake add_custom_command in visual studio

Some context: I'm compiling a legacy CMake project using Visual Studio 2019 on a Windows 10 host, but targeting a remote aarch64 Ubuntu16.04 machine. To do so, I added a debug configuration for "Linux-Debug" to point at the machine's IP address (this part works, as I can build, and debug with breakpoints).
The Problem:
I have the following add_custom_command inside my CMakeLists.txt
# Create the executable
add_executable( imageCaptureAEv1 ${SOURCES})
#copy it to the home directory
add_custom_command(TARGET imageCaptureAEv1 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:imageCaptureAEv1> /home/nvidia)
Where /home/nvidia is the directory I want to copy the executable to after I build it (POST_BUILD), and imageCaptureAEv1 is the name of the executable.
I believe this copy never happens, as the file never shows up in /home/nvidia when I ssh into the Ubuntu machine. All I want to do is copy the executable to an easier to find directory (visual studio prepends the build directory with a crazy long hash that I could get rid of, but I'd rather keep the build directory separate from where I'm copying it).
Is there an easier way? Or, am I missing something with my command?
The above cmake code DOES copy the executable, I just need to make sure a run a rebuild or clean then build in my particular environment, otherwise the executable doesn't get overwritten.

Cannot open include file: 'pnglibconf.h':No such file or directory

I'm trying to build libpng in MS Visual studio 2015 community edition but when i built it, i got this error (i used cmake to compile libpng along with compiled zlib to produce libpng's soln file ALL_BUILD.vcxproj )
Cannot open include file: 'pnglibconf.h':No such file or directory
I think this a system specific error,when i try to build this on other system it works fine(because pnglibconfig.h was present with MS VS soln folder). Is there any prerequisites that is missing? Update: I tried building libpng in both debug & release mode, both are showing the same error. Zlib builds fine.
Try to add the folder where the png lib headers are to your include list in the VS project settings
If you aren't using "configure", you may need to copy pnglibconf.h.prebuilt from the scripts directory to pnglibconf.h in your working directory. See Section III of the INSTALL file in your libpng source directory.

FreeGLUT 3.0.0 Visual Studio solution?

Where is the Visual Studio solution for FreeGLUT 3.0.0? I know the 2.8.1 has one, but 3.0.0 does not. I would really like to use the latest version.
Use the included CMakeLists.txt to create a Visual Studio solution:
How to build freeglut with CMake on Windows (MS Visual Studio)
Download CMake (http://www.cmake.org/cmake/resources/software.html).
Get one of the releases from the binary distribution section.
Run the CMake installer, install wherever you like.
Launch CMake via Start > Program Files > CMake 2.8 > CMake (GUI)
(note that the shortcut put by the installer on your desktop does NOT
point to the CMake GUI program!)
In the "Where is the source code" box, type or browse to the root
directory of your freeglut source (so that's /freeglut, not
/freeglut/src).
In the "Where to build the binaries" box, type or browse to any
folder you like - this will be where the Visual Studio solution will be
generated. This folder does not have to exist yet.
Hit the Configure button near the bottom of the window.
Pick your target compiler, make sure that its installed on your
system of course!
Answer Ok when asked if you want to create the build directory.
Wait for the configure process to finish.
The screen will now have some configuration options on it, for
instance specifying whether you want to build static and/or shared
libraries (see below for a complete list). When you've selected your
options, click the Configure button again.
The Generate button at the bottom will now be enabled. Click Generate.
The build files will now be generated in the location you picked.
You can now navigate to the build directory you specified in step 5.
Open the freeglut.sln file that was generated in your build directory,
and compile as usual

CMAKE does not create INSTALL project in Visual Studio

I am trying to compile a Library using CMAKE-gui 3.0.2 and Visual Studio express 2013.
Everything seems to be fine during the configuration/generation process in cmake-gui, as I am able to set the CMAKE_INSTALL_PREFIX variable to the path in which I want to have my library installed. And I got no errors during configuration and generation.
I then open the generated .sln file in which I can build the ALL_BUILD target, which runs smoothly with no errors and no targets skipped.
However, the INSTALL target is simply not present in the Solution Explorer, therefore I really do not have any idea on how to install the library.
Upon further inspection, I noticed that cmake did create a file called cmake_install.cmake, but I don't know what should I do with it.
CMake will only generate the INSTALL target when there is actually anything to install. It would seem you have no install() commands in your project.
Presence of the variable CMAKE_INSTALL_PREFIX does not imply anything - the variable is always present, and is used to control the installation destination when there is anything to install.
Likewise, the file cmake_install.cmake is always created; but if you inspect it, you'll find it's basically a no-op in your case (probably just some messages, setting CMake variables and possibly creating a manifest which is not used for anything).

Compile error in wxWidgets with VS2010 Beta 2

i try to build wxWidgets straight from source using VS10 beta 2, but i get this error when i try to compile it:
Error 1 error MSB3073: The command "copy "" ..\..\lib\vc_lib\mswd\wx\setup.h
:VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cp\\v4.0\Microsoft.CppCommon.targets 145
thanks!
I was able to fix that particular error by creating folders in:
/lib/vc_lib
or
/lib/vc_dll
The folders were
msw/wx
mswd/wx
mswu/wx
mswud/wx
.. etc according to the configuration that was being built
I was able to build the lib versions:
Stable Release: 2.8.10 - had to open the /build/msw/wx.dsw in VC 2008 and then in VC 2010 for the project conversion to work.A bit of work setting up the build order, the above folders in /lib and it compiles. Did not attempt building samples.
Development Snapshot: 2.9.0 - a lot easier. It comes with VC 2008 solution files and can be loaded in VC 2010. Set up the folder in the lib output folders and it compiles. Built the /samples/menu project (static lib Debug & Release) without any problems.
If you use svn checkout you need to ensure that the file include/wx/msw/setup.h exists (and not just setup0.h, just copy setup0.h to setup.h if you don't need to edit it). Otherwise check the project settings as they might have been not imported correctly -- the empty file name in copy command is very suspicious, it should be "....\include\wx\msw\setup.h" normally.
FWIW I checked that the build with VC10 beta2 works just yesterday but I had to do this change (http://svn.wxwidgets.org/viewvc/wx?view=revision&revision=62567) in order to get rid of the warnings about unknown compiler version. IOW you should use an svn checkout or apply this patch locally.

Resources