Skip to content

Issues with slow xcode code suggestions and vscode cmaketools to build axmol projects #3069

@president9

Description

@president9

Using axmol3 on M1 macbook air with 8gb ram on Tahoe.

I am using a workflow with vim, clangd + compile_commands.json for code suggestion and then I use axmol build and axmol run to build/run the program. Here are some issues I experienced while coming to this new workflow:

Xcode completion was really slow or didn't suggest anything. Not sure if this is an issue with my device being old. Clangd lsp + compile_commands.json on vim and vscode was a lot faster than xcode code completion. After Xcode being slow I moved to Vscode and had the following issues:

Using the cmaketools build feature on vscode had this error when trying to build with the build button:
axmol/rhi/metal/DriverMTL.mm:516:43: error: instance method '-supportsSamplerBorderColor' not found (return type defaults to 'id') [-Werror,-Wobjc-method-access] [build] 516 | [_mtlDevice supportsSamplerBorderColor]); [build] |

I edited that DriverMTL.mm file by setting line 512 to true and commenting 513 to to 517 and got this error (the following error was present in axmol2 and using vscode build) after when trying to build:
/axmol/axmol/media/AvfMediaEngine.mm:377:9: error: cannot create __weak reference in file using manual reference counting [build] 377 | __weak AVPlayer* player = _player; [build] |

The CMake preset i was using was this:

{
"version": 8,
"configurePresets": [
{
"name": "Ninja",
"displayName": "Custom configure preset",
"description": "Sets Ninja generator, build and install directory",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
}
}
]
}

After that I decided to use clangd + compile_commands.json for code suggestions. Generating compile_commands.json took a long time too and required me to build the project twice since adding set(CMAKE_EXPORT_COMPILE_COMMANDS ON) into the CMakeLists.txt did not generate compile_commands.json after running axmol build. Then I tried passing the compile_commands flag manually using axmol build -xc 'DCMAKE_EXPORT_COMPILE_COMMANDS=ON -GNinja' and still no compile_commands was generated. I also commented out:

if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()

And compile_commands.json was still not generated. And so I generated the compile_commands.json using "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON". How would I generate compile_commands.json using axmol build because right now I have to build the project twice (once with cmake to generate compile_commands and then axmol build/run to build the .app)?

I'm not sure if the errors I'm experiencing was due to misuse or if it is an issue with axmol and would like to know if there are fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions