Merge pull request #407 from CoolProp/VB.net

Add Vb.net support using VS2012
This commit is contained in:
Ian Bell
2015-01-15 08:06:16 +01:00
9 changed files with 338 additions and 12 deletions

View File

@@ -431,18 +431,21 @@ if (COOLPROP_CSHARP_MODULE)
# Make a src directory to deal with file permissions problem with MinGW makefile
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src)
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}")
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}")
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
# Set properties before adding module
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES CPLUSPLUS ON)
if (WIN32)
SET(CMAKE_SWIG_FLAGS -dllimport \"CoolProp\")
#SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "-dllimport CoolProp")
SET(MORE_SWIG_FLAGS -dllimport \"CoolProp\")
endif()
# Define which headers the CoolProp wrapper is dependent on
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
set(SWIG_OPTIONS "${COOLPROP_SWIG_OPTIONS}" "${MORE_SWIG_FLAGS}")
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
message(STATUS "options passed to swig: ${SWIG_OPTIONS}")
# Set properties before adding module
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}" CPLUSPLUS ON)
SWIG_ADD_MODULE(CoolProp csharp ${I_FILE} ${APP_SOURCES})
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
@@ -482,6 +485,63 @@ if (COOLPROP_CSHARP_MODULE)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/testing_root/Csharp${BITNESS})
endif()
if (COOLPROP_VBDOTNET_MODULE)
# Must have SWIG and C#
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(Csharp REQUIRED)
# Make a src directory to deal with file permissions problem with MinGW makefile
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB)
SET(MORE_SWIG_FLAGS -dllimport \"CoolProp\" -namespace CoolProp)
SET(CMAKE_SWIG_OUTDIR CoolPropVB/CsharpClassLibrary)
# Define which headers the CoolProp wrapper is dependent on
SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${SWIG_DEPENDENCIES})
set(SWIG_OPTIONS "${MORE_SWIG_FLAGS}")
string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}")
message(STATUS "options passed to swig: ${SWIG_OPTIONS}")
# Set properties before adding module
set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i")
SET_PROPERTY(SOURCE ${I_FILE} PROPERTY CPLUSPLUS ON)
SET_PROPERTY(SOURCE ${I_FILE} PROPERTY SWIG_FLAGS ${SWIG_OPTIONS})
SWIG_ADD_MODULE(CoolProp csharp ${I_FILE} ${APP_SOURCES})
add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself
if (WIN32)
set_target_properties(CoolProp PROPERTIES PREFIX "")
endif()
add_dependencies (${app_name} generate_headers)
add_custom_command(TARGET CoolProp
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/wrappers/VB.NET/CoolPropVB ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(TARGET CoolProp
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:CoolProp> ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB/CoolPropVB
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(TARGET CoolProp
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB/CsharpClassLibrary/CoolPropCSHARP_wrap.cxx
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_command(TARGET CoolProp
POST_BUILD
COMMAND 7z a "${CMAKE_CURRENT_BINARY_DIR}/VB.net_VS2012_example.7z" "${CMAKE_CURRENT_BINARY_DIR}/CoolPropVB"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/VB.net_VS2012_example.7z" DESTINATION ${CMAKE_INSTALL_PREFIX}/VB.NET)
endif()
if (COOLPROP_JAVA_MODULE)
# Must have SWIG and Java

View File

@@ -16,6 +16,7 @@ Target Operating Systems Not
:ref:`Python <Python>` linux, OSX, win Wrapper is Cython based
:ref:`Octave <Octave>` linux, OSX, win Wrapper is SWIG based
:ref:`C# <Csharp>` linux, OSX, win Wrapper is SWIG based
:ref:`VB.net <VBdotNet>` windows only Wrapper is SWIG based
:ref:`MATLAB <MATLAB>` linux, OSX, win Wrapper is SWIG based
:ref:`Java <Java>` linux, OSX, win Wrapper is SWIG based
:ref:`Scilab <Scilab>` linux, OSX, win Wrapper is SWIG based (experimental)
@@ -122,4 +123,5 @@ and explicitly typing "agree" before closing. Then you can use the compiler from
SMath/index.rst
StaticLibrary/index.rst
SharedLibrary/index.rst
DelphiLazarus/index.rst
DelphiLazarus/index.rst
VBdotNET/index.rst

View File

@@ -932,13 +932,17 @@ c['builders'].append(
#Common boring 64-bit modules for windows, linux and OSX
### OSX
for platform in ['OSX', 'linux', 'windows']:
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','STATIC_LIBRARY','MATHEMATICA']:
for wrapper in ['Java','Csharp','Octave','PHP','64BIT_SHARED_LIBRARY','STATIC_LIBRARY','MATHEMATICA','VBDOTNET']:
if wrapper == 'PHP' and platform != 'linux': continue # only build PHP on linux
if wrapper == 'VBDOTNET' and !platform.startswith('windows'): continue # only build VB.net on windows
ctest_args, cmake_args, build_args = [], [], []
if platform.startswith('windows'):
ctest_args = ['-C', 'Release']
if wrapper == 'Octave':
cmake_args = ['-G', '"MinGW Makefiles"']
elif wrapper == 'VBDOTNET':
cmake_args = ['-G', '"Visual Studio 11 2012 Win64"']
build_args = ['--config','Release']
else:
cmake_args = ['-G', '"Visual Studio 10 2010 Win64"']
build_args = ['--config','Release']

View File

@@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CoolPropVB", "CoolPropVB\CoolPropVB.vbproj", "{221A231D-EA9F-451E-A648-ADB53E43814B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsharpClassLibrary", "CsharpClassLibrary\CsharpClassLibrary.csproj", "{DEC3B691-4510-4181-89EE-7A4A495936A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|x64.ActiveCfg = Debug|x64
{221A231D-EA9F-451E-A648-ADB53E43814B}.Debug|x64.Build.0 = Debug|x64
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|Any CPU.Build.0 = Release|Any CPU
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|x64.ActiveCfg = Release|x64
{221A231D-EA9F-451E-A648-ADB53E43814B}.Release|x64.Build.0 = Release|x64
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|x64.ActiveCfg = Debug|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Debug|x64.Build.0 = Debug|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|Any CPU.Build.0 = Release|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|x64.ActiveCfg = Release|Any CPU
{DEC3B691-4510-4181-89EE-7A4A495936A6}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{221A231D-EA9F-451E-A648-ADB53E43814B}</ProjectGuid>
<OutputType>Exe</OutputType>
<StartupObject>CoolPropVB.Example</StartupObject>
<RootNamespace>CoolPropVB</RootNamespace>
<AssemblyName>CoolPropVB</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Debug\</OutputPath>
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Release\</OutputPath>
<DocumentationFile>CoolPropVB.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>ManagedMinimumRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Example.vb" />
<ProjectReference Include="..\CsharpClassLibrary\CsharpClassLibrary.csproj">
<Project>{dec3b691-4510-4181-89ee-7a4a495936a6}</Project>
<Name>CsharpClassLibrary</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="CoolProp.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,19 @@
Module Example
Sub Main()
' High-level interface example
Dim Tbp As Double
Tbp = CoolProp.CoolProp.PropsSI("T", "P", 101325, "Q", 0, "Water")
Console.Write(Tbp)
Console.Write(vbCrLf)
' Low-level interface example
Dim Water As CoolProp.AbstractState
Water = CoolProp.AbstractState.factory("HEOS", "Water")
Water.update(CoolProp.input_pairs.PQ_INPUTS, 101325, 0)
Console.Write(Water.T())
Console.Write(vbCrLf)
End Sub
End Module

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DEC3B691-4510-4181-89EE-7A4A495936A6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ClassLibrary1</RootNamespace>
<AssemblyName>CsharpClassLibrary</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="*.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CoolProp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CoolProp")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8a84d196-96fc-47c6-b341-ed1ade8ee040")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]