Leptonica on Windows + Visual Studio - windows

I have followed the following steps for installing Leptonica on Windows with Visual Studio
3. Building on Windows
(a) Building with Visual Studio
1. Download the latest SW
(Software Network https://software-network.org/)
client from https://software-network.org/client/
2. Unpack it, add to PATH.
3. Run once to perform cmake integration:
sw setup
4. Run:
git clone [https://github.com/danbloomberg/leptonica](https://github.com/danbloomberg/leptonica)
cd leptonica
mkdir build
cd build
cmake ..
5. Build a solution (leptonica.sin) in your Visual Studio version.
I did everything except for step 5.
My build directory now looks as follows:
ALL_BUILD.vcxproj LeptonicaConfig.cmake
ALL_BUILD.vcxproj.filters LeptonicaConfig-version.cmake
cmake_install.cmake LeptonicaTargets.cmake
cmake_uninstall.cmake src/
CMakeCache.txt sw_build_dependencies.vcxproj
CMakeFiles/ sw_build_dependencies.vcxproj.filters
config_auto.h.in uninstall.vcxproj
INSTALL.vcxproj uninstall.vcxproj.filters
INSTALL.vcxproj.filters x64/
lept.pc ZERO_CHECK.vcxproj
leptonica.sln ZERO_CHECK.vcxproj.filters
I cannot seem to find leptonica.sin and how to integrate with visual studio ? I need the steps that are left. I am new to visual studio please mind my question.
I have Visual Studio 2019

You probably already figured this out (I'd hope) but if not... Step #5 as you listed has a typo:
Build a solution (leptonica.sin) in your Visual Studio version.
It's supposed to be leptonica.sLn, as in a Visual Studio Solution file.
In your build directory listing you have leptonic.sln. If you double-click that it should open in Visual Studio (assuming a default/correct install).

With Visual Studio 2019 at least you don't actually have to generate a solution file with CMake manually like this as Visual Studio now supports opening folders that contain CMakeLists.txt files as though they are solutions.
You can just do the following to build Leptonica on Windows:
Download sw-master-windows-client.zip from https://software-network.org/client/.
Unzip sw.exe to some directory sw_dir.
Add sw_dir to your path environment variable. Log out and log in to make sure the path is updated.
Enter power shell etc. and run "sw setup" from a command line.
Git clone Leptonica to some directory from https://github.com/danbloomberg/leptonica
Start up Visual Studio.
Choose "Open local folder" from the intitial dialog VS presents you with. Select the Leptonica folder.
At this point Visual Studio will begin running CMake on the folder and it should succeed assuming it can find sw.exe. This step takes a while. After it completes you can build all from the build toplevel menu.

Related

Visual Studio Exe App compilation path change

I just want to change the exe file Visual Studio compilation path change
I am doing it like this now. i created a bat file that copied file. I have added visual studio build events. I wonder if there is an easier way.
meanwhile the exe file is being copied to the network drive
I had this problem in a different context (Elixir/Phoenix, Rust), but the root cause was the same: cl.exe could not be found during compilation.
My setup was:
Windows 10, x64
Visual Studio Community 2017 already installed, but only for C# development
For some reason the solution with installing the Visual C++ Build Tools (as #cozzamara suggested) did not work. Stops during installation with some obscure error message. Guess it did not liked my existing Visual Studio installation.
This is how I solved it:
Start up the Visual Studio Installer
Check the Desktop development with C++ (screenshots here)
Execute following command before compiling:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
From this on the command cl.exe works. Alternatively (and more conveniently for development) start the application 'Developer Command Prompt for VS 2017' or 'x64 Native Tools Command Prompt VS 2017'.
Share
I solved the problem by writing code like this in the Post build field, I just ensured that the exe was copied to the field I wanted
COPY $(TargetPath) "\x.x.x.x\ortak\yakup\TestApp.exe"
pause
$(TargetPath) = It gives the location where the exe exited, along with the exe name
"C:\yakup\project\TestApp.exe" like

Visual Studio 2017 - How to create a project from the source using CMake?

I have a pretty large software library using CMake to be compiled. We use Linux mostly, but now a new colleague wants to use Visual Studio.
Is there any way to create a new VS 2017 project from the existing source codes with CMake structure?
I know, it's possible to do it with CLion, but I have no idea about VS, as I have a very little experience with it.
Other questions seem to focus on creating an empty project, which will use CMake, but not on creating a project from already existing source files.
Creating a cmake project with visual studio
Creating a project with visual studio 2017
I'm not sure why you asked for details but...
Assuming you are using cmake 3.13 then you can do the following in a command shell:
cmake -G "Visual Studio 15 2017" -S path_to_source -B path_to_build
This will then create a solution file. Actually it creates a solution file for every project() command that is issued in CMakeLists.txt.
You can then open the solution file in Visual Studio, and build the project as usual.
You don't even need to do this in the Visual Studio GUI. After creating the initial project you can also issue the command:
cmake --build path_to_build
Which will kick off the build at the command line.
Now if your CMakeLists.txt in path_to_source is using Linux specific libraries or gcc specific compiler settings then the CMakeLists.txt will have to get updated to the Windows equivalent.
The alternative is to start Visual Studio and then use File->Open->CMake and open the CMakeLists.txt file in path_to_source. It'll then start to generate the project. But I prefer using the command line method.

Visual Studio 2017 RC installation failure "product ... cannot be found"

I am trying to install Visual Studio Professional 2017 RC on Windows 10 but the installer reports:
A product matching the following parameters cannot be found:
channelId: VisualStudio.15.Release
productId: Microsoft.VisualStudio.Product.Professional
Is this fixable?
I had the same issue and the following has helped me. A clean-up and removal of vs and installation folder was not enough in my case.
Here are the steps I've taken:
uninstalled Visual Studio (and other Visual Studio installations)
run C:\Program Files (x86)\Microsoft Visual Studio\Installer\InstallCleanup.exe -full"
removed all the "C:\Program Files (x86)\Microsoft Visual Studio" folders
removed "C:\Program Data\Microsoft\Visual Studio\ folder
restarted system
In the end I think removing of Program Data location did the final trick. I had to run a repair after the successful installation to make VS Extensions work.
I previously installed VS 15 Release and removed it. I had the same issue and fixed it by removing installer folder from here: C:\Program Files (x86)\Microsoft Visual Studio\ Installer
Please follow the cleanup steps and retry your VS install
See if you have this file on your machine: "%programfiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe"
If so, please launch it from an admin command prompt with a -full param:
InstallCleanup.exe -full
If not, please manually delete the "%programfiles(x86)%\Microsoft Visual Studio\Installer” folder
Relaunch the newly downloaded vs_enterprise.exe (or vs_professional.exe or vs_community.exe…)
Allow the first step to install the installer
Once the installer comes up and you can see workload choices (.net desktop and the like), close it
Go launch the same InstallCleanup.exe to clean up old build of VS
Then relaunch vs_enterprise.exe and install VS.
The problem that I had was because I had a Visual Studio 2017 layout and I wanted to make a Visual Studio 2019 layout in the same directory.
If you are creating a new offline installation layout on top of an old offline installation layout, you need to delete every file inside the layout folder (And only the layout folder not sub-directories).
This way the new (channel) information will be replaced and installation goes without errors.

Disable step in Visual Studio Extension build

While I am building own Visual Studio Extension in TeamCity (same applies to any CI server build that supports building VS solutions), my build stucks on the step DeployVsixExtensionFiles. As far as I understand, the target is defined in VS Extensibility files and is being imported into any .csproj by default. I also realize that this is an "aka test" step that tries to embed an extension into a virtual copy of VS via running a command:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /RootSuffix Exp /ResetSettings General.vssettings /Embedding /Command File.Exit
I have two questions:
1. Should I disable this step for Release build of Extension?
2. If yes, how can this be done.
The VS SDK installs the extension as a part of a build so you can F5 and run it. If you're CI system doesn't care about that, update your CI configuration to pass /p:DeployExtension=false to MSBuild.

configure openCV Qt new functions

I'm struggling with the step from the official documentation
Extract it into a nice and short named directory like D:/OpenCV/dep/qt/ . Then you need to build it. Start up a Visual Studio Command Prompt (2010) by using the start menu search (or navigate through the start menu All Programs ‣ Microsoft Visual Studio 2010 ‣ Visual Studio Tools ‣ Visual Studio Command Prompt (2010)).
The Visual Studio command prompt
Now navigate to the extracted folder and enter inside it by using this console window. You should have a folder containing files like Install, Make and so on. Use the dir command to list files inside your current directory. Once arrived at this directory enter the following command:
configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools
-no-qt3support -no-multimedia -no-ltcg
...
My issue is that in this document Qt 4.7.3 was used, now, I dont know about that version because I wasn't able to find it but in the newer one there is not Install, Make files...
which ones should I use instead?
does anyone has any step for more recent version of Qt and VS that I can follow to get this done
I turns out I wasn't using the source file, which you can find here found the folder which contains the configuration and INTALLS files on the new version in a folder called qtbase continued with the steps from there on the OPENCV guide and everything worked alright on MSVS2012

Resources