Skip to content

Commit

Permalink
Better support for the CLion IDE
Browse files Browse the repository at this point in the history
When loading the project in the JetBrains CLion, the IDE would not properly resolve includes from the `include/` directory.

That's because apparently, CLion does not understand the `-iquote include` flag when parsing the `Makefile`, but it _does_ understand `-iquoteinclude` without the space.

I realise that that's probably more of an issue with CLion itself as the syntax with space seems to be valid. But for better or worse, at least this fixed my immediate issue of not being able to properly use the project in CLion.

I have also added CLion's compiler flag to the dummy defines in `include/global.h`.
  • Loading branch information
hanzi committed Nov 20, 2024
1 parent 9275e71 commit 3a9eade
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ SHELL := bash -o pipefail
ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN)

INCLUDE_DIRS := include
INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %)
ifdef CLION_IDE
INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote%)
else
INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %)
endif
INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %)

O_LEVEL ?= 2
Expand Down
2 changes: 1 addition & 1 deletion include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define NAKED __attribute__((naked))

/// IDE support
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__INTELLISENSE__)
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__INTELLISENSE__) || defined(__CLION_IDE__)
// We define these when using certain IDEs to fool preproc
#define _(x) {x}
#define __(x) {x}
Expand Down

0 comments on commit 3a9eade

Please sign in to comment.