Skip to content

Latest commit

 

History

History
171 lines (106 loc) · 4.84 KB

BUILD.md

File metadata and controls

171 lines (106 loc) · 4.84 KB

Build

Get source

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

Using GNU Make (Windows, Linux, Mac)

Install build tools

Linux

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

For using zlib: $ sudo apt-get install zlib1g-dev
If using XZ Utils: $ sudo apt-get install liblzma-dev

RedHat/CentOS/Fedora: $ sudo yum install gcc gcc-c++ glibc-devel libgcc libstdc++-devel glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 catch2-devel catch2-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

Arch: $ sudo pacman -S base-devel catch2

For using zlib: $ sudo pacman -S zlib
If using XZ Utils: $ sudo pacman -S xz

Compiler flags:

zlib: -lz
xz: -llzma

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

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 zlib1g-dev liblzma-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 cmake

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

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

Build

$ mkdir build
$ cd build

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

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 .\libswf\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
.\vcpkg.exe install zlib:x64-windows
.\vcpkg.exe install zlib:x86-windows-static
.\vcpkg.exe install zlib:x64-windows-static

.\vcpkg.exe install catch2:x86-windows
.\vcpkg.exe install catch2:x64-windows
.\vcpkg.exe install catch2:x86-windows-static
.\vcpkg.exe install catch2:x64-windows-static

# Make libraries available
.\vcpkg.exe integrate install

# Build project
cd ..
# Must be full path
cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_TOOLCHAIN_FILE=C:/Users/XXX/Desktop/libswf/build/vcpkg/scripts/buildsystems/vcpkg.cmake #-DVCPKG_TARGET_TRIPLET=x64-windows-static

# Open .sln with VS
# Change DEBUG to RELEASE
# 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.