Este guia fornece instruções detalhadas para configurar, abrir e buildar o projeto PersonalDevControl no CLion usando Qt6 e CMake.
# Instalar Qt6 via repositório oficial
sudo apt update
sudo apt install qt6-base-dev qt6-tools-dev cmake build-essential
# Ou baixar do site oficial Qt
# https://www.qt.io/download-qt-installer- Baixar Qt6 do site oficial: https://www.qt.io/download-qt-installer
- Executar o instalador e selecionar:
- Qt 6.5.0 ou superior
- MSVC 2019/2022 64-bit (recomendado)
- Qt Creator (opcional)
- CMake
# Via Homebrew
brew install qt@6 cmake
# Ou baixar do site oficial Qt# Linux - Build from source (recommended)
# 1. Install prerequisites
sudo apt install libmongoc-1.0-dev libbson-1.0-dev libssl-dev
# 2. Download and build mongocxx
wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.10.1/mongo-cxx-driver-r3.10.1.tar.gz
tar -xzf mongo-cxx-driver-r3.10.1.tar.gz
cd mongo-cxx-driver-r3.10.1
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
sudo make install
# Windows (usando vcpkg)
vcpkg install mongo-cxx-driver
# macOS
brew install mongo-cxx-driver- Abrir CLion
- File → Open ou Open Project
- Navegar para a pasta do projeto
PersonalDevControl - Selecionar o arquivo
CMakeLists.txte abrir
- File → Settings (ou CLion → Preferences no macOS)
- Build, Execution, Deployment → Toolchains
- Verificar se há uma toolchain configurada:
- Linux: GCC ou Clang
- Windows: MSVC ou MinGW
- macOS: Clang
- File → Settings → Build, Execution, Deployment → CMake
- Configurar perfis de build:
- Name: Debug
- Build type: Debug
- CMake options:
-DCMAKE_BUILD_TYPE=Debug - Build directory:
cmake-build-debug
- Name: Release
- Build type: Release
- CMake options:
-DCMAKE_BUILD_TYPE=Release - Build directory:
cmake-build-release
Se o CMake não encontrar automaticamente o Qt6:
- Adicionar nas CMake options:
-DCMAKE_PREFIX_PATH=/path/to/Qt/6.5.0/gcc_64
- Linux:
/usr/lib/x86_64-linux-gnu/cmake/Qt6ou/opt/Qt/6.5.0/gcc_64 - Windows:
C:\Qt\6.5.0\msvc2019_64 - macOS:
/usr/local/opt/qt@6ou/opt/homebrew/opt/qt@6
- Build → Build Project (Ctrl+F9)
- Ou clicar no ícone de build na toolbar
- Aguardar a compilação completar
- Run → Edit Configurations...
- Selecionar o target
PersonalDevControl - Verificar se o Executable está correto
- Working directory: definir como diretório raiz do projeto
- Run → Run 'PersonalDevControl' (Shift+F10)
- Ou clicar no ícone de play verde
PersonalDevControl/
├── docs/ # Documentação
├── src/ # Código-fonte
│ ├── core/ # API MongoDB e lógica central
│ ├── ui/ # Interface do usuário
│ ├── models/ # Modelos de dados
│ ├── controllers/ # Controladores (futuro)
│ ├── utils/ # Utilitários (futuro)
│ └── main.cpp # Ponto de entrada
├── resources/ # Recursos Qt (imagens, ícones, etc.)
├── tests/ # Testes (futuro)
├── build/ # Arquivos de build (ignorado pelo git)
├── .github/workflows/ # CI/CD GitHub Actions
├── CMakeLists.txt # Configuração CMake
├── .gitignore # Arquivos ignorados pelo Git
├── README.md # Documentação principal
└── setup.md # Este arquivo
- Run → Edit Configurations...
- Criar nova configuração CMake Application
- Definir Target: PersonalDevControl
- Build type: Debug
- Clicar na margem esquerda do editor para adicionar breakpoints
- Run → Debug 'PersonalDevControl' (Shift+F9)
Para adicionar testes unitários:
- Adicionar find_package(Qt6Test REQUIRED) no CMakeLists.txt
- Criar arquivos de teste na pasta
tests/ - Configurar CTest para execução automática
# Adicionar ao CMakeLists.txt se necessário
set(CMAKE_PREFIX_PATH "/path/to/Qt/6.5.0/gcc_64")# Linux - verificar instalação
pkg-config --exists libmongocxx && echo "mongocxx found" || echo "mongocxx not found"
# Se não encontrado, instalar manualmente:
# Seguir instruções na seção de dependências externas
# Windows - verificar vcpkg
vcpkg list mongo-cxx-driver- Verificar se os arquivos .h com Q_OBJECT estão listados em qt6_add_executable
- Executar Build → Clean e rebuild
- Verificar se os arquivos estão salvos em UTF-8
- Configurar CLion: File → Settings → Editor → File Encodings
Para contribuir com o projeto:
- Fork o repositório
- Criar branch feature:
git checkout -b feature/nova-funcionalidade - Commit mudanças:
git commit -am 'Adiciona nova funcionalidade' - Push para branch:
git push origin feature/nova-funcionalidade - Abrir Pull Request