Commit f366f8cc authored by Christophe Geuzaine's avatar Christophe Geuzaine

define api version

parent 9d4de60e
Pipeline #1632 passed with stage
in 63 minutes 20 seconds
......@@ -511,7 +511,7 @@ cpp_header="""// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
#ifndef _GMSH_H_
#define _GMSH_H_
// This file defines the Gmsh C++ API.
// This file defines the Gmsh C++ API (v{0}).
//
// Do not edit it directly: it is automatically generated by `api/gen.py'.
//
......@@ -527,6 +527,8 @@ cpp_header="""// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
#include <string>
#include <utility>
#define GMSH_API_VERSION "{0}"
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
......@@ -537,7 +539,7 @@ cpp_header="""// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
#define GMSH_API
#endif
namespace gmsh {
namespace gmsh {{
// A geometrical entity in the Gmsh API is represented by two integers: its
// dimension (dim = 0, 1, 2 or 3) and its tag (its unique, strictly positive
......@@ -546,7 +548,7 @@ namespace gmsh {
// integer pairs.
typedef std::vector<std::pair<int, int> > vectorpair;
}
}}
"""
......@@ -564,7 +566,7 @@ c_header="""/*
#define _GMSHC_H_
/*
* This file defines the Gmsh C API.
* This file defines the Gmsh C API (v{0}).
*
* Do not edit it directly: it is automatically generated by `api/gen.py'.
*
......@@ -574,6 +576,8 @@ c_header="""/*
#include <stddef.h>
#define GMSH_API_VERSION "{0}"
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
......@@ -644,7 +648,7 @@ cwrap_header="""// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
#ifndef _GMSH_H_
#define _GMSH_H_
// This file redefines the Gmsh C++ API in terms of the C API.
// This file redefines the Gmsh C++ API in terms of the C API (v{0}).
//
// This is provided as a convenience for users of the binary Gmsh SDK whose C++
// compiler ABI is not compatible with the ABI of the C++ compiler used to create
......@@ -668,21 +672,11 @@ cwrap_header="""// Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
#include <string>
#include <utility>
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
#else
#define GMSH_API __declspec(dllimport)
#endif
#else
#define GMSH_API
#endif
extern \"C\" {
extern \"C\" {{
#include "gmshc.h"
}
}}
namespace gmsh {
namespace gmsh {{
// A geometrical entity in the Gmsh API is represented by two integers: its
// dimension (dim = 0, 1, 2 or 3) and its tag (its unique, strictly positive
......@@ -691,7 +685,7 @@ namespace gmsh {
// integer pairs.
typedef std::vector<std::pair<int, int> > vectorpair;
}
}}
"""
......@@ -735,7 +729,7 @@ python_header = """# Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
# See the LICENSE.txt file for license information. Please report all
# bugs and problems to the public mailing list <gmsh@onelab.info>.
# This file defines the Gmsh Python API.
# This file defines the Gmsh Python API (v{0}).
#
# Do not edit it directly: it is automatically generated by `api/gen.py'.
#
......@@ -749,6 +743,8 @@ import os
import platform
from math import pi
GMSH_API_VERSION = "{0}"
signal.signal(signal.SIGINT, signal.SIG_DFL)
libdir = os.path.dirname(os.path.realpath(__file__))
if platform.system() == 'Windows':
......@@ -876,7 +872,7 @@ julia_header = """# Gmsh - Copyright (C) 1997-2018 C. Geuzaine, J.-F. Remacle
# See the LICENSE.txt file for license information. Please report all
# bugs and problems to the public mailing list <gmsh@onelab.info>.
# This file defines the Gmsh Julia API.
# This file defines the Gmsh Julia API (v{0}).
#
# Do not edit it directly: it is automatically generated by `api/gen.py'.
#
......@@ -912,7 +908,7 @@ class API:
write_module(m, indent)
f.write(indent[:-2] + "} // namespace " + module.name + "\n\n")
with open("gmsh.h", "w") as f:
f.write(cpp_header)
f.write(cpp_header.format(self.api_version))
for m in self.modules:
write_module(m, "")
f.write(cpp_footer)
......@@ -991,12 +987,12 @@ class API:
with open("gmshc.h", "w") as f:
with open("gmshc.cpp", "w") as fc:
with open("gmsh.h_cwrap", "w") as fcwrap:
f.write(c_header)
f.write(c_header.format(self.api_version))
fc.write(c_cpp_header)
fc.write(cwrap_utils)
fc.write(c_cpp_utils)
fc.write("\n")
fcwrap.write(cwrap_header)
fcwrap.write(cwrap_header.format(self.api_version))
fcwrap.write("namespace gmsh {\n")
s = string.split(cwrap_utils, '\n')
for line in s:
......@@ -1117,6 +1113,7 @@ class API:
f.write('"""\n')
f.write("module " + m.name + "\n\n")
if level == 1:
f.write('const GMSH_API_VERSION = "' + self.api_version + '"\n')
f.write('const clib = is_windows() ? "gmsh-' + self.api_version +
'" : "libgmsh"\n')
else:
......
......@@ -6,7 +6,7 @@
#ifndef _GMSH_H_
#define _GMSH_H_
// This file defines the Gmsh C++ API.
// This file defines the Gmsh C++ API (v3.0).
//
// Do not edit it directly: it is automatically generated by `api/gen.py'.
//
......@@ -22,6 +22,8 @@
#include <string>
#include <utility>
#define GMSH_API_VERSION "3.0"
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
......
......@@ -6,7 +6,7 @@
#ifndef _GMSH_H_
#define _GMSH_H_
// This file redefines the Gmsh C++ API in terms of the C API.
// This file redefines the Gmsh C++ API in terms of the C API (v3.0).
//
// This is provided as a convenience for users of the binary Gmsh SDK whose C++
// compiler ABI is not compatible with the ABI of the C++ compiler used to create
......@@ -30,16 +30,6 @@
#include <string>
#include <utility>
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
#else
#define GMSH_API __declspec(dllimport)
#endif
#else
#define GMSH_API
#endif
extern "C" {
#include "gmshc.h"
}
......
......@@ -3,7 +3,7 @@
# See the LICENSE.txt file for license information. Please report all
# bugs and problems to the public mailing list <gmsh@onelab.info>.
# This file defines the Gmsh Julia API.
# This file defines the Gmsh Julia API (v3.0).
#
# Do not edit it directly: it is automatically generated by `api/gen.py'.
#
......@@ -18,6 +18,7 @@ Top-level functions
"""
module gmsh
const GMSH_API_VERSION = "3.0"
const clib = is_windows() ? "gmsh-3.0" : "libgmsh"
"""
......
......@@ -3,7 +3,7 @@
# See the LICENSE.txt file for license information. Please report all
# bugs and problems to the public mailing list <gmsh@onelab.info>.
# This file defines the Gmsh Python API.
# This file defines the Gmsh Python API (v3.0).
#
# Do not edit it directly: it is automatically generated by `api/gen.py'.
#
......@@ -17,6 +17,8 @@ import os
import platform
from math import pi
GMSH_API_VERSION = "3.0"
signal.signal(signal.SIGINT, signal.SIG_DFL)
libdir = os.path.dirname(os.path.realpath(__file__))
if platform.system() == 'Windows':
......
......@@ -9,7 +9,7 @@
#define _GMSHC_H_
/*
* This file defines the Gmsh C API.
* This file defines the Gmsh C API (v3.0).
*
* Do not edit it directly: it is automatically generated by `api/gen.py'.
*
......@@ -19,6 +19,8 @@
#include <stddef.h>
#define GMSH_API_VERSION "3.0"
#if defined(GMSH_DLL)
#if defined(GMSH_DLL_EXPORT)
#define GMSH_API __declspec(dllexport)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment