ソースを参照

Include path shenanigans

Streetwalrus Einstein 10 年 前
コミット
a3a30dcd15

+ 4 - 7
.ycm_extra_conf.py

@@ -30,6 +30,7 @@
 
 import os
 import ycm_core
+import subprocess
 
 # These are the compilation flags that will be used in case there's no
 # compilation database set (by default, one is not set).
@@ -59,17 +60,13 @@ flags = [
 '-x',
 'c++',
 '-isystem',
-os.environ['HOME'] + '/ndless/ndless-sdk/include',
+os.environ['NDLESS_GIT'] + '/ndless-sdk/include',
 '-isystem',
 os.environ['HOME'] + '/.ndless/include',
-'-I',
-'include',
-'-I',
-'art',
-'-I',
-'external/tinystl/include',
 ]
 
+flags += subprocess.check_output(["make", "include"]).split(" ")
+
 
 # Set this to the absolute path to the folder (NOT the file!) containing the
 # compile_commands.json file to use that instead of 'flags'. See here for

+ 4 - 1
rules.mk

@@ -1,4 +1,4 @@
-.PHONY: format clean all run versionning
+.PHONY: format clean all run versionning include
 
 all: $(EXE)
 
@@ -34,6 +34,9 @@ format:
 	@echo "Formatting source using clang-format"
 	@clang-format -i -style=file $(SRCS_C) $(SRCS_CPP) $(wildcard $(addsuffix /*.h,$(INCLUDE)))
 
+include:
+	@echo $(addprefix -I ,$(INCLUDE))
+
 run: all
 	@echo "Sending $(EXE) to calculator"
 	@tilp -ns $(EXE) > /dev/null

+ 1 - 1
src/drivers/Graphics.cpp

@@ -1,6 +1,6 @@
 #include <os.h>
 #include "Graphics.h"
-#include "../utility/misc.h"
+#include "utility/misc.h"
 
 #define GRAPHICS WalrusRPG::Graphics
 

+ 1 - 1
src/drivers/Graphics.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_GRAPHICS_H
 #define INCLUDE_GRAPHICS_H
 
-#include "../utility/Rect.h"
+#include "utility/Rect.h"
 
 namespace WalrusRPG
 {

+ 1 - 1
src/engine/State.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_STATE_H
 #define INCLUDE_STATE_H
 
-#include "../render/Camera.h"
+#include "render/Camera.h"
 
 namespace WalrusRPG
 {

+ 4 - 4
src/engine/StateMachine.cpp

@@ -1,8 +1,8 @@
 #include "StateMachine.h"
-#include "../drivers/Timers.h"
-#include "../drivers/Graphics.h"
-#include "../render/Text.h"
-#include "../version/version.h"
+#include "drivers/Timers.h"
+#include "drivers/Graphics.h"
+#include "render/Text.h"
+#include "version.h"
 #include <os.h>
 
 using namespace WalrusRPG::Graphics;

+ 6 - 6
src/engine/main.cpp

@@ -1,10 +1,10 @@
 #include <os.h>
-#include "../drivers/Timers.h"
-#include "../drivers/Graphics.h"
-#include "../map/Map.h"
-#include "../utility/misc.h"
-#include "../drivers/Interrupts.h"
-#include "../map/StateMap.h"
+#include "drivers/Timers.h"
+#include "drivers/Graphics.h"
+#include "map/Map.h"
+#include "utility/misc.h"
+#include "drivers/Interrupts.h"
+#include "map/StateMap.h"
 #include "StateMachine.h"
 
 using namespace WalrusRPG;

+ 3 - 3
src/map/Entity.cpp

@@ -1,7 +1,7 @@
 #include "Entity.h"
-#include "../utility/misc.h"
-#include "../utility/Rect.h"
-#include "../render/Text.h"
+#include "utility/misc.h"
+#include "utility/Rect.h"
+#include "render/Text.h"
 
 #define ENTITY WalrusRPG::Entity
 using namespace WalrusRPG::Utils;

+ 4 - 4
src/map/Entity.h

@@ -1,10 +1,10 @@
 #ifndef INCLUDE_ENTITY_H
 #define INCLUDE_ENTITY_H
 
-#include "../utility/Rect.h"
-#include "../render/Camera.h"
-#include "../render/Renderer.h"
-#include "../render/TileRenderer.h"
+#include "utility/Rect.h"
+#include "render/Camera.h"
+#include "render/Renderer.h"
+#include "render/TileRenderer.h"
 
 namespace WalrusRPG
 {

+ 5 - 5
src/map/Map.cpp

@@ -1,10 +1,10 @@
 #include "Map.h"
-#include "../render/Camera.h"
-#include "../drivers/Graphics.h"
+#include "render/Camera.h"
+#include "drivers/Graphics.h"
 #include <sprites.h>
-#include "../utility/Rect.h"
-#include "../render/TileRenderer.h"
-#include "../utility/misc.h"
+#include "utility/Rect.h"
+#include "render/TileRenderer.h"
+#include "utility/misc.h"
 
 #define MAP WalrusRPG::Map
 using namespace WalrusRPG;

+ 4 - 4
src/map/Map.h

@@ -2,10 +2,10 @@
 #define INCLUDE_MAP_H
 
 #include <stdint.h>
-#include "../render/Camera.h"
-#include "../map/Entity.h"
-#include "../render/TileRenderer.h"
-#include "../render/Animator.h"
+#include "render/Camera.h"
+#include "map/Entity.h"
+#include "render/TileRenderer.h"
+#include "render/Animator.h"
 
 namespace WalrusRPG
 {

+ 5 - 5
src/map/StateMap.cpp

@@ -1,9 +1,9 @@
 #include "StateMap.h"
-#include "../utility/misc.h"
-#include "../version/version.h"
-#include "../drivers/Graphics.h"
-#include "../render/Pixel.h"
-#include "../render/Text.h"
+#include "utility/misc.h"
+#include "version.h"
+#include "drivers/Graphics.h"
+#include "render/Pixel.h"
+#include "render/Text.h"
 
 #define STATEMAP WalrusRPG::States::StateMap
 

+ 1 - 1
src/map/StateMap.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_STATEMAP_H
 #define INCLUDE_STATEMAP_H
 
-#include "../engine/State.h"
+#include "engine/State.h"
 #include "Map.h"
 
 namespace WalrusRPG

+ 2 - 2
src/render/Animator.cpp

@@ -1,6 +1,6 @@
 #include "Animator.h"
-#include "../drivers/Graphics.h"
-#include "../utility/Rect.h"
+#include "drivers/Graphics.h"
+#include "utility/Rect.h"
 
 #define ANIMATOR WalrusRPG::Animator
 

+ 1 - 1
src/render/Animator.h

@@ -3,7 +3,7 @@
 
 #include <TINYSTL/vector.h>
 #include <TINYSTL/unordered_map.h>
-#include "../utility/Rect.h"
+#include "utility/Rect.h"
 
 namespace WalrusRPG
 {

+ 2 - 2
src/render/Camera.cpp

@@ -1,7 +1,7 @@
 #include <os.h>
 #include "Camera.h"
-#include "../map/Entity.h"
-#include "../utility/misc.h"
+#include "map/Entity.h"
+#include "utility/misc.h"
 
 #define CAMERA WalrusRPG::Camera
 

+ 1 - 1
src/render/Camera.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_CAMERA_H
 #define INCLUDE_CAMERA_H
 
-#include "../utility/Rect.h"
+#include "utility/Rect.h"
 
 namespace WalrusRPG
 {

+ 1 - 1
src/render/Renderer.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_RENDERER_H
 #define INCLUDE_RENDERER_H
 
-#include "../utility/Rect.h"
+#include "utility/Rect.h"
 
 namespace WalrusRPG
 {

+ 2 - 2
src/render/SpriteRenderer.cpp

@@ -1,6 +1,6 @@
 #include "SpriteRenderer.h"
-#include "../drivers/Graphics.h"
-#include "../utility/Rect.h"
+#include "drivers/Graphics.h"
+#include "utility/Rect.h"
 #include <TINYSTL/unordered_map.h>
 
 #define SPRITERENDERER WalrusRPG::SpriteRenderer

+ 2 - 2
src/render/SpriteRenderer.h

@@ -2,8 +2,8 @@
 #define INCLUDE_SPRITERENDERER_H
 
 #include <TINYSTL/unordered_map.h>
-#include "../utility/Rect.h"
-#include "../render/Renderer.h"
+#include "utility/Rect.h"
+#include "render/Renderer.h"
 
 namespace WalrusRPG
 {

+ 1 - 1
src/render/Text.cpp

@@ -1,5 +1,5 @@
 #include <sprites.h>
-#include "../drivers/Graphics.h"
+#include "drivers/Graphics.h"
 #include "Text.h"
 #include <cstdio>
 #include <cstdarg>

+ 2 - 2
src/render/TileRenderer.cpp

@@ -1,6 +1,6 @@
 #include "TileRenderer.h"
-#include "../drivers/Graphics.h"
-#include "../utility/Rect.h"
+#include "drivers/Graphics.h"
+#include "utility/Rect.h"
 
 #define TILERENDERER WalrusRPG::TileRenderer
 using namespace WalrusRPG;

+ 1 - 1
src/render/TileRenderer.h

@@ -1,7 +1,7 @@
 #ifndef INCLUDE_TILERENDERER_H
 #define INCLUDE_TILERENDERER_H
 
-#include "../utility/Rect.h"
+#include "utility/Rect.h"
 #include "Renderer.h"
 
 namespace WalrusRPG

+ 1 - 1
src/rules.mk

@@ -4,4 +4,4 @@ include $(wildcard $(src_LOCAL_PATH)/*/rules.mk)
 
 SRCS_C += $(wildcard $(src_LOCAL_PATH)/*/*.c)
 SRCS_CPP += $(wildcard $(src_LOCAL_PATH)/*/*.cpp)
-INCLUDE += $(shell find $(src_LOCAL_PATH) -mindepth 1 -maxdepth 1 -type d)
+INCLUDE += $(src_LOCAL_PATH)