Skip to content

Compilation errors #2

Description

@bztsrc

Cmake doesn't work. Thanks to dulsi who pointed out the error, this modification to CMakeLists.txt fixed it:

- find_package(SDL2_Image REQUIRED)
- find_package(SDL2_Mixer REQUIRED)
+ find_package(SDL2_image REQUIRED)
+ find_package(SDL2_mixer REQUIRED)

Otherwise I've created a Cmake-free version too, put this to "src/Makefile", It Just Works™.

TARGET=../openggs
SRCS=$(wildcard *.cpp)
OBJS=$(SRCS:.cpp=.o)
CFLAGS=-I/usr/include/SDL2
LIBS=-lSDL2 -lSDL2_mixer -lSDL2_image

all: $(OBJS) $(TARGET)

%.o: %.cpp
	g++ $(CFLAGS) -c $<

$(TARGET): $(OBJS)
	g++ $(OBJS) -o $(TARGET) $(LIBS)

clean:
	rm *.o $(TARGET)

BTW, you should change the includes in the sources, for example

- #include <SDL.h>
+ #include <SDL2/SDL.h>

and then there's no need for the CFLAGS variable, and it will work on any configuration too (headers could be installed in /usr/local/include too for example).

Finally, it wouldn't hurt to add this to the README:

Compilation
-----------

GNU/make: go to the "src" directory and run
\```
make
\```

CMake: in the project's directory, run
\```
cmake .
make
\```

Otherwise awesome rewrite, thank you very much! Very nostalgic!!!

Cheers,
bzt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions