Damdoshi / LibLapin

Multimedia library for rookies and prototyping
http://hangedbunnystudio.com
Other
36 stars 9 forks source link

(WIP) Switch to CMake #14

Open d0p1s4m4 opened 4 years ago

d0p1s4m4 commented 4 years ago

First I'll understand if this PR is rejected, because I change the whole build system.

But I'll explain why:

What this PR include:

/!\ This PR is work in progress but it's work. It's more as an PoC (quick'n'dirty), in order to demonstrate and ask if it's okay before working much deeper on it (clean code and add others tests)

Milerius commented 4 years ago

Hey i highly advice to use Github Actions instead of travis now supporting OSX, Windows and linux directly from github

Milerius commented 4 years ago

Makefile and old build system can coexisting with CMake this is not a problem.

mkdir build && cd build && cmake ../

create a Makefile in the build directory, let the choice to the user of which build system he want to use

Milerius commented 4 years ago

You can add the following line at the top of the CMakeLists.txt:

if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
    message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the source code and call cmake from there")
endif ()

So the user is aware that he need to create a build directory and call CMake from here

Milerius commented 4 years ago

Don't forget also that the project is made for school learning of graphics.

You cannot remove the old build system, because students have to learn how works Makefile before using a generator of Makefile. So both need to be supported.

@Damdoshi Work in a school as a pedagogical lead. His students will probably learn how to do their own makefiles and use bunny library from a raw Makefile

Milerius commented 4 years ago

I think doing a CMakeLists.txt is a great idea.

But I think that contrary to the classic Makefile we will have to customize much more to build on a maximum platform

Milerius commented 4 years ago

I already told @Damdoshi , that by default the liblapin incorporates too many things, things we do not necessarily need (based on CMake options), with CMake we will be able to detect the sources we need before generating the static library, much more flexible, (pay for what you're really going to use)

Milerius commented 4 years ago

The huge advantage that CMake will bring here is that for example for SFML we can build at the time of build the liblapin and thus avoid installing a package for SFML on its operating system, it is what I do in my personal project

Damdoshi commented 4 years ago

Hello,

Thank you for your contribution. I think it will certainly be added, I just have to take the time to check it seriously... as I'm not well versed into cmake. Milerius is right about the fact I may need to keep a Makefile for educational purpose, but it does not remove the beneficial of having a cmakelist. It would be great to ease the future splitting.

Good night x')