Skip to content

Commit 505f90b

Browse files
committed
FindMathematica 3.1
1 parent 3458912 commit 505f90b

File tree

8 files changed

+166
-116
lines changed

8 files changed

+166
-116
lines changed

CMake/Mathematica/FindMathematica.cmake

Lines changed: 115 additions & 86 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FindMathematica example project
22

3-
cmake_minimum_required(VERSION 2.8.9)
3+
cmake_minimum_required(VERSION 2.8.12)
44

55
project (Mathematica-project)
66

CodeGenerationExamples/control.m

Lines changed: 0 additions & 6 deletions
This file was deleted.

HISTORY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 3.1.0 (2015-04-06)
2+
3+
* add compatibility with *Mathematica* 10.1
4+
* fix CMake 3.2 compatibility issues
5+
* require at least CMake 2.8.12
6+
* remove obsolete code required for CMake versions older than 2.8.12
7+
* prefer modern executable names (i.e., `wolfram.exe`) over classic ones (i.e., `math.exe`)
8+
* add parameter `LINK_MODE` to some functions (see manual)
9+
* manual updates
10+
111
## 3.0.3 (2015-02-11)
212

313
* work around `cmd.exe` command line length limit when running *Mathematica* code

MANUAL.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ By default FindMathematica will return the newest *Mathematica* installation it
5252
To find a minimum version of *Mathematica*, run the `find_package` command with a version
5353
argument:
5454

55-
find_package(Mathematica 9.0)
55+
find_package(Mathematica 10.0)
5656

5757
To find a specific version of *Mathematica*, run the `find_package` command with a version
5858
argument and the parameter `EXACT`:
5959

60-
find_package(Mathematica 9.0.1 EXACT)
60+
find_package(Mathematica 10.0.2 EXACT)
6161

6262
Depending on the version of *Mathematica*, the FindMathematica module will try to find the
6363
components `MathLink`, `WolframLibrary`, `WSTP`, `JLink` and `MUnit`. To explicitly specify the
@@ -302,7 +302,7 @@ The module defines the following variables for component `MathLink`:
302302
* `Mathematica_MathLink_LIBRARIES` - MathLink library for all target platforms and required system libraries
303303
* `Mathematica_MathLink_MPREP_EXECUTABLE` - path to host `mprep` executable (MathLink template file preprocessor)
304304
* `Mathematica_MathLink_HOST_INCLUDE_DIR` - header file mathlink.h include directory for host platform
305-
* `Mathematica_MathLink_DEFINITIONS` - MathLink compile definitions
305+
* `Mathematica_MathLink_DEFINITIONS` - MathLink compile definitions, e.g., "-DMLINTERFACE=3"
306306
* `Mathematica_MathLink_LINKER_FLAGS` - MathLink linker flags
307307
* `Mathematica_MathLink_VERSION` - MathLink version number given as "interface.revision"
308308
* `Mathematica_MathLink_VERSION_MAJOR` - MathLink interface number
@@ -320,7 +320,7 @@ The module defines the following variables for component `WSTP`:
320320
* `Mathematica_WSTP_LIBRARIES` - WSTP library for all target platforms and required system libraries
321321
* `Mathematica_WSTP_WSPREP_EXECUTABLE` - path to host `wsprep` executable (WSTP template file preprocessor)
322322
* `Mathematica_WSTP_HOST_INCLUDE_DIR` - header file wstp.h include directory for host platform
323-
* `Mathematica_WSTP_DEFINITIONS` - WSTP compile definitions
323+
* `Mathematica_WSTP_DEFINITIONS` - WSTP compile definitions, e.g., "-DWSINTERFACE=4"
324324
* `Mathematica_WSTP_LINKER_FLAGS` - WSTP linker flags
325325
* `Mathematica_WSTP_VERSION` - WSTP version number given as "interface.revision"
326326
* `Mathematica_WSTP_VERSION_MAJOR` - WSTP interface number
@@ -622,7 +622,8 @@ The output file is created in the `CMAKE_CURRENT_BINARY_DIR`. The name of the ou
622622
obtained by adding the extensions .c to the input file base name. The `OUTPUT` option can be used to
623623
produce an output file with a different name.
624624

625-
This function is available if the *Mathematica* kernel executable has been found.
625+
This function is available if the *Mathematica* kernel executable has been found. Note that the
626+
function `Splice` has been deprecated as of *Mathematica* 10.
626627

627628
Mathematica_ENCODE(
628629
<input file> [ <input file> ... ]
@@ -685,9 +686,9 @@ Under OS X this function replaces the default install names used for *Mathematic
685686
libraries with absolute paths to those shared libraries for the given targets. On other platforms
686687
the function does not have an effect.
687688

688-
E.g., in *Mathematica* 8 the default install name for the MathLink shared library is:
689+
E.g., in *Mathematica* 10 the default install name for the MathLink shared library is:
689690

690-
@executable_path/../Frameworks/mathlink.framework/Versions/3.16/mathlink
691+
@executable_path/../Frameworks/mathlink.framework/Versions/4.25/mathlink
691692

692693
This path won't work for stand-alone executables that link to the dynamic MathLink library, unless
693694
the mathlink framework directory is added to the `DYLD_LIBRARY_PATH` environment variable. This
@@ -738,6 +739,7 @@ This function is available if the MathLink executable `mprep` has been found.
738739
[ SYSTEM_ID systemID ]
739740
[ KERNEL_OPTIONS <flag> [ <flag> ...] ]
740741
[ LINK_PROTOCOL <protocol> ]
742+
[ LINK_MODE Launch | ParentConnect ]
741743
[ INPUT text | INPUT_FILE file ]
742744
[ CONFIGURATIONS [ Debug | Release | ... ] ])
743745

@@ -752,10 +754,13 @@ The given *Mathematica* test code is wrapped in the following way:
752754
run <script file>
753755
Uninstall[link]
754756

757+
This corresponds to setting the `LINK_MODE` parameter to `ParentConnect`.
758+
755759
If neither `CODE` nor `SCRIPT` are present, the generated CMake test will launch the MathLink target
756-
executable as a front-end to the *Mathematica* kernel.
760+
executable as a front-end to the *Mathematica* kernel. This corresponds to setting the `LINK_MODE`
761+
parameter to `Launch`.
757762

758-
The `LINK_PROTOCOL` specifies the MathLink link protocol (e.g., `"TCPIP"`) to use.
763+
The `LINK_PROTOCOL` parameter specifies the MathLink link protocol (e.g., `"TCPIP"`) to use.
759764

760765
The text specified by the `INPUT` option is fed to the launched executable as standard input.
761766
The `INPUT_FILE` option specifies a file that is fed to the launched executable as standard input.
@@ -816,6 +821,7 @@ This function behaves as `Mathematica_MathLink_ADD_EXECUTABLE` but uses WSTP ins
816821
[ SYSTEM_ID systemID ]
817822
[ KERNEL_OPTIONS <flag> [ <flag> ...] ]
818823
[ LINK_PROTOCOL <protocol> ]
824+
[ LINK_MODE Launch | ParentConnect ]
819825
[ INPUT text | INPUT_FILE file ]
820826
[ CONFIGURATIONS [ Debug | Release | ... ] ])
821827

@@ -839,6 +845,7 @@ MathLink.
839845
[ SYSTEM_ID systemID ]
840846
[ KERNEL_OPTIONS <flag> [ <flag> ...] ]
841847
[ LINK_PROTOCOL <protocol> ]
848+
[ LINK_MODE Launch | ParentConnect ]
842849
[ INPUT text | INPUT_FILE file ]
843850
[ CONFIGURATIONS [ Debug | Release | ... ] ])
844851

@@ -853,8 +860,11 @@ The given *Mathematica* test code is wrapped in the following way:
853860
<stmnts>
854861
run <script file>
855862

863+
This corresponds to setting the `LINK_MODE` parameter to `ParentConnect`.
864+
856865
If neither `CODE` nor `SCRIPT` are present, the generated CMake test will launch the Java JAR target
857-
as a front-end to the *Mathematica* kernel.
866+
as a front-end to the *Mathematica* kernel. This corresponds to setting the `LINK_MODE` parameter
867+
to `Launch`.
858868

859869
The `LINK_PROTOCOL` specifies the MathLink link protocol (e.g., `"TCPIP"`) to use.
860870

@@ -882,7 +892,7 @@ This function is available if the *Mathematica* kernel executable has been found
882892
result [RELATIVE path]
883893
<test file> [ <test file> ... ] )
884894

885-
This function resolves `TestSuite[{ ... }]` expressions in the given MUnit test files (.mt)
895+
This function resolves `TestSuite[{ ... }]` expressions in the given MUnit test files (.mt or .wlt)
886896
into the list of underlying MUnit test files. The test file names are interpreted relative to
887897
the test suite file. By default the function returns the absolute paths of the parsed test
888898
files. If the `RELATIVE` option is specified, results will be returned as a relative path to
@@ -903,7 +913,7 @@ found.
903913
[ TIMEOUT seconds ]
904914
[ CONFIGURATIONS [ Debug | Release | ... ] ])
905915

906-
This function adds a CMake test which runs a Wolfram MUnit test file (.mt) or notebook. If the test
916+
This function adds a CMake test which runs a Wolfram MUnit test file (.mt or .wlt). If the test
907917
file contains a `TestSuite[{ ... }]` expression, all the test files that belong to the suite will be
908918
run.
909919

@@ -991,8 +1001,10 @@ just generate an empty documentation directory. This function is available if J/
9911001
Known Issues
9921002
------------
9931003

994-
* On Windows linking to the `WolframRTL_Static_Minimal.lib` library under Cygwin or MinGW fails.
1004+
* Each invocation of a *Mathematica* kernel through the FindMathematica module consumes one
1005+
Mathematica controller kernel license. You may run out of controller kernel licenses, if you
1006+
do a parallel build with CMake or run tests in parallel with CTest.
9951007

9961008
[aant]:http://ant.apache.org/
9971009
[cgwn]:http://www.cygwin.com/
998-
[cmtut]:http://www.cmake.org/cmake/help/cmake_tutorial.html
1010+
[cmtut]:http://www.cmake.org/cmake-tutorial/

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Features
88
--------
99

1010
* Works with Windows, Linux and OS X versions of *Mathematica*.
11-
* Finds *Mathematica* versions from 5.2 to 10.0.
11+
* Finds *Mathematica* versions from 5.2 to 10.1.
1212
* Finds include directories and libraries for [LibraryLink][wll] (*Mathematica* 8 to 10).
1313
* Finds include directories and libraries for [WSTP][wstp] (*Mathematica* 10).
1414
* Finds installation directory and JAR file of [J/Link][jlnk].
@@ -24,20 +24,18 @@ Features
2424
* Supports building dynamic libraries loadable with [LibraryLink][wll] (*Mathematica* 8 to 10).
2525
* Supports generating stand-alone C code from *Mathematica* code with [CCodeGenerator][ccg]
2626
(*Mathematica* 8 to 10).
27-
* Provides CMake interface to *Mathematica*'s [Splice][splc] function.
2827
* Provides CMake interface to *Mathematica*'s [Encode][encd] function.
2928
* Supports generating *Mathematica* documentation with the DocumentationBuild package.
3029
* Fully leverages CMake's [cross-compiling][ccrc] support.
3130

3231
Requirements
3332
------------
3433

35-
* A Wolfram [*Mathematica*][wmma] product (*Mathematica* 5.2 to 10.0, gridMathematica 7.0 to 10.0
36-
or Wolfram Finance Platform).
37-
* [CMake 2.8.9][cmk] or newer. The executable `cmake` should be on the system path.
34+
* A Wolfram [*Mathematica*][wmma] product (*Mathematica*, gridMathematica, Wolfram Finance Platform).
35+
* [CMake 2.8.12][cmk] or newer. The executable `cmake` should be on the system path.
3836
* [Visual Studio C++][vslstd], [MinGW][mingw] or [Cygwin][cgwn] under Windows.
39-
* [GCC][gcc] (including g++) under Linux.
40-
* [Xcode][xcdt] developer tools package under OS X.
37+
* [GCC][gcc] or [Clang][clang] under Linux or OS X.
38+
* [Xcode][xcdt] application or Xcode Command Line Tools under OS X.
4139

4240
Installation
4341
------------
@@ -59,14 +57,14 @@ See the [FindMathematica manual][manual] for more information.
5957

6058
[ccg]:http://reference.wolfram.com/language/CCodeGenerator/guide/CCodeGenerator.html
6159
[ccrc]:http://www.cmake.org/Wiki/CMake_Cross_Compiling
60+
[clang]:http://clang.llvm.org/
6261
[cgwn]:http://www.cygwin.com/
63-
[cmk]:http://www.cmake.org/cmake/resources/software.html
62+
[cmk]:http://www.cmake.org/download/
6463
[encd]:http://reference.wolfram.com/language/ref/Encode.html
6564
[gcc]:http://gcc.gnu.org/
6665
[jlnk]:http://reference.wolfram.com/language/JLink/tutorial/Overview.html
6766
[manual]:https://github.com/sakra/FindMathematica/blob/master/MANUAL.md
6867
[mingw]:http://www.mingw.org/
69-
[splc]:http://reference.wolfram.com/language/ref/Splice.html
7068
[vslstd]:http://msdn.microsoft.com/vstudio/
7169
[wll]:http://reference.wolfram.com/language/guide/LibraryLink.html
7270
[wmma]:http://www.wolfram.com/mathematica/

WSTPExamples/bitopsTest.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(* Mathematica MathLink test script for bitops.tm *)
2+
3+
?bitAnd
4+
?bitComplements
5+
Print[bitAnd[2^^1011010111,2^^1101101011]]
6+
Print[bitComplements[{0,1,2}]]

WSTPExamples/test_input.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
369

0 commit comments

Comments
 (0)