Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Compilation error with custom Allegro 4 include dir #73

Open
msikma opened this issue Oct 21, 2017 · 7 comments
Open

Compilation error with custom Allegro 4 include dir #73

msikma opened this issue Oct 21, 2017 · 7 comments

Comments

@msikma
Copy link

msikma commented Oct 21, 2017

Hi there. I'm trying to compile this project on OSX (10.12.6), but I've got a bit of a weird setup. Allegro 4 cannot easily be compiled anymore on modern OSX, so I compiled a version using the OSX 10.4 SDK that will run on modern versions. (Last time I tried, the brew allegro4 install script was broken.)

Since I'm using this build of Allegro 4, I need to ensure that it can find the library and include files, which I currently do by configuring with: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_ALLEGRO4:BOOL=ON -DALLEGRO_INCLUDE_DIR="/Users/msikma/liballeg.4.4.2-osx/include/" -DALLEGRO_LIBRARY="/Users/msikma/liballeg.4.4.2-osx/lib/liballeg.4.4.2.dylib" ..

However, as soon as the compilation reaches Allegro, it errors out:

/Users/msikma/Source/dumb/src/allegro/alplay.c:22:10: fatal error: 'allegro.h' file not found

If I run make -n to find the command it's trying to run, and manually add -I/Users/msikma/liballeg.4.4.2-osx/include to it, the compilation succeeds.

Is there any way I could add the passed ALLEGRO_INCLUDE_DIR to the compilation commands during generation? I'm not really very familiar with Cmake so any help would be appreciated...

@Rondom
Copy link
Contributor

Rondom commented Oct 22, 2017

This is a bug in our CMakeLists.txt. I will go about submitting a PR tomorrow.

@msikma
Copy link
Author

msikma commented Oct 22, 2017

Is it a matter of adding include_directories(${ALLEGRO_INCLUDE_DIR}) to the BUILD_ALLEGRO4 statement? That seems to work.

@msikma
Copy link
Author

msikma commented Oct 22, 2017

Oh, I just realized also that the following line in cmake-scripts/FindAllegro4.cmake might be problematic:

exec_program(allegro-config ARGS --libs OUTPUT_VARIABLE ALLEGRO_LIBRARY)

If I'm linking to an Allegro library somewhere else, allegro-config won't work and the configuration will have an invalid value in it:

...
-- Found Allegro: /bin/sh: allegro-config: command not found
...

Didn't mention this before since I modified this file to get it to work and forgot about it.

@Rondom
Copy link
Contributor

Rondom commented Oct 24, 2017

The first issue with the include path is fixed by cab1803.

Regarding the second issue, is there a standard environment variable that is used in other build systems to specify the path to the allegro-config binary?

Adding the directory to your path during the invocation of cmake should also help, without you needing to modify any files.

@SimonN
Copy link
Contributor

SimonN commented Oct 24, 2017

I don't think Allegro 4 had a standard variable for its binaries. They're generally expected to be in the path, thereore I would add your local A4 directory to your path variable.

@msikma
Copy link
Author

msikma commented Oct 24, 2017

I'm not sure if it's necessary to have allegro-config. As far as I can tell, just setting the $ALLEGRO_LIBRARY manually is sufficient, so it's possible to just check if that variable is set and if not to run allegro-config. This makes it possible to link to Allegro 4 without having to actually have it installed and in the path.

In my case this is useful because I'm actually cross-compiling, so I'm not actually installing A4, but just linking to it.

@SimonN
Copy link
Contributor

SimonN commented Oct 24, 2017

check if that variable is set and if not to run allegro-config

This is a good idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants