lang/cc: rename +cc-{include-paths,compiler-options} #305
This commit is contained in:
parent
71c0c96b60
commit
b331acb46b
3 changed files with 12 additions and 14 deletions
|
@ -81,8 +81,8 @@ rc -J $PROJECT_ROOT # loads PROJECT_ROOT's compile_commands.json
|
||||||
* Configure
|
* Configure
|
||||||
** Compile settings
|
** Compile settings
|
||||||
By default, a set of default compile settings are defined in
|
By default, a set of default compile settings are defined in
|
||||||
~+cc-compiler-options~ for C, C++ and Objective C. Irony, rtags and flycheck
|
~+cc-default-compiler-options~ for C, C++ and Objective C. Irony, rtags and
|
||||||
will fall back to these.
|
flycheck will fall back to these.
|
||||||
|
|
||||||
To make these tools aware of project specific build settings, you need a JSON
|
To make these tools aware of project specific build settings, you need a JSON
|
||||||
[[https://sarcasm.github.io/notes/dev/compilation-database.html#ninja][compilation database]] present (i.e. a ~compile_commands.json~ file).
|
[[https://sarcasm.github.io/notes/dev/compilation-database.html#ninja][compilation database]] present (i.e. a ~compile_commands.json~ file).
|
||||||
|
|
|
@ -85,8 +85,8 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +cc|irony-init-compile-options ()
|
(defun +cc|irony-init-compile-options ()
|
||||||
"Initialize compiler options for irony-mode. It searches for the nearest
|
"Initialize compiler options for irony-mode. It searches for the nearest
|
||||||
compilation database and initailizes it. If none was found, it uses
|
compilation database and initailizes it, otherwise falling back on
|
||||||
`+cc-c++-compiler-options'.
|
`+cc-default-compiler-options' and `+cc-default-include-paths'.
|
||||||
|
|
||||||
See https://github.com/Sarcasm/irony-mode#compilation-database for details on
|
See https://github.com/Sarcasm/irony-mode#compilation-database for details on
|
||||||
compilation dbs."
|
compilation dbs."
|
||||||
|
@ -94,8 +94,8 @@ compilation dbs."
|
||||||
(require 'irony-cdb)
|
(require 'irony-cdb)
|
||||||
(unless (irony-cdb-autosetup-compile-options)
|
(unless (irony-cdb-autosetup-compile-options)
|
||||||
(irony-cdb--update-compile-options
|
(irony-cdb--update-compile-options
|
||||||
(append (delq nil (cdr-safe (assq major-mode +cc-compiler-options)))
|
(append (delq nil (cdr-safe (assq major-mode +cc-default-compiler-options)))
|
||||||
(cl-loop for path in +cc-include-paths
|
(cl-loop for path in +cc-default-include-paths
|
||||||
nconc (list "-I" path)))
|
nconc (list "-I" path)))
|
||||||
(doom-project-root)))))
|
(doom-project-root)))))
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
;;; lang/cc/config.el --- c, c++, and obj-c -*- lexical-binding: t; -*-
|
;;; lang/cc/config.el --- c, c++, and obj-c -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +cc-include-paths (list "include/")
|
(defvar +cc-default-include-paths (list "include/")
|
||||||
"A list of paths, relative to a project root, to search for headers in C/C++.
|
"A list of default paths, relative to a project root, to search for headers in
|
||||||
Paths can be absolute.
|
C/C++. Paths can be absolute. This is ignored if your project has a JSON
|
||||||
|
compilation database.")
|
||||||
|
|
||||||
The purpose of this variable is to ensure syntax checkers and code-completion
|
(defvar +cc-default-compiler-options
|
||||||
knows where to look for headers.")
|
|
||||||
|
|
||||||
(defvar +cc-compiler-options
|
|
||||||
`((c-mode . nil)
|
`((c-mode . nil)
|
||||||
(c++-mode
|
(c++-mode
|
||||||
. ,(list "-std=c++11" ; use C++11 by default
|
. ,(list "-std=c++11" ; use C++11 by default
|
||||||
|
@ -117,7 +115,7 @@ compilation database is present in the project.")
|
||||||
(unless (file-directory-p irony-server-install-prefix)
|
(unless (file-directory-p irony-server-install-prefix)
|
||||||
(warn "irony-mode: server isn't installed; run M-x irony-install-server"))
|
(warn "irony-mode: server isn't installed; run M-x irony-install-server"))
|
||||||
;; Initialize compilation database, if present. Otherwise, fall back on
|
;; Initialize compilation database, if present. Otherwise, fall back on
|
||||||
;; `+cc-compiler-options'.
|
;; `+cc-default-compiler-options'.
|
||||||
(add-hook 'irony-mode-hook #'+cc|irony-init-compile-options))
|
(add-hook 'irony-mode-hook #'+cc|irony-init-compile-options))
|
||||||
|
|
||||||
(def-package! irony-eldoc
|
(def-package! irony-eldoc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue