Sublime Forum

Adding "variants" "Breaks" Build System

#1

Following on from this post

and possibly including some of this this

This is the working build system:

  "cmd" : ["make --file=makeOdatNurd.mk -B TARGET=\"$file_base_name\""],
  "selector" : "source.c",
  "shell": true,
  "file_regex":"^(|..[^:]*):([0-9]*):?([0-9]*)?:? (.*)$",
  // "working_dir" : "$file_path"
  "working_dir": "${folder:${project_path:${file_path}}}",
  "syntax": "Packages/Makefile/Make Output.sublime-syntax"

And here’s proof of it’s workingness:

When I add these lines

  "variants":
  [
    {
      "name": "Debug",
      "shell_cmd": "make --file=makeOdatNurd.mk debug -B TARGET=\"$file_base_name\""
    }
  ]

to give:

{
  "cmd" : ["make --file=makeOdatNurd.mk -B TARGET=\"$file_base_name\""],
  "selector" : "source.c",
  "shell": true,
  "file_regex":"^(|..[^:]*):([0-9]*):?([0-9]*)?:? (.*)$",
  // "working_dir" : "$file_path"
  "working_dir": "${folder:${project_path:${file_path}}}",
  "syntax": "Packages/Makefile/Make Output.sublime-syntax"
  "variants":
  [
    {
      "name": "Debug",
      "shell_cmd": "make --file=makeOdatNurd.mk debug -B TARGET=\"$file_base_name\""
    }
  ]
}

I get:
No build system error from ST3.

Here’s the makefile, maybe this is causing some of the other problems i’m having too with trying to get F4 to work. Also despite having the variants “clause” Build with doesn’t give me any options either.

CC = clang++-3.8

#This is the target that compiles our executable
CXXFLAGS = -std=c++14 -stdlib=libc++ -w -O02

# LDFLAGs for -L rather than -l LDFLAGS = ...
LDLIBS = -lSDL2 -lSDL2_image -lc++ -lm -lgcc_s -lgcc -lc

SRCS := $(wildcard *.cpp)
OBJS := $(patsubst %.cpp,%.o,$(SRCS))

debug: CXXFLAGS += -DDEBUG -ggdb

%.o: %.cpp
	 $(CC) $(CPPFLAGS) $(CXXFLAGS) -c $<

$(TARGET): $(OBJS)
	 g++ $^ $(LDLIBS) -o $@

I’ll be cheering if I get any of these sorted (multi threading in C++ eventually turned out to be easier than i thought, so there’s hope !)

ATB :unicorn::skull_and_crossbones:

0 Likes

#2

This line doesn’t have the required comma at the send to separate it from the following keys. The syntax highlighting shows where the error is:

image

I would recommend PackageDev, which has among its features enhanced syntax highlighting for Sublime resource files including build systems. This error is found by the main syntax easily, but PackageDev can highlight more errors. It also makes it easy to tell when you’ve added a key that’s not valid for the build.

1 Like

#3

I do have Package Dev installed, missed the missing comma, D’oh.
I’ve been wrestling with make, so have a full reply to "Build Files I am missing a trick"..
(perhaps that should be Makefiles am I missing a trick but I guess that’s for another forum :stuck_out_tongue_winking_eye: )

BTW is there way to message you privately @OdatNurd , can’t say why otherwise it wrecks the privacy part, for something good…cheers

0 Likes

#4

You should be able to message me here on the forum; if you’re in my Discord or the Sublime discord, you can DM me there as well. My Website also has a contact email address on it.

0 Likes