[build] CMake: no option to install extra headers: `rcamera.h`, `rlgl.h`, `raymath.h`
Ezbob opened this issue · comments
Hello,
I trying to set up a simple 3D first person game by including the latest release of Raylib 5.0 through the Conan dependency manager, using the 3D first person example from this repository.
As you know, the example uses the rcamera.h
header to do the camera calculations, but I have trouble including that header file.
What I can read from https://github.com/raysan5/raylib/wiki/raylib-architecture , the rcamera.h
header comes as a separated header modules located in the source directory of the raylib project. This is all fine if you have access to the source directory when you need to build the game, but I only have access to the header files installed by building the install
target (a standard CMake target) since these are prebuilt and downloaded by the Conan dependency manger.
I have made an ticket with the Conan dependency manager (conan-io/conan-center-index#24368) and they have told me to contact you.
I have also tried doing cmake --build <build> --target install
, after a configuration step where I set the CMAKE_INSTALL_TARGET
variable, to check the installed headers, and the header files installed are only:
- raylib.h
- raymath.h
- rlgl.h
Which seems to correspond with the public header declaration in https://github.com/raysan5/raylib/blob/ae50bfa2cc569c0f8d5bc4315d39db64005b1b08/src/CMakeLists.txt#L24
.
There seems to some options to customize the build different in https://github.com/raysan5/raylib/blob/ae50bfa2cc569c0f8d5bc4315d39db64005b1b08/CMakeOptions.txt , but I have tried to enable SUPPORT_CAMERA_SYSTEM
, CUSTOMIZE_BUILD
and INCLUDE_EVERYTHING
, to no avail; no extra headers were included in the install tree.
What is the intended way of procuring headers from the extra modules such as rcamera.h
and is there some way to install these through CMake?
Would it not make sense to add rcamera.h
to the list of public headers when SUPPORT_CAMERA_SYSTEM
is on? Or add an extra option to do so?
Thanks for your time.
Please, before submitting a new issue verify and check:
- I tested it on latest raylib version from master branch
- I checked there is no similar issue already reported
- I checked the documentation on the wiki
- My code has no errors or misuse of raylib
Issue description
See above.
Environment
Windows 10
CMake version 3.26.4
Visual Studio 17 2022
Issue Screenshot
Code Example
Get the Raylib 5.0 source, and in the root run:
cmake -DCMAKE_INSTALL_PREFIX=install -DCUSTOMIZE_BUILD=ON -DSUPPORT_CAMERA_SYSTEM=ON -DINCLUDE_EVERYTHING=ON -S . -B build
cmake --build build
cmake --build build --target install
In a terminal of your choice. Then after the build is done the install
directory should contain the include
and lib
directories with the installed headers and libraries, respectively, but no rcamera.h
header file.
@Peter0x44 Please, could you take a look to this issue? Do you think those libraries should be exposed?
Hello, I can see that you have changed the title to include the rlgl.h
and raymath.h
headers. These headers are installed after building the install
target. The headers that is missing are rcamera.h
and also the rgestures.h
header.
I have a PR (not posted yet) that adds these headers to the list of public headers (and thus installed) by default, and then you can use USE_*
variables to disable the installation of them.
Would this be a good solution?
I do see an argument for not exposing rcamera.h, as users can easily make their own camera controllers (and probably should).
@Peter0x44 thanks for letting me know, I prefer to keep the build system aligned with Makefile, in any case, users requiring the additional headers can just copy them, they don't need to be included in the build system, adding complexity and maintenance cost.