Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mostly CMake stuff #106

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Mostly CMake stuff #106

wants to merge 23 commits into from

Conversation

bb010g
Copy link
Member

@bb010g bb010g commented Jul 29, 2020

what if cmake was slightly less bad

Please review the individual commits first before trying to look at the whole change set.


This change is Reviewable

bb010g and others added 16 commits July 28, 2020 20:04
I don't know if we're planning to have this ever be turned off, but at
least the ambiguity between SDL & SDL_GFX is removed.

Also, USE_SDLGFX is renamed to USE_SDL_GFX, to fit CMake's style. (Not
worrying too much since currently -DUSE_SDLGFX doesn't build anyways.)
I have barely tested this, but it's better than no builds to test?

Also, fun fact, launching this build on a fresh user data directory
(no xm.db) corrupts the database because the version doesn't ever get
written! Or something. I had to remove it anyhow while testing.
This module was added in CMake 3.14, but we can vendor it until the next
Debian stable release.
If the build is using system libraries (for bzip2, lua, ode, or
xdgbasedir), there's no need to add the corresponding subdirectories.
This reduces build time and avoids potential mix-ups.

Signed-off-by: Stephen Kitt <steve@sk2.org>
This commit switches over the following:
+ CURL (library, REQUIRED)
+ JPEG (library, REQUIRED)
+ Xml2 (library, REQUIRED)
+ PNG (library, REQUIRED)
+ SQLite3 (library, REQUIRED)
+ ZLIB (library, REQUIRED)
This commit switches over the following:
+ Intl (library, if(USE_GETTEXT) -> REQUIRED)
+ LibLZMA (libary, if(STATIC_BUILD))
+ SDL (library, if(USE_SDL) -> REQUIRED)
+ SDL_gfx (library, if(USE_SDL) -> if(USE_SDL_gfx) -> REQUIRED)
+ SDL_mixer (library, if(USE_SDL) -> REQUIRED)
+ SDL_net (library, if(USE_SDL) -> REQUIRED)
+ SDL_ttf (library, if(USE_SDL) -> REQUIRED)
This commit switches over the following:
+ OpenGL (library, if(USE_OPENGL) -> REQUIRED)
This commit switches over the following:
+ BZip2 (library, system/vendor)
+ Lua (library, system/vendor)
+ ODE (library, system/vendor)
+ XDG (library, system/vendor)

Additionally, the following are brought into style:
+ Chipmunk (library, vendor)
+ Md5sum (library, vendor)
+ Glad (generated) (library, vendor)
@bb010g bb010g requested a review from Nikekson July 29, 2020 11:25
@bb010g
Copy link
Member Author

bb010g commented Jul 29, 2020

alright, looks like 3.13 is too much for Travis:

Operating System Details
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
  CMake 3.13.4 or higher is required.  You are running version 3.12.4

so going through the documentation again to make sure everything's compatible will be fun. (how are they behind Debian stable?)

EDIT: ah, it's an LTS behind (20.04 is latest)

@bb010g
Copy link
Member Author

bb010g commented Jul 29, 2020

ugh, 3.13 added INTERFACE_LINK_DIRECTORIES and i'm using that

https://cmake.org/cmake/help/v3.13/release/3.13.html

@bb010g
Copy link
Member Author

bb010g commented Jul 29, 2020

Thought: it's reasonable to ask for CMake from backports if you're a LTS behind on your distribution.

Copy link
Member

@Nikekson Nikekson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, 11 of 11 files at r4, 12 of 12 files at r5, 4 of 4 files at r6, 4 of 4 files at r7, 1 of 1 files at r8, 1 of 1 files at r9, 1 of 1 files at r10, 14 of 14 files at r11, 2 of 2 files at r12, 10 of 10 files at r13, 2 of 2 files at r14, 1 of 1 files at r15, 11 of 11 files at r16.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

This only worked on my system because of `if(NOT Intl_LIBRARY)`.
@bb010g bb010g force-pushed the nix branch 8 times, most recently from b746cc8 to ea87f5b Compare July 30, 2020 22:23
@bb010g bb010g force-pushed the nix branch 3 times, most recently from 03aeca7 to 885a7ee Compare July 30, 2020 22:34
@bb010g
Copy link
Member Author

bb010g commented Jul 30, 2020

Okay, fun facts from debugging Travis CI's CMake:

X-Moto allows certain libraries to be provided either by the system or
X-Moto's source tree itself, as vendored dependencies. (Not all vendored
dependencies may be provided by the system, such as Chipmunk.) These are
called vendorable libraries here.

With a USE_SYSTEM_* option ON, that vendorable library is system. With a
USE_SYSTEM_* option OFF, that vendorable library may be either system or
vendored.

With the USE_SYSTEM option OFF, all USE_SYSTEM_* options are OFF.
With the USE_SYSTEM option ON, all USE_SYSTEM_* options default ON.

With a PREFER_SYSTEM_* option ON, that vendorable library is searched
for and is system if found.

With the PREFER_SYSTEM option ON, all PREFER_SYSTEM_* options default
ON. With the PREFER_SYSTEM option OFF, all PREFER_SYSTEM_* options are
OFF.

With the USE_SYSTEM option OFF, the PREFER_SYSTEM option defaults ON.
With the USE_SYSETM option ON, the PREFER_SYSTEM option is OFF.

The upshot of all this is that USE_SYSTEM ON means libraries are
explicitly either system or vendored, with failed system searches
erroring instead of falling back to vendored, and both USE_SYSTEM &
PREFER_SYSTEM OFF means all libraries are vendored.

This should be good for maintainers?
Yes:

    #include <lua.h>

No:

    #include <lua/lua.h>
wheee Travis has CMake 3.12.4
@bb010g bb010g force-pushed the nix branch 8 times, most recently from ff025e9 to c715e45 Compare July 31, 2020 01:31
@sonarcloud
Copy link

sonarcloud bot commented Sep 4, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 25 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

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

Successfully merging this pull request may close these issues.

None yet

3 participants