Skip to content

Latest commit

 

History

History
223 lines (154 loc) · 7.18 KB

BUILD.md

File metadata and controls

223 lines (154 loc) · 7.18 KB

Build

Get source

git clone --recursive -j4 https://gitlab.com/MangaD/hf-workshop.git

Init submodules:

git submodule update --init --recursive

Pull submodules:

git submodule update --recursive --remote

Using GNU Make (Windows, Linux, Mac)

Install build tools

Linux

Debian/Ubuntu/Mint: $ sudo apt-get install build-essential g++ g++-multilib libpthread-stubs0-dev

For using zlib: $ sudo apt-get install zlib1g-dev
If using XZ Utils: $ sudo apt-get install liblzma-dev
For using minizip: $ sudo apt-get install libminizip-dev
For using gettext: $ sudo apt-get install gettext
For using readline (not in use): $ sudo apt-get install libreadline-dev
For using editline: $ sudo apt-get install libedit-dev

RedHat/CentOS/Fedora: $ sudo yum install gcc gcc-c++ glibc-devel libgcc libstdc++-devel glibc-devel.i686 libgcc.i686 libstdc++-devel.i686

For using zlib: $ sudo yum install zlib-devel zlib-devel.i686
If using XZ Utils: $ sudo yum install xz-devel xz-devel.i686
For using minizip: $ sudo yum install minizip-devel minizip-devel.i686
For using gettext: $ sudo yum install gettext-devel gettext-devel.i686 intltool
For using readline (not in use): $ sudo yum install readline-devel readline-devel.i686
For using editline: $ sudo yum install libedit-devel libedit-devel.i686

Arch: $ sudo pacman -S base-devel

For using zlib: $ sudo pacman -S zlib
If using XZ Utils: $ sudo pacman -S xz
For using minizip: $ sudo pacman -S minizip
For using gettext: $ sudo pacman -S gettext
For using readline (not in use): $ sudo pacman -S readline
For using editline: $ sudo pacman -S libedit

Compiler flags:

zlib: -lz
xz: -llzma
minizip: -lminizip
readline (not in use): -lreadline and on windows also -ltermcap
editline: -ledit on Linux. -ledit_static on Windows.
gettext: on windows -lintl

Windows

MinGW Compiler
  • Download latest MinGW

  • Install MinGW

    • Architecture: i686 - for compiling 32 bit programs
    • Architecture: x86_64 - for compiling 64 bit programs
    • Threads: posix
  • Copy "mingw32-make.exe" and rename the copy to "make.exe"

  • Put the MinGW bin folder in the path

MinGW extra libraries

32-bit:

64-bit:

If using XZ Utils:

Build

Use $ make debug for debug and $ make release for release. If compiling for a specific architecture use:

Debug 32-bit

$ make debug32

Debug 64-bit

$ make debug64

Release 32-bit

$ make release32

Release 64-bit

$ make release64

Release Windows XP

$ make winxp

Note: It is possible to compile with Clang by setting CXX environment variable to clang++. $ CXX=clang++ make

Using cmake (Windows, Linux and Mac)

CMake 2.8.12 or higher is required.

Install build tools

Debian/Ubuntu/Mint: $ sudo apt-get install build-essential g++ g++-multilib libpthread-stubs0-dev zlib1g-dev liblzma-dev libminizip-dev gettext libedit-dev cmake

RedHat/CentOS/Fedora: $ sudo yum install gcc gcc-c++ glibc-devel libgcc libstdc++-devel glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 zlib-devel zlib-devel.i686 xz-devel xz-devel.i686 minizip-devel minizip-devel.i686 gettext-devel gettext-devel.i686 intltool libedit-devel libedit-devel.i686 cmake

Arch: $ sudo pacman -S base-devel zlib xz minizip gettext libedit cmake

Windows: Download Cmake. You need either MinGW or Visual Studio.

Build

$ mkdir build
$ cd build

Use -DCMAKE_BUILD_TYPE:STRING=Debug for debug and -DCMAKE_BUILD_TYPE:STRING=Release for release.

Generate Unix Makefile $ cmake ..

Generate Unix CodeBlocks project: $ cmake -G "CodeBlocks - Unix Makefiles" ..

Generate MinGW Makefile: $ cmake -G "MinGW Makefiles" ..

Generate MinGW CodeBlocks project: $ cmake -G "CodeBlocks - MinGW Makefiles" ..

Generate Visual Studio 2015 project: $ cmake -G "Visual Studio 14 2015" ..

Generate Visual Studio 2015 project (64-bit): $ cmake -G "Visual Studio 14 2015 Win64" ..

...

Visual Studio

Install Windows 10 SDK: https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk

Using PowerShell:

cd .\hf-workshop\build

# Install vcpkg - A C++ package manager
# https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=vs-2019
# https://devblogs.microsoft.com/cppblog/vcpkg-updates-static-linking-is-now-available/
git clone https://github.com/Microsoft/vcpkg
cd .\vcpkg
.\bootstrap-vcpkg.bat

# Search library example
.\vcpkg.exe search zlib

# Install libraries
.\vcpkg.exe install zlib:x86-windows-static
.\vcpkg.exe install zlib:x64-windows-static
.\vcpkg.exe install editline:x86-windows-static
.\vcpkg.exe install editline:x64-windows-static
.\vcpkg.exe install gettext:x86-windows-static
.\vcpkg.exe install gettext:x64-windows-static

# Make libraries available
.\vcpkg.exe integrate install

# Build project
cd ..
# Must be full path
cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/Users/David/Desktop/hf-workshop/build/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static

# Open .sln with VS
# Change DEBUG to RELEASE
# HFWorkshop -> Properties -> Linker -> Input - Add:
#     vcpkg\installed\x64-windows-static\lib\readline.lib
#     vcpkg\installed\x64-windows-static\lib\libintl.lib
# build ALL_BUILD

LZMA SDK

The files on /libraries/lzma were downloaded from https://www.7-zip.org/sdk.html.

Only the C folder matters. The Makefile is made by MangaD.