99cb3b600307 — Danielle Hutzley v0.0.2 3 years ago
Refactor configuration to hopefully work better in subproject builds
M .ccls +1 -5
@@ 1,9 1,5 @@ 
 clang
 %c -std=c99
-%c --include=config.h.in
-%h --include=config.h.in
 -Iinclude
--I../include
+-Ibuild/include
 -I.
--DLAAL_COMPIER_GCC
--DLAAL_IO_BUFFER_SIZE=255

          
R include/config.h.in =>  +0 -29
@@ 1,29 0,0 @@ 
-#ifndef __LAAL_CONFIG_H
-#define __LAAL_CONFIG_H
-/* This Source Code Form is subject to the terms of the Mozilla Public
-** License, v. 2.0. If a copy of the MPL was not distributed with this
-** file, You can obtain one at http://mozilla.org/MPL/2.0/.
-*/
-// LAAL private configuration
-
-// LAAL compiler types
-/// Use GCC/Clang syntax like __attribute__ for hints
-#mesondefine LAAL_COMPILER_GCC
-/// Use MSVC syntax like __declspec for hints
-#mesondefine LAAL_COMPILER_MSVC
-
-// The buffer size for file I/O
-#mesondefine LAAL_IO_BUFFER_SIZE
-
-#if defined(LAAL_COMPILER_MSVC)
-#define __LAAL_PURE __attribute__ ((pure))
-#define __LAAL_MUST_USE __attribute__ ((warn_unused_result))
-#elif defined(LAAL_COMPILER_MSVC)
-#define __LAAL_PURE __declspec(noalias)
-#define __LAAL_MUST_USE
-#else
-#define __LAAL_PURE
-#define __LAAL_MUST_USE
-#endif
-
-#endif // __LAAL_CONFIG_H

          
M include/laal.h +1 -0
@@ 10,6 10,7 @@ 
 #include <stdint.h>
 #include <stdio.h>
 
+#include <laal_config.h>
 #include <laal_error.h>
 
 #if defined(__cplusplus)

          
M include/laal_call.h +1 -0
@@ 7,6 7,7 @@ 
 ** file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
 // LAAL function call representation
+#include <laal_config.h>
 #include <laal_error.h>
 #include <laal_list.h>
 

          
M config.h.in => include/laal_config.h.in +0 -0

        
M include/laal_lexer.h +1 -0
@@ 5,6 5,7 @@ 
 #include <stdint.h>
 
 #include <laal.h>
+#include <laal_config.h>
 #include <laal_error.h>
 
 #ifndef __LAAL_LEXER_H

          
M include/laal_list.h +1 -0
@@ 7,6 7,7 @@ 
 // LAAL list literal implementation
 
 #include <laal.h>
+#include <laal_config.h>
 #include <laal_error.h>
 
 #if defined(__cplusplus)

          
M include/laal_map.h +1 -0
@@ 7,6 7,7 @@ 
 // LAAL key-value map literals
 
 #include <laal.h>
+#include <laal_config.h>
 #include <laal_error.h>
 
 #if defined(__cplusplus)

          
M include/laal_parser.h +1 -0
@@ 7,6 7,7 @@ 
 // LAAL parsing logic
 
 #include <laal.h>
+#include <laal_config.h>
 #include <laal_lexer.h>
 
 #if defined(__cplusplus)

          
M include/laal_writer.h +1 -0
@@ 7,6 7,7 @@ 
 // LAAL serialization logic
 
 #include <laal.h>
+#include <laal_config.h>
 #include <laal_error.h>
 
 #if defined(__cplusplus)

          
M include/meson.build +5 -0
@@ 15,5 15,10 @@ headers = files([
   'laal_writer.h'
 ])
 
+# Configuration header
+configure_file(input : 'laal_config.h.in',
+               output : 'laal_config.h',
+               configuration : config)
+
 include = include_directories('.')
 install_headers(headers, subdir : 'laal')

          
M meson.build +0 -7
@@ 21,13 21,6 @@ config = configuration_data({
   'LAAL_IO_BUFFER_SIZE' : get_option('io_buffer_size'),
 })
 
-# Configuration header
-configure_file(input : 'config.h.in',
-               output : 'config.h',
-               configuration : config)
-add_project_arguments('--include=@0@/config.h'.format(meson.project_build_root()),
-                      language : 'c')
-
 # Subdirs
 # subdir('po')      # TODO: localisation
 # subdir('doc')     # TODO: documentation