developing_in_windows_vcpkg.md (2955B)
1 # Developing on Windows with Visual Studio 2019 2 3 These instructions assume an up-to-date Windows 10 (e.g. build 19041.928) with 4 **Microsoft Visual Studio 2019** (e.g. Version 16.9.0 Preview 4.0) installed. If 5 unavailable, please use another build environment: 6 7 * [MSYS2 on Windows](developing_in_windows_msys.md) 8 * [Crossroad on Linux](developing_with_crossroad.md) (cross compilation for Windows) 9 10 ## Minimum build dependencies 11 12 Apart from the dependencies in third_party, some of the tools use external 13 dependencies that need to be installed in your system first. 14 15 Please install [vcpkg](https://vcpkg.readthedocs.io/en/latest/examples/installing-and-using-packages/) 16 (tested with version 2019.07.18), and use it to install the following libraries: 17 18 ``` 19 vcpkg install gtest:x64-windows 20 vcpkg install giflib:x64-windows 21 vcpkg install libjpeg-turbo:x64-windows 22 vcpkg install libpng:x64-windows 23 vcpkg install zlib:x64-windows 24 ``` 25 26 ## Building 27 28 From Visual Studio, open the CMakeLists.txt in the JPEG XL root directory. 29 Right-click the CMakeLists.txt entry in the Folder View of the Solution 30 Explorer. In the context menu, select CMake Settings. Click on the green plus 31 to add an x64-Clang configuration and the red minus to remove any non-Clang 32 configuration (the MSVC compiler is currently not supported). Click on the blue 33 hyperlink marked "CMakeSettings.json" and an editor will open. Insert the 34 following text after replacing $VCPKG with the directory where you installed 35 vcpkg above. 36 37 ``` 38 { 39 "configurations": [ 40 { 41 "name": "x64-Clang-Release", 42 "generator": "Ninja", 43 "configurationType": "MinSizeRel", 44 "buildRoot": "${projectDir}\\out\\build\\${name}", 45 "installRoot": "${projectDir}\\out\\install\\${name}", 46 "cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=$VCPKG/scripts/buildsystems/vcpkg.cmake", 47 "buildCommandArgs": "-v", 48 "ctestCommandArgs": "", 49 "inheritEnvironments": [ "clang_cl_x64" ], 50 "variables": [ 51 { 52 "name": "VCPKG_TARGET_TRIPLET", 53 "value": "x64-windows", 54 "type": "STRING" 55 }, 56 { 57 "name": "JPEGXL_ENABLE_TCMALLOC", 58 "value": "False", 59 "type": "BOOL" 60 }, 61 { 62 "name": "BUILD_GMOCK", 63 "value": "True", 64 "type": "BOOL" 65 }, 66 { 67 "name": "gtest_force_shared_crt", 68 "value": "True", 69 "type": "BOOL" 70 }, 71 { 72 "name": "JPEGXL_ENABLE_FUZZERS", 73 "value": "False", 74 "type": "BOOL" 75 }, 76 { 77 "name": "JPEGXL_ENABLE_VIEWERS", 78 "value": "False", 79 "type": "BOOL" 80 } 81 ] 82 } 83 ] 84 } 85 ``` 86 87 The project is now ready for use. To build, simply press F7 (or choose 88 Build All from the Build menu). This writes binaries to 89 `out/build/x64-Clang-Release/tools`. The main [README.md](../README.md) explains 90 how to use the encoder/decoder and benchmark binaries.