2_compile_and_run.md 2.4 KB

Compilation and start

Common for all GNU systems

  1. For the sake of completeness - obtain the project and change directory to its root:

    git clone https://notabug.org/namark/truwo
    cd truwo
    
  2. If you had to manually install the c++ compiler it's like not the default one, so will need to manually specify it for make:

    export CXX=g++-7
    

    Otherwise, skip this step.

  3. Fetch and install dependencies:

    ./tools/setup/init.sh
    
  4. Compile the project itself:

    make
    
  5. After compilation the executable file will be created in the out folder. You can run it like so:

    ./out/truwo ""
    

    It can be used as is, or installed system wide using make install (or checkinstall on Debian based systems). make unisntall will uninstall it (use package manager in case of checkinstall).

That should be about it.

Cygwin MinGW specifics

You'll need to copy or clone the project into the home directory in cygwin.
Cygwin root is the folder you specified during installation.
All the commands below will need to be carried out in cygwin terminal that should have a shortcut on the desktop.
The terminal will start in your home folder by default, so you can just clone the project right there (step 1 above).

For some (probably very good) reason, MinGW would not be installed as default toolchain, so the compiler and the archiver will need to be specified manually before step 3:

export CXX=x86_64-w64-mingw32-g++ # compiler variable
export AR=x86_64-w64-mingw32-ar # archiver variable

Now, SDL does some shenanigans with the main function, that didn't work for me, so had do disable that for step 4:

export CXXFLAGS="-DSDL_MAIN_HANDLED"

You can try to skip this and see if it works for you, or try some other solutions to the problem.
Before proceeding with step 5 there is the timeless problem of dlls to solve. Fortunately it seems pretty easy with this setup, need to just copy over all the dlls from mingw bin:

cp /usr/x86_64-w64-mingw32/sys-root/bin/*.dll ./out/

That's it! Here is an overview:

git clone https://notabug.org/namark/truwo
cd truwo
export CXX=x86_64-w64-mingw32-g++
export AR=x86_64-w64-mingw32-ar
./tools/setup/init.sh
export CXXFLAGS="-DSDL_MAIN_HANDLED"
make
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll ./out/
./out/truwo ""




More on some of these makeshift tools