-
-
Notifications
You must be signed in to change notification settings - Fork 608
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: Implement 'threads' Option #1698
Conversation
Add the GODOT_THREADS option and related supporting code Includes naming cleanups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The code seems good to me. I tested the GODOT_THREADS
option when building for Linux, and everything seemed to be working fine.
However, I'm actually not sure how to build for the web! I have both the Emscripten and normal Linux toolchains available, but I don't know what arguments to pass so that it selects Emscripten. With SCons, I do this via scons platform=web
, but I'm not sure how to do that for CMake. Similar for cross-compiling to Windows, how do I make it select that toolchain rather than the native Linux one?
Not important for this PR, but something I'd like to know, and perhaps we should have an example in the cmake.rst doc?
I'm going to have to re-write this anyway, so this is just practice explaining. For Windows:First up I purposefully have my PATH variable not include any of the compilers, because I run all the variations, I change it when needed. I would think this doesnt work on Linux in the majority case, unless a whole toolchain is in opt or something. VisualStudio is automatically detected from native cmake, and the native cmake selects the visual studio generator by default. The emsdk has an environment script which alters the path, there is also emcmake.bat which wraps the cmake command and has the cfg.cmake['toolchain_file'] = 'C:/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake' For android I use the official toolchain file provided in the AndroidSDK and a couple of variables cfg.cmake['config_vars'] =[
"-DANDROID_PLATFORM=latest",
"-DANDROID_ABI=x86_64"]
cfg.cmake['toolchain_file'] = 'C:/androidsdk/ndk/23.2.8568313/build/cmake/android.toolchain.cmake' For all of the msys2 toolchains, they are individualised to work within their own shell environments, so I use those. For msvc with clang downloaded from llvm.org I update my path to include the llvm binaries first. and use a really crappy toolchain file which "works for me"^tm set( CMAKE_SYSTEM_NAME Windows )
set( CMAKE_SYSTEM_PROCESSOR x86_64 )
# which compilers to use for C and C++
#set( CMAKE_C_COMPILER "C:/Program Files/LLVM/bin/clang.exe" )
set( CMAKE_CXX_COMPILER "C:/Program Files/LLVM/bin/clang-cl.exe" )
set( CMAKE_RC_COMPILER "C:/Program Files/LLVM/bin/llvm-rc.exe" )
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
# search headers and libraries in the target environment
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) For llvm-mingw and mingw64 I alter the path GodotUsing the above with my builder scripts gives me these godot variations:
and I'm working on the godot-cpp scripts which are a bit more involved considering the multiplication of variation that CMake adds. godot-cppThese are not validated to work yet, I'm still in the middle of writing the generator code:
|
Add the GODOT_THREADS option and related supporting code Includes naming cleanups