Skip to content

Commit

Permalink
Update build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
zenden2k committed Jul 2, 2023
1 parent 729bad9 commit 0c65ed2
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions COMPILING.MD
@@ -1,40 +1,51 @@
# Building Image Uploader GUI (or CLI) on Windows
# Building Image Uploader on Windows

Before building Image Uploader, install Python 3 interpreter for performing pre-build and post-build events. Ensure that your %PATH% environment
variable includes the directory of your Python distribution.

To build Image Uploader from source files you will need:
- Git https://git-scm.com/downloads
- Microsoft Visual Studio 2019 or newer (with C++ compiler) https://visualstudio.microsoft.com/downloads/
- CMake (tested with v3.24.0) https://cmake.org/
- Python 3 https://www.python.org/downloads/
- Conan (C++ package manager) https://conan.io/
- Conan v1.x (C++ package manager) https://conan.io/

I recommend to install Conan using `pip` utility.
I recommend to install Conan using `pip` utility. Ensure that your %PATH% environment
variable includes the directory of your Python and CMake distribution.

To generate a Visual Studio solution from CMakeLists.txt you need to create a directory for
temporary files and call cmake:
To generate a Visual Studio solution from CMakeLists.txt you need to create a directory for build files and call `cmake`:

```
mkdir Build
cd Build
```

The recommended way is to pass conan profile to the `cmake` command.

```
cmake <path_to_imageuploader_source>\Source -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES:STRING=Release -DCMAKE_TRY_COMPILE_CONFIGURATION:STRING=Release
cmake <path_to_imageuploader_source>\Source -G "Visual Studio 17 2022" -A Win32 -DIU_HOST_PROFILE=default -DIU_BUILD_PROFILE=default
```

Another way is to pass conan profile name to cmake:
The old way:

```
cmake <path_to_imageuploader_source>\Source -G "Visual Studio 17 2022" -DIU_HOST_PROFILE=default
cmake <path_to_imageuploader_source>\Source -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES:STRING=Release -DCMAKE_TRY_COMPILE_CONFIGURATION:STRING=Release
```

Then open solution in Visual Studio **or** run command:
If you are cross-compiling (from Windows x64 to x86) and want to build FFmpeg libraries from Conan repository then you should use two profiles (`-DIU_HOST_PROFILE=windows_vs2019_x86_release -DIU_BUILD_PROFILE=windows_vs2019_x64_release`)

After that, you can open the generated project in Visual Studio and build it there. Also you can run the command:
```
cmake --build . --config Release
```

The same you can achieve using `cmake-gui` utility.
In cmake-gui you can see all compilation options and easily change them.

If you want to build Image Uploader with separate FFmpeg libraries (`IU_ENABLE_FFMPEG=On` and `IU_FFMPEG_STANDALONE=On`), after building put them (avcodec.lib, avformat.lib, avutil.lib, swscale.lib) into `Contrib\Lib` directory and header files into `Contrib\Include` directory.

If you want to build IU with Microsoft Edge Webview2 support (`IU_ENABLE_WEBVIEW2=On`), you should install package "Microsoft.Web.WebView2" using NuGet package manager (https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/win32),
then copy header files `(*.h)` to the "Contrib\Include" directory, and copy `*.lib` files to Contrib\Lib directory.

Some examples, nevermind:

```
cmake ..\Source -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE=Debug -DIU_HOST_PROFILE=vs2019_x86_debug -DIU_BUILD_PROFILE=vs2022_x64 -DIU_ENABLE_FFMPEG=On -DIU_ENABLE_WEBVIEW2=On
Expand All @@ -45,13 +56,6 @@ For ARM64:
```
cmake ..\Source -G "Visual Studio 16 2019" -A ARM64 -DCMAKE_BUILD_TYPE=Release -DIU_HOST_PROFILE=../Conan/profiles/vs2019_arm64_release -DIU_BUILD_PROFILE=../Conan/Profiles/vs2022_x64 -DIU_ENABLE_FFMPEG=On -DIU_ENABLE_WEBVIEW2=On -DIU_FFMPEG_STANDALONE=On -DIU_ENABLE_MEDIAINFO=Off
```
The more convenient way to achieve the same is to use `cmake-gui`.
In cmake-gui you can see all compiling options and change them easily.

If you want to build Image Uploader with FFmpeg libraries (`IU_ENABLE_FFMPEG=On`), you have to built them separately and put them (avcodec.lib, avformat.lib, avutil.lib, swscale.lib) into `Contrib\Lib` directory.

If you need Microsoft Edge Webview2 (`IU_ENABLE_WEBVIEW2=On`), you should install it using NuGet package manager (https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/win32),
then copy header files `(*.h)` to the "Contrib\Include" directory, and copy `*.lib` files to Contrib\Lib directory.

# Building on Ubuntu (CLI and Qt GUI)

Expand Down Expand Up @@ -129,6 +133,8 @@ base64 https://github.com/aklomp/base64

UTF8-CPP http://utfcpp.sourceforge.net/

libheif https://github.com/strukturag/libheif

DirectShow BaseClasses (strmbasd.lib, strmbase.lib) - part of Windows SDK

Libraries for building Mega.nz:
Expand Down

0 comments on commit 0c65ed2

Please sign in to comment.