summaryrefslogtreecommitdiff
path: root/extra/libmusicbrainz5/support-out-of-source-build.patch
blob: eeb3bc2c7e07bf74c08e772fed659d92bb3c6ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From b74fd9680c20f8cbdbcf6cdff9ee1074c55fe1c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= <lalinsky@gmail.com>
Date: Thu, 14 Jun 2012 09:58:41 +0200
Subject: [PATCH] Support out-of-source build

http://tickets.musicbrainz.org/browse/LMB-10
https://github.com/metabrainz/libmusicbrainz/issues/1
---
 examples/CMakeLists.txt |    5 ++++-
 src/CMakeLists.txt      |    9 +++++++--
 src/make-c-interface.cc |    8 ++++----
 tests/CMakeLists.txt    |    5 ++++-
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 3e11469..000d4aa 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,4 +1,7 @@
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_SOURCE_DIR}/../include
+	${CMAKE_CURRENT_BINARY_DIR}/../include
+)
 LINK_LIBRARIES(musicbrainz5 ${NEON_LIBRARIES})
 
 ADD_EXECUTABLE(cdlookup cdlookup.cc)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2ee102f..89ab63c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,10 @@
 SET(CMAKE_INCLUDE_CURRENT_DIR ON)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../include ${NEON_INCLUDE_DIR})
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_SOURCE_DIR}/..
+	${CMAKE_CURRENT_SOURCE_DIR}/../include
+	${CMAKE_CURRENT_BINARY_DIR}/../include
+	${NEON_INCLUDE_DIR}
+)
 
 SET(_sources Alias.cc Annotation.cc Artist.cc ArtistCredit.cc Attribute.cc CDStub.cc Collection.cc
 	Disc.cc Entity.cc FreeDBDisc.cc HTTPFetch.cc ISRC.cc Label.cc LabelInfo.cc Lifespan.cc List.cc
@@ -13,7 +18,7 @@ ADD_EXECUTABLE(make-c-interface make-c-interface.cc xmlParser.cpp)
 ADD_CUSTOM_COMMAND(
 	OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mb5_c.cc ${CMAKE_CURRENT_BINARY_DIR}/mb5_c.h ${CMAKE_CURRENT_BINARY_DIR}/../include/musicbrainz5/mb5_c.h
 	COMMAND make-c-interface ${CMAKE_CURRENT_SOURCE_DIR} cinterface.xml ${CMAKE_CURRENT_BINARY_DIR} mb5_c.cc mb5_c.h
-	COMMAND ${CMAKE_COMMAND} -E copy_if_different 	${CMAKE_CURRENT_BINARY_DIR}/mb5_c.h ${CMAKE_CURRENT_BINARY_DIR}/../include/musicbrainz5
+	COMMAND ${CMAKE_COMMAND} -E copy_if_different 	${CMAKE_CURRENT_BINARY_DIR}/mb5_c.h ${CMAKE_CURRENT_BINARY_DIR}/../include/musicbrainz5/mb5_c.h
 	DEPENDS make-c-interface cinterface.xml *.inc
 )
 
diff --git a/src/make-c-interface.cc b/src/make-c-interface.cc
index 652a65b..70dd6d7 100644
--- a/src/make-c-interface.cc
+++ b/src/make-c-interface.cc
@@ -33,7 +33,7 @@
 
 #include "musicbrainz5/xmlParser.h"
 
-void ProcessBoilerplate(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include);
+void ProcessBoilerplate(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include, const std::string& Path);
 void ProcessHeader(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include);
 void ProcessEntity(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include);
 void ProcessClass(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include);
@@ -80,7 +80,7 @@ int main(int argc, const char *argv[])
 				std::string Name=Node.getName();
 
 				if ("boilerplate"==Name)
-					ProcessBoilerplate(Node,Source,Include);
+					ProcessBoilerplate(Node,Source,Include,argv[1]);
 				else if ("header"==Name)
 					ProcessHeader(Node,Source,Include);
 				else if ("declare"==Name)
@@ -156,13 +156,13 @@ void ProcessHeader(const XMLNode& /*Node*/, std::ofstream& Source, std::ofstream
 	Include << os.str() << std::endl;
 }
 
-void ProcessBoilerplate(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include)
+void ProcessBoilerplate(const XMLNode& Node, std::ofstream& Source, std::ofstream& Include, const std::string& Path)
 {
 	std::ofstream *File=GetFile(Node,Source,Include);
 
 	if (Node.isAttributeSet("file"))
 	{
-		std::string FileName=Node.getAttribute("file");
+		std::string FileName=Path+"/"+Node.getAttribute("file");
 		std::ifstream InFile(FileName.c_str());
 		if (InFile.is_open())
 			*File << InFile.rdbuf() << std::endl;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 645f8ae..8a0b38b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,7 @@
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_SOURCE_DIR}/../include
+	${CMAKE_CURRENT_BINARY_DIR}/../include
+)
 LINK_LIBRARIES(musicbrainz5 ${NEON_LIBRARIES})
 ADD_EXECUTABLE(mbtest mbtest.cc)
 ADD_EXECUTABLE(ctest ctest.c)
-- 
1.7.10

From b5d4f4ea32068e296326438c747faf665c311ddd Mon Sep 17 00:00:00 2001
From: Andy Hawkins <andy@gently.org.uk>
Date: Thu, 14 Jun 2012 09:12:27 +0000
Subject: [PATCH] Fix install when building out of tree

---
 CMakeLists.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16870b4..958461c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_SOURCE
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
 
 FILE(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/include/musicbrainz5/*.h)
-INSTALL(FILES ${headers} include/musicbrainz5/mb5_c.h DESTINATION ${INCLUDE_INSTALL_DIR}/musicbrainz5)
+INSTALL(FILES ${headers} ${CMAKE_CURRENT_BINARY_DIR}/include/musicbrainz5/mb5_c.h DESTINATION ${INCLUDE_INSTALL_DIR}/musicbrainz5)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmusicbrainz5.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 ADD_SUBDIRECTORY(src)
-- 
1.7.10