Skip to content

Commit a39c5ad

Browse files
committed
docs(windows): Update docs; Fix typo; To use vcpkg
1 parent 0f97fc7 commit a39c5ad

File tree

5 files changed

+44
-32
lines changed

5 files changed

+44
-32
lines changed
-1.57 MB
Binary file not shown.
-41 KB
Binary file not shown.
-118 KB
Binary file not shown.

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ elseif (UNIX)
1111
link_directories("3rdparty/libwebp/lib/linux")
1212
elseif (WIN32)
1313
message(STATUS "Detected Operating System: Windows")
14-
find_package (Threads)
15-
link_directories("3rdparty/libwebp/lib/windows-x64")
14+
link_directories("vcpkg/installed/x64-windows/lib")
1615
else ()
1716
message(FATAL_ERROR "Detected Operating System: Unknown")
1817
endif()
@@ -25,7 +24,7 @@ file(GLOB_RECURSE sources "src/*.cpp")
2524
add_executable(splitwebp main.cpp ${sources})
2625
target_link_libraries(splitwebp ${OpenCV_LIBS})
2726
if (WIN32)
28-
target_link_libraries(splitwebp webp webpdemux) #[[ pthread is in Linux-like platform, Windows use Threads ]]
27+
target_link_libraries(splitwebp webp webpdemux libwebpmux webpdecoder pthreadVC3)
2928
else ()
3029
target_link_libraries(splitwebp webp webpdemux pthread)
3130
endif()

docs/README-windows.md

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Building & Installing from source in Windows platform
22
```
3-
last updated: 2020-10-10
4-
tested at: 2020-10-09
3+
last updated: 2020-10-11
4+
tested at: 2020-10-11
55
```
66

77
## Prerequisite
88

9-
The steps are tested under this envionment. Please prepare these installed.
9+
The steps are tested under this environment. Please prepare these installed.
1010

1111
```
1212
Windows 10 (64 bit)
@@ -24,15 +24,15 @@ libwebp 1.1.0 windows-x64
2424

2525
## Notes on install Cmake
2626

27-
In order to run Cmake in `CMD`, please make sure `PATH envionment variable` contains the folder of Cmake. eg: `C:\Program Files\CMake\bin`
27+
In order to run Cmake in `CMD`, please make sure `PATH environment variable` contains the folder of Cmake. eg: `C:\Program Files\CMake\bin`
2828

2929
One may check this by by running `echo %PATH%` in CMD.
3030

3131

3232
## Notes on install OpenCV
3333

3434
The folder location of OpenCV is important. This program depends on this library.
35-
The downloaded OpenCV file is usually an archive (self-extracting archive). Please extract to a certain folder. eg: `D:\opencv` (i.e. the `opencv extrated folder`)
35+
The downloaded OpenCV file is usually an archive (self-extracting archive). Please extract to a certain folder. eg: `D:\opencv` (i.e. the `opencv extracted folder`)
3636

3737
Copy files listed below from folder `D:\opencv\build\x64\vc15\bin` to `System32 folder`. One may need Administrator right of the Windows system to do so.
3838
```
@@ -43,62 +43,72 @@ opencv_world3411d.dll
4343
opencv_world3411d.pdb
4444
```
4545

46-
**Alternatively**, one may add the path of OpenCV binary (eg: `D:\opencv\build\x64\vc15\bin`) to `PATH envionment variable`. You may refer to this [web page](https://www.deciphertechnic.com/install-opencv-with-visual-studio/).
46+
**Alternatively**, one may add the path of OpenCV binary (eg: `D:\opencv\build\x64\vc15\bin`) to `PATH environment variable`. You may refer to this [web page](https://www.deciphertechnic.com/install-opencv-with-visual-studio/).
4747

4848

49+
## Notes on install libwebp, using `vcpkg`
4950

50-
## Notes on install libwebp
51+
It is known that `libwebp` uses pthread in Linux/MacOS platforms, the equivalence in Windows would be `pthreadVC3`.
5152

52-
It locates within `Repo folder`, eg: `D:\splitwebp\3rdparty\libwebp\lib\windows-x64`
53-
54-
Please note that, in Windows, you need to rename the files if you download libwebp from [here](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html):
53+
In Windows, you need to rename the files if you download libwebp from [here](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html):
5554
```
5655
libwebp.lib -> webp.lib
5756
libwebpdemux.lib -> webpdemux.lib
5857
libwebpmux.lib -> webpmux.lib
5958
```
6059

60+
There is a tool named `vcpkg`, a product developed by Microsoft for managing packages for Visual Studio C++ project, it handles it automatically. Please refer the steps from this [web page](https://github.com/microsoft/vcpkg#quick-start-windows). It is advised to clone the vcpkg repository to `splitwebp` root directory, i.e. the folder of `vcpkg` would be `D:\splitwebp\vcpkg`
61+
62+
Alternatively, you may need to modify this line: `link_directories("vcpkg/installed/x64-windows/lib")` in CMakeLists.txt accordingly.
63+
6164

6265
## Steps to compile
6366

6467
1. Prepare the prerequisite
6568

66-
2. Clone this repository to `Repo folder`, eg: `D:\splitwebp`
69+
2. Clone this repository to `splitwebp` root directory, eg: `D:\splitwebp`
6770

68-
3. Create a new folder named `build` under `Repo folder`, eg: `D:\splitwebp\build` (i.e. the `build folder`)
71+
3. Create a new folder named `build` under `splitwebp` root directory, eg: `D:\splitwebp\build` (i.e. the `build folder`)
6972

7073
4. Open `CMD`, change the current directory to `build folder`
7174

72-
5. Run `cmake .. && cmake -DCMAKE_GENERATOR_PLATFORM=x64 --build .`
75+
5. Run `.\vcpkg install pthreads:x64-windows libwebp[core,nearlossless,simd,unicode]:x64-windows`
7376

74-
6. Visit Windows Explorer in `build folder`. Open the Visual Studio Project by double clicking `splitwebp.vcxproj`
77+
6. Run `cmake .. && cmake -DCMAKE_GENERATOR_PLATFORM=x64 --build .`
7578

76-
7. Change Project properties (Solution Explorer > right click `splitwebp` > Properties)
79+
7. Visit Windows Explorer in `build folder`. Open the Visual Studio Project by double clicking `splitwebp.vcxproj`
7780

78-
7.1. pointing Include folder of OpenCV
81+
8. Change Project properties (Solution Explorer > right click `splitwebp` > Properties)
82+
83+
8.1. pointing Include folder of OpenCV
7984

8085
In Properties, go to C/C++ > Additional Include Directories > click on the value and see a pull down menu > click Edit.. > click New Line. And add these paths:
8186

82-
(if your `opencv extrated folder` is `D:\opencv`)
87+
(if your `opencv extracted folder` is `D:\opencv`)
8388

8489
D:\opencv\build\include
85-
D:\opencv\build\include\opencv
86-
D:\opencv\build\include\opencv2
90+
D:\splitwebp\vcpkg\installed\x64-windows\include
8791

88-
7.2. remove `/machine:x86` to build for x64 platform (64 bit). Delete `/machine:x86` in Additional Option, and click Apply.
92+
8.2. remove `/machine:x86` to build for x64 platform (64 bit). Delete `/machine:x86` in Additional Option, and click Apply.
8993
![s](/docs/images/remove-x86.png)
9094

95+
8.3. Add project Environment variable
96+
97+
go to Debugging > go to Environment > click on the value and see a pull down menu > click Edit.. > click New Line. And add these paths:
9198

92-
8. Build solution. click Visual Studio's menu > Build > Build Solution (F7)
99+
PATH=%PATH%;D:\splitwebp\vcpkg\installed\x64-windows\bin
93100

94-
9. If no errors, the compiled exe file should be located at `Release` or `Debug` folder under the `build folder`, eg: `D:\splitwebp\build`
101+
102+
9. Build solution, click Visual Studio's menu > Build > Build Solution (F7)
103+
104+
10. If no errors, the compiled exe file should be located at `Release` or `Debug` folder under the `build folder`, eg: `D:\splitwebp\build`
95105

96106

97107
## Troubleshoot
98108

99109
1) > By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH
100110
101-
Solution: set the `envionment variable` named `OPENCV_DIR`. Open `CMD`, and run this command (This may require Administrator right. ):
111+
Solution: set the `environment variable` named `OPENCV_DIR`. Open `CMD`, and run this command (This may require Administrator right. ):
102112

103113
`setx -m OPENCV_DIR D:\opencv\build\x64\vc15\lib`
104114

@@ -108,18 +118,21 @@ libwebpmux.lib -> webpmux.lib
108118

109119
Solution: Turn on `Microsoft Symbol Servers` for debugging symbol. Please refer to this [web page](https://docs.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2019) for further details.
110120

121+
3) > webp.dll not found
111122
112-
## Glossory
113-
- `CMD` Command Prompt in Windows, accept user's command. Run it by: Start Menu => search "cmd" => click "Command Prompt" OR Start Menu > "Run" > type "cmd" > press Enter
123+
Solution: Press Alt F7 > go to Debugging > go to Environment > click on the value and see a pull down menu > click Edit.. > click New Line. And add these paths:
114124

115-
- `Repo folder` The folder of this repository cloned into your local machine. eg: `D:\splitwebp`
125+
`PATH=%PATH%;D:\splitwebp\vcpkg\installed\x64-windows\bin`
126+
127+
## Glossary
128+
- `CMD` Command Prompt in Windows, accept user's command. Run it by: Start Menu => search "cmd" => click "Command Prompt" OR Start Menu > "Run" > type "cmd" > press Enter
116129

117130
- `build folder` The folder where the Visual Studio project generated by Cmake locates at. eg: `D:\splitwebp\build`
118131

119-
- `PATH envionment variable` This contains the paths that Windows system would try to find out the executive files to run when a user enter a command in CMD. One can view the content by running `echo %PATH%` in CMD.
132+
- `PATH environment variable` contains the paths that Windows system would try to find out the executive files to run when a user enter a command in CMD. One can view the content by running `echo %PATH%` in CMD.
120133

121134
- `System32 folder` An important folder for Windows to run. It contains system files and libraries binary. It usually locates at `C:\Windows\System32`
122135

123-
- `opencv extrated folder` eg: `D:/opencv`
136+
- `opencv extracted folder` eg: `D:/opencv`
124137

125-
- `OPENCV_DIR` This is the path where the library files locates at. It should be inside sub-folders in `opencv extrated folder`, eg: `D:/opencv/build/x64/vc15/lib`
138+
- `OPENCV_DIR` This is the path where the library files locates at. It should be inside sub-folders in `opencv extracted folder`, eg: `D:/opencv/build/x64/vc15/lib`

0 commit comments

Comments
 (0)