Hướng dẫn Compile x265 trên Windows

Bài viết dưới đây hướng dẫn cách build x265 trên Windows. Có một cách khác là sử dụng Visual Studio (với Visual C từ 9.0 trở lên bằng cách chạy file make-solution.bat tương ứng).

Bước 1:

Download file “MSYS_MinGW-w64_GCC_482_x86-x64_Full.7z

http://xhmikosr.1f0.de/tools/

– Download CMake từ http://www.cmake.org/cmake/resources/software.html (Bản Windows Installer).

– Download Mercurial: http://mercurial.selenic.com/ bản Windows Installer.

Bước 2: Giải nén file MSYS_MinGW-w64_GCC_482_x86-x64_Full.7z

– Tìm file MSYS\etc\fstab.sample, đổi tên file thành fstab.

– Chỉnh sửa lại bằng Notepad. Giả sử đường dẫn giải nén MSYS là E: thì sửa lại 2 dòng đường dẫn dưới dòng #Win32_Path Mount_Point như sau:

e:/MSYS/mingw /mingw

e:/MSYS/home /home

– Chạy file msys.bat để tạo Home Directory.

Bước 3: Cài đặt CMake và Mercurial.

– Lưu ý chọn “Add CMake to the system PATH for all users” trong quá trình cài đặt CMake.

– Khi cài đặt Mercurial cần chọn “Add the installation path to the search path is selected”.

Sau khi cài đặt xong, kiểm tra lại bằng cách vào Properties của My Computer > Advanced System Settings > Environment Variables. Nếu có “CMake 2.8bin” và “Mercurial” là ok.

Bước 4: Mở Command Prompt (Run > cmd)Chọn đường dẫn muốn lưu source của x265, mặc định trên Windows 7/8 là C:\Users<Tên người dùng>

Gõ lệnh sau:

hg clone https://bitbucket.org/multicoreware/x265

Bước 5: Chuyển cả folder x265 vào folder MSYS.- Chạy file msys.bat. Gõ:

cd x265/build/msys

Enter và tiếp tục gõ lệnh:

cmake -G “MSYS Makefiles” ../../source && cmake-gui ../../source
Để tiến hành thiết lập tool-chain.Cửa sổ trông sẽ thế này:

Một cửa sổ CMake sẽ hiện ra. Download file YASM từ đây: http://yasm.tortall.net/Download.html (Ví dụ Windows 64bit thì chọn Win64 general use), chuyển file exe vừa download vào thư mục cài đặt CMake (C:Program Files (x86)\CMake 2.8\bin).

Nhấn Configure rồi nhấn Generate:

Quay lại cửa sổ MinGW, gõ:

make
Quá trình compile bắt đầu, sau khi hoàn tất sẽ có file x265.exe ở thư mục E:\MSYS\x265\build\msys

Ngoài ra còn có các file khác x265.lib để làm thư viện mở rộng cho các ứng dụng khác.