Chlumsky / msdf-atlas-gen

MSDF font atlas generator
MIT License
783 stars 175 forks source link

does this build for linux? #90

Closed Phildo closed 12 months ago

Phildo commented 1 year ago

I've been trying to get this to build for ubuntu 20.04 and am failing.

I've

git clone git@github.com:Chlumsky/msdf-atlas-gen
cd msdf-atlas-gen
git submodule init
git submodule update
sudo vcpkg install
mkdir build
cd build
cmake ..

and hit a bunch of errors. I've tried to chase down any missing needed libraries and sudo apt-get install'd them, I've installed vcpkg on my system and set /opt/vcpkg as VCPKG_ROOT in my .bashrc, I've run vcpkg install in the msdf-atlas-gen directory: what am I supposed to be doing that I'm not?

My latest error is that it can't find tinyxml2, even though I see it in the vcpkg_installed directory, and I've sudo apt-get install libtinyxml2-dev'd.

Chlumsky commented 1 year ago

If you have the required libraries installed, you can use CMake with MSDF_ATLAS_USE_VCPKG set to OFF. If you want to use vcpkg to fetch the libraries, then set MSDF_ATLAS_USE_VCPKG to ON and make sure to set CMAKE_TOOLCHAIN_FILE.

Phildo commented 12 months ago

ah my problem was I set my VCPKG_ROOT to /opt/vcpkg (I'm new to using vcpkg) in my .bashrc, which is a directory that requires sudo permissions, so when running things as !root it saw the VCPKG_ROOT env variable, but didn't have permission to use it, and when running things as root it didn't see the VCPKG_ROOT variable.

so the list of commands which should result in a successful build off a fresh ubuntu install is:

cd ~
# get build tools
sudo apt-get update
sudo apt-get install git cmake zip unzip build-essential pkg-config
# install vcpkg
wget -qO vcpkg.tar.gz https://github.com/microsoft/vcpkg/archive/master.tar.gz
sudo mkdir /opt/vcpkg
sudo tar xf vcpkg.tar.gz --strip-components=1 -C /opt/vcpkg
sudo /opt/vcpkg/bootstrap-vcpkg.sh
sudo ln -s /opt/vcpkg/vcpkg /usr/local/bin/vcpkg
rm -rf vcpkg.tar.gz
# get msdf-atlas-get
git clone git@github.com:Chlumsky/msdf-atlas-gen
cd msdf-atlas-gen
git submodule init
git submodule update
# build
mkdir build
cd build
sudo VCPKG_ROOT=/opt/vcpkg cmake ..
sudo make
# binary now exists in ~/msdf-atlas-gen/build/bin/msdf-atlas-gen