Skip to content
New issue

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

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

Already on GitHub? # to your account

🔨 CMake buildsystem overhaul #2774

Merged
merged 15 commits into from
Dec 3, 2021

Conversation

AnotherFoxGuy
Copy link
Member

Yes, it is that time of the year again to do an overhaul of the cmake buildsystem

Features:

  • Unified the dependencies in one file, this makes it easier to see what versions are being used
  • On-demand fallback on Conan 1
  • Improved support for building without Conan
  • Added support for finding dependencies with pkg-config
  • Removed the pmm cmake-module

1 Setting the cmake option ROR_LIB_PREFERENCE to SYSTEM will search the system first for dependencies, and then fall back on the Conan package if it hasn't been found

@tritonas00
Copy link
Collaborator

tritonas00 commented Aug 8, 2021

git clone --recursive https://github.com/AnotherFoxGuy/rigs-of-rods -b build-sys-V3
cd rigs-of-rods
cmake -DCMAKE_PREFIX_PATH=/home/babis/Downloads/ror-dependencies/Dependencies_Linux/ -DCMAKE_BUILD_TYPE=RelWithDebInfo .
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using conan: OFF
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OGRE
--   static     : OFF
--   components : Bites;HLMS;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain
--   plugins    : Plugin_CgProgramManager;Plugin_OctreeSceneManager;Plugin_ParticleFX;RenderSystem_GL;Codec_STBI;Codec_FreeImage;Codec_EXR
--   media      : /home/babis/Downloads/ror-dependencies/Dependencies_Linux/share/OGRE/Media
-- Using 'OGRE' system library (Found by find_package)
-- Checking for module 'openal >= 1.18'
--   Found openal , version 1.21.1
-- Using 'OpenAL' system library (Found by pkg_config)
-- Added inteface OpenAL::OpenAL /home/babis/Downloads/ror-dependencies/Dependencies_Linux/include;/home/babis/Downloads/ror-dependencies/Dependencies_Linux/include/AL /home/babis/Downloads/ror-dependencies/Dependencies_Linux/lib/libopenal.so
-- Checking for module 'ois >= 1.4'
--   Package 'ois', required by 'virtual:world', not found
-- Looking for OIS...
-- OIS_PREFIX_PATH changed.
-- Checking for module 'OIS'
--   Package 'OIS', required by 'virtual:world', not found
-- Found OIS: /home/babis/Downloads/ror-dependencies/Dependencies_Linux/lib/libOIS.so
-- Using 'OIS' system library (Found by find_package)
-- Found MyGUI: /home/babis/Downloads/ror-dependencies/Dependencies_Linux/include/MYGUI  
-- Using 'MyGUI' system library (Found by find_package)
-- Checking for module 'socketw >= 3.10'
--   Package 'socketw', required by 'virtual:world', not found
-- Found SocketW: /home/babis/Downloads/ror-dependencies/Dependencies_Linux/include  
-- Using 'SocketW' system library (Found by find_package)
-- Found AngelScript: /home/babis/Downloads/ror-dependencies/Dependencies_Linux/include  
-- Using 'AngelScript' system library (Found by find_package)
-- Checking for module 'libcurl >= 7.6'
--   Found libcurl , version 7.78.0
-- Using 'CURL' system library (Found by pkg_config)
-- Added inteface CURL::libcurl  /usr/lib/libcurl.so
-- Found Caelum: /home/babis/Downloads/ror-dependencies/Dependencies_Linux/include/Caelum  
-- Using 'Caelum' system library (Found by find_package)
-- Could NOT find PagedGeometry (missing: PagedGeometry_INCLUDE_DIRS PagedGeometry_LIBRARIES) 
CMake Error at cmake/DependenciesFunctions.cmake:164 (message):
  Failed to find the system package PagedGeometry
Call Stack (most recent call first):
  cmake/DependenciesConfig.cmake:66 (add_external_lib)
  CMakeLists.txt:111 (include)


-- Configuring incomplete, errors occurred!
See also "/home/babis/Downloads/ror-dependencies/rigs-of-rods/CMakeFiles/CMakeOutput.log".
See also "/home/babis/Downloads/ror-dependencies/rigs-of-rods/CMakeFiles/CMakeError.log"

Did you remove the PagedGeometry submodule?

@AnotherFoxGuy
Copy link
Member Author

Did you remove the PagedGeometry submodule?

Yes, PagedGeometry got moved back into its own package since I don't see a benefit to having it vendored

@tritonas00
Copy link
Collaborator

Ok then i will re add it in ror-dependencies.

@tritonas00
Copy link
Collaborator

tritonas00 commented Aug 8, 2021

OK i added it RigsOfRods/ror-dependencies#51 but now i get

CMake Error at cmake/DependenciesFunctions.cmake:164 (message):
  Failed to find the system package discord_rpc
Call Stack (most recent call first):
  cmake/DependenciesConfig.cmake:81 (add_external_lib)
  CMakeLists.txt:111 (include)

Shouldn't this be optional? -DUSE_DISCORD_RPC=OFF doesn't work

@AnotherFoxGuy
Copy link
Member Author

AnotherFoxGuy commented Aug 8, 2021

It is optional, the option to disable it is now called ROR_USE_DISCORD_RPC
(All the dependencies options are now grouped under ROR_USE_*)

@tritonas00
Copy link
Collaborator

tritonas00 commented Aug 8, 2021

OK compiled, but it ended up with wrong plugins.cfg

It should be

PluginFolder=/home/babis/Downloads/ror-dependencies/Dependencies_Linux/lib/OGRE

but it was

PluginFolder=.

And caelum plugin line missing

Should be

Plugin=../libCaelum.so

After those, everything works fine.

@AnotherFoxGuy
Copy link
Member Author

And caelum plugin line missing

That is because paroj dropped the Plugin API
OGRECave/ogre-caelum@70bebc7

@tritonas00
Copy link
Collaborator

tritonas00 commented Aug 9, 2021

And caelum plugin line missing

That is because paroj dropped the Plugin API
OGRECave/ogre-caelum@70bebc7

Thats an issue then, user ends up with this:

screenshot_2021-08-09_15-38-21_1

Please re add the libCaelum.so plugin lines, it worked fine so far

@AnotherFoxGuy AnotherFoxGuy force-pushed the build-sys-V3 branch 2 times, most recently from cbf0442 to c8b7d3e Compare August 23, 2021 14:15
@AnotherFoxGuy AnotherFoxGuy force-pushed the build-sys-V3 branch 3 times, most recently from ef79c2f to 77b86d1 Compare September 2, 2021 11:33
@AnotherFoxGuy
Copy link
Member Author

Please re add the libCaelum.so plugin lines, it worked fine so far

This should be fixed now, could you test this PR again?

@tritonas00
Copy link
Collaborator

Works fine now. I would wait a bit until Petr finishes his work for the release, then merge.

@AnotherFoxGuy AnotherFoxGuy force-pushed the build-sys-V3 branch 2 times, most recently from 7a45fee to 1ca2fba Compare September 9, 2021 12:15
@AnotherFoxGuy AnotherFoxGuy force-pushed the build-sys-V3 branch 2 times, most recently from f9ac250 to f284489 Compare September 20, 2021 13:44
@ohlidalp
Copy link
Member

ohlidalp commented Sep 28, 2021

I'm getting

ERROR: Unable to find 'ogre3d-pagedgeometry/1.2.1@anotherfoxguy/stable' in remotes

What I did:

  1. Update: conan >> 1.40.2, cmake >> 3.21.3, visual studio >> 16.11.3
  2. conan remove -f *
  3. conan remote clean
  4. conan remote add conancenter https://center.conan.io
  5. rmdir /S /Q "C:\Users\Petr\builds\rigs-of-rods"
  6. cmake -S "C:\Users\Petr\source\rigs-of-rods" -B "C:\Users\Petr\builds\rigs-of-rods" -G "Visual Studio 16 2019" -A "x64"

Update: same result after uninstalling conan, removing '.conan' dir and installing conan.

@AnotherFoxGuy
Copy link
Member Author

@only-a-ptr That issue should be fixed now, I changed the ogre3d-* conan package versions to the correct versions

Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

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

Builds and runs fine.

@tritonas00
Copy link
Collaborator

tritonas00 commented Sep 28, 2021

@AnotherFoxGuy

Tried with conan also on Arch, builds fine but i had to manually install freeimage because:

./RoR: error while loading shared libraries: libfreeimage.so.3: cannot open shared object file: No such file or directory

after installed it runs fine.

There is

/rigs-of-rods/bin/libfreeimage-3.18.0.so

but why RoR asks for the system one?

EDIT

If i make a libfreeimage.so.3 symlink of libfreeimage-3.18.0.so it works

Also caelum doesn't work correctly (check the time slider, for some reason it goes by steps with conan, it should float)
With ror-dependencies
screenshot_2021-09-28_18-35-56_1
With conan
screenshot_2021-09-28_18-36-09_1

Happens on gh action build of this PR also, master branch doesn't have the issue.

@ohlidalp
Copy link
Member

ohlidalp commented Sep 28, 2021

I also have an issue with the Caelum daytime slider - it moves in 5 discrete steps instead of smoothly.

Another oddity I observed is that each tab in the Settings UI now displays a tooltip with it's name. Correction: also happens on master, I just didn't notice.

@tritonas00 tritonas00 self-requested a review September 28, 2021 16:38
Copy link
Collaborator

@tritonas00 tritonas00 left a comment

Choose a reason for hiding this comment

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

To clarify the caelum issue:

  • It doesn't happen on master (neither conan or ror-dependencies)
  • It doesn't happen with this PR and ror-dependencies
  • It happens with this PR and conan

@tritonas00
Copy link
Collaborator

Works fine now:
screenshot_2021-10-06_20-49-00_1

@tritonas00 tritonas00 self-requested a review October 7, 2021 08:53
@ohlidalp ohlidalp self-requested a review October 7, 2021 09:57
Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

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

Works just fine.

ENVIRONMENT:
Windows 10 Pro, version 20H2, build 19042.1237
Microsoft Visual Studio Community 2019 Version 16.11.3
conan 1.41.0
cmake v3.21.3
NVIDIA GeForce GTX 660, driver 27.21.14.6627

STEPS:
PS C:\Windows\system32> conan remove -f *
PS C:\Windows\system32> conan remote clean
PS C:\Windows\system32> conan remote add conancenter https://center.conan.io
rmdir /S /Q "%USERPROFILE%\builds\rigs-of-rods"
cmake -S "%USERPROFILE%\source\rigs-of-rods" -B "%USERPROFILE%\builds\rigs-of-rods" -G "Visual Studio 16 2019" -A "x64"

@AnotherFoxGuy AnotherFoxGuy merged commit 73b1785 into RigsOfRods:master Dec 3, 2021
@AnotherFoxGuy AnotherFoxGuy deleted the build-sys-V3 branch December 3, 2021 22:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants