Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up pebble sdk with jet brains cLion?

I would like to develop for the pebble using CLION (jetbrains c/c++ IDE). I am aware of cloud pebble , and would still like to use Clion. Could anybody tell me how to set it up so that :

  1. I get auto complete for pebble sdk functions
  2. When I click on run , the command pebble build && install is run .
like image 943
harveyslash Avatar asked Mar 01 '16 19:03

harveyslash


1 Answers

I use CLION to develop the C code for my Pebble apps.

To build/run I just have a terminal open within CLION, but I do like being able to refactor, have static analysis find errors, and to jump to the Pebble defs.

I created a new project based on the C source directory, and I've added all my source files to the CMakeLists.txt and the path to the Pebble include files and the generated resource file. Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.3)
project(src)
add_definitions(-DNOT_PEBBLE_BUILD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES
        pblib/pblib.h ... main_menu_customizer.c main_menu_customizer.h string_values.c error_handler.c error_handler.h)

include_directories("~/Library/Application Support/Pebble SDK/SDKs/current/sdk-core/pebble/chalk/include" ../build/chalk/src)
add_executable(src ${SOURCE_FILES})

In a general header file I also have these definitions to ensure that the generated resource file gets picked up, and that I don't get spurious errors for APP_LOG (might be fixed in the latest CLION):

#if NOT_PEBBLE_BUILD
#include <resource_ids.auto.h>
#undef APP_LOG // Clion doesn't support
#endif

Although not directly related to your question, you can also now debug C code running in the emulator using GDB, although not within CLION. That would be cool.

like image 66
Damian Avatar answered Dec 31 '22 11:12

Damian