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

C++ 20 Modules Support #1468

Closed
sdykae opened this issue Dec 29, 2022 · 2 comments
Closed

C++ 20 Modules Support #1468

sdykae opened this issue Dec 29, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@sdykae
Copy link

sdykae commented Dec 29, 2022

Modules intellisense and completion not working even when cmake compiles
llvm compiled from https://github.com/mathstuf/llvm-project/tree/p1689r5-csd
according cmake reference https://gitlab.kitware.com/cmake/cmake/-/issues/18355
image

image
Compilation works and executable but intellisense
image
image

main.cpp

import Hello;
int main() { hello(); }

hello.cppm

module;
#include <iostream>
export module Hello;
export void hello() {
  std::cout << "Hello World!\n";
}

CMakeList.txt

cmake_minimum_required(VERSION 3.25.2`)
project(app)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_C_COMPILER /Users/sdykae/development/llvm-project-p1689r5-csd/build/bin/clang)
set(CMAKE_CXX_COMPILER /Users/sdykae/development/llvm-project-p1689r5-csd/build/bin/clang++)

set(CMAKE_LDFLAGS "-L/Users/sdykae/development/llvm-project-p1689r5-csd/build/lib")
SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -fuse-ld=/Users/sdykae/development/llvm-project-p1689r5-csd/build/bin/ld64.lld")
SET(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wl,-L/Users/sdykae/development/llvm-project-p1689r5-csd/build/lib")
set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -std=c++2b -fexperimental-library -stdlib=libc++" )
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
set(CMAKE_OSX_ARCHITECTURES "x86_64")

set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)

string(CONCAT CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE
  "/Users/sdykae/development/llvm-project-p1689r5-csd/build/bin/clang-scan-deps"
  " -format=p1689 --p1689-targeted-file-name=<SOURCE> --p1689-targeted-output=<OBJECT> "
  " --p1689-makeformat-output=<DEP_FILE>"
  " --"
  " <DEFINES> <INCLUDES> <FLAGS> -x c++ <SOURCE>"
  " -MT <DYNDEP_FILE> -MD"
  " > <DYNDEP_FILE>")

set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FORMAT "clang")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_MAP_FLAG "@<MODULE_MAP_FILE>")
set(CMAKE_CXX_EXTENSIONS OFF)
set(source_files main.cc )

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME}
  PRIVATE
    main.cpp
  PRIVATE
    FILE_SET CXX_MODULES
      # BASE_DIRS
      #   "${CMAKE_CURRENT_SOURCE_DIR}"
      FILES
        hello.cppm
)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)

If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).

Logs
Please attach the clangd log from the "Output" window if you can.
If possible, run with --log=verbose - note that the logs will include the contents of open files!

System information
Clangd version (from the log, or clangd --version):
image
clangd extension version: 16.0.0
Operating system: osx ventura 13.1

@sdykae sdykae added the bug Something isn't working label Dec 29, 2022
@HighCommander4
Copy link

Please see #1293 for the current status of modules support in clangd

@kadircet kadircet transferred this issue from clangd/vscode-clangd Jan 18, 2023
@kadircet
Copy link
Member

moving to clangd and closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants