@@ -34,7 +34,7 @@ cmake_minimum_required(VERSION 2.8.12)
3434cmake_policy (POP )
3535
3636set (Mathematica_CMAKE_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR } " )
37- set (Mathematica_CMAKE_MODULE_VERSION "3.2.7 " )
37+ set (Mathematica_CMAKE_MODULE_VERSION "3.3.0 " )
3838
3939# activate select policies
4040if (POLICY CMP0025)
@@ -245,7 +245,8 @@ macro (_get_program_names _outProgramNames)
245245 set (_MathematicaApps "Mathematica" "Wolfram Desktop" "Wolfram Engine" "gridMathematica Server" )
246246 # Mathematica product versions in order of preference
247247 set (_MathematicaVersions
248- "12.0" "11.3" "11.2" "11.1" "11.0"
248+ "12.1" "12.0"
249+ "11.3" "11.2" "11.1" "11.0"
249250 "10.4" "10.3" "10.2" "10.1" "10.0"
250251 "9.0" "8.0" "7.0" "6.0" "5.2" )
251252 # search for explicitly requested application version first
@@ -647,7 +648,17 @@ macro (_get_host_system_IDs _outSystemIDs)
647648endmacro ()
648649
649650macro (_get_supported_systemIDs _version _outSystemIDs )
650- if (NOT "${_version} " VERSION_LESS "10.0" )
651+ if (NOT "${_version} " VERSION_LESS "12.1" )
652+ set (${_outSystemIDs}
653+ "Windows-x86-64"
654+ "Linux-x86-64" "Linux-ARM"
655+ "MacOSX-x86-64" )
656+ elseif (NOT "${_version} " VERSION_LESS "11.3" )
657+ set (${_outSystemIDs}
658+ "Windows" "Windows-x86-64"
659+ "Linux-x86-64" "Linux-ARM"
660+ "MacOSX-x86-64" )
661+ elseif (NOT "${_version} " VERSION_LESS "10.0" )
651662 set (${_outSystemIDs}
652663 "Windows" "Windows-x86-64"
653664 "Linux" "Linux-x86-64" "Linux-ARM"
@@ -704,8 +715,16 @@ macro (_get_compatible_system_IDs _systemID _outSystemIDs)
704715 else ()
705716 list (APPEND ${_outSystemIDs} "Windows-x86-64" )
706717 endif ()
707- # Windows x64 can run x86 through WoW64
708- list (APPEND ${_outSystemIDs} "Windows" )
718+ if (Mathematica_VERSION)
719+ # Mathematica 12.1 dropped support for x86
720+ if ("${Mathematica_VERSION} " VERSION_LESS "12.1" )
721+ # Windows x64 can run x86 through WoW64
722+ list (APPEND ${_outSystemIDs} "Windows" )
723+ endif ()
724+ else ()
725+ # Windows x64 can run x86 through WoW64
726+ list (APPEND ${_outSystemIDs} "Windows" )
727+ endif ()
709728 elseif ("${_systemID} " MATCHES "MacOSX|Darwin" )
710729 if ("${_systemID} " MATCHES "MacOSX-x86" )
711730 if (Mathematica_VERSION)
@@ -1910,6 +1929,13 @@ macro (_find_jlink)
19101929 DOC "J/Link Java launcher."
19111930 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
19121931 )
1932+ find_path (Mathematica_JLink_JAVA_HOME
1933+ NAMES "bin/${_JLinkJavaNames} "
1934+ HINTS "${_mmaJavaHome} "
1935+ PATH_SUFFIXES ${_HostSystemIDs}
1936+ DOC "J/Link Java home directory."
1937+ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
1938+ )
19131939endmacro ()
19141940
19151941# internal macro to find MUnit package
@@ -2412,6 +2438,7 @@ macro (_log_found_variables)
24122438 message (STATUS "J/Link JAR file ${Mathematica_JLink_JAR_FILE} " )
24132439 message (STATUS "J/Link native library ${Mathematica_JLink_RUNTIME_LIBRARY} " )
24142440 message (STATUS "J/Link java launcher ${Mathematica_JLink_JAVA_EXECUTABLE} " )
2441+ message (STATUS "J/Link java home directory ${Mathematica_JLink_JAVA_HOME} " )
24152442 else ()
24162443 message (STATUS "J/Link not found" )
24172444 endif ()
@@ -2515,7 +2542,8 @@ macro (_get_dependent_cache_variables _var _outDependentVars)
25152542 Mathematica_JLink_PACKAGE_DIR
25162543 Mathematica_MUnit_PACKAGE_FILE
25172544 Mathematica_LibraryLink_PACKAGE_FILE
2518- Mathematica_JLink_JAVA_EXECUTABLE)
2545+ Mathematica_JLink_JAVA_EXECUTABLE
2546+ Mathematica_JLink_JAVA_HOME)
25192547 _get_dependent_cache_variables ("Mathematica_MathLink_HOST_ROOT_DIR" ${_outDependentVars} )
25202548 _get_dependent_cache_variables ("Mathematica_WSTP_HOST_ROOT_DIR" ${_outDependentVars} )
25212549 _get_dependent_cache_variables ("Mathematica_JLink_PACKAGE_DIR" ${_outDependentVars} )
@@ -2654,6 +2682,7 @@ macro (_update_cache)
26542682 Mathematica_LibraryLink_PACKAGE_FILE
26552683 Mathematica_JLink_RUNTIME_LIBRARY
26562684 Mathematica_JLink_JAVA_EXECUTABLE
2685+ Mathematica_JLink_JAVA_HOME
26572686 )
26582687 _get_cache_variables (_CacheVariables )
26592688 foreach (_CacheVariable IN LISTS _CacheVariables)
@@ -2724,6 +2753,8 @@ macro (_setup_found_variables)
27242753 _get_components_to_find (_components )
27252754 foreach (_component IN LISTS _components)
27262755 _get_required_vars (${_component} _requiredComponentVars )
2756+ # suppress find_package_handle_standard_args warning on mismatching names
2757+ set (FPHSA_NAME_MISMATCHED On )
27272758 find_package_handle_standard_args (
27282759 Mathematica_${_component}
27292760 REQUIRED_VARS ${_requiredComponentVars}
@@ -3407,54 +3438,6 @@ function (Mathematica_ADD_TEST)
34073438 add_test (${_cmd} )
34083439endfunction (Mathematica_ADD_TEST )
34093440
3410- # public function to add target that runs Mathematica Splice function on template file
3411- function (Mathematica_SPLICE_C_CODE _templateFile )
3412- get_filename_component (_templateFileBaseName ${_templateFile} NAME_WE )
3413- get_filename_component (_templateFileName ${_templateFile} NAME )
3414- get_filename_component (_templateFileAbs ${_templateFile} ABSOLUTE )
3415- get_filename_component (_templateFileExt ${_templateFileName} EXT )
3416- set (_options "" )
3417- set (_oneValueArgs "OUTPUT" )
3418- set (_multiValueArgs "" )
3419- cmake_parse_arguments (_option "${_options} " "${_oneValueArgs} " "${_multiValueArgs} " ${ARGN} )
3420- if (_option_UNPARSED_ARGUMENTS)
3421- message (FATAL_ERROR "Unknown keywords: ${_option_UNPARSED_ARGUMENTS} " )
3422- endif ()
3423- # Mathematica function Splice does not produce output in current working directory
3424- # Use absolute paths to make it write to the current binary directory
3425- if (_option_OUTPUT)
3426- if (IS_ABSOLUTE ${_option_OUTPUT} )
3427- set (_outputFileAbs "${_option_OUTPUT} " )
3428- else ()
3429- set (_outputFileAbs "${CMAKE_CURRENT_BINARY_DIR } /${_option_OUTPUT} " )
3430- endif ()
3431- else ()
3432- set (_outputFileAbs "${CMAKE_CURRENT_BINARY_DIR } /${_templateFileBaseName} .c" )
3433- endif ()
3434- # Always set FormatType option to prevent Splice function from failing with a
3435- # Splice::splict error if the template file path contains more than one dot character
3436- string (TOLOWER ${_templateFileExt} _templateFileExt)
3437- if ("${_templateFileExt} " STREQUAL ".mc" )
3438- set (_formatType "CForm" )
3439- elseif ("${_templateFileExt} " STREQUAL ".mf" )
3440- set (_formatType "FortranForm" )
3441- elseif ("${_templateFileExt} " STREQUAL ".mtex" )
3442- set (_formatType "TeXForm" )
3443- else ()
3444- set (_formatType "Automatic" )
3445- endif ()
3446- get_filename_component (_outputFileName ${_outputFileAbs} NAME )
3447- Mathematica_TO_NATIVE_PATH ("${_templateFileAbs} " _templateFileMma )
3448- Mathematica_TO_NATIVE_PATH ("${_outputFileAbs} " _outputFileMma )
3449- set (_msg "Splicing Mathematica code in ${_templateFileName} to ${_outputFileName} " )
3450- Mathematica_ADD_CUSTOM_COMMAND (
3451- CODE "Splice[${_templateFileMma} , ${_outputFileMma} , FormatType->${_formatType} ]"
3452- OUTPUT "${_outputFileAbs} "
3453- DEPENDS "${_templateFileAbs} "
3454- COMMENT ${_msg} )
3455- set_source_files_properties (${_outputFileAbs} PROPERTIES GENERATED TRUE LABELS "Mathematica" )
3456- endfunction (Mathematica_SPLICE_C_CODE )
3457-
34583441# public function to add target that runs Mathematica Encode function on input files
34593442function (Mathematica_ENCODE )
34603443 set (_options "CHECK_TIMESTAMPS" )
@@ -4472,7 +4455,7 @@ endfunction (Mathematica_ADD_DOCUMENTATION)
44724455
44734456endif (Mathematica_KERNEL_EXECUTABLE AND Mathematica_JLink_FOUND )
44744457
4475- if (Mathematica_KERNEL_EXECUTABLE AND Mathematica_JLink_FOUND AND JAVA_FOUND )
4458+ if (Mathematica_KERNEL_EXECUTABLE AND Mathematica_JLink_FOUND)
44764459
44774460# public function to simplify testing J/Link programs
44784461function (Mathematica_JLink_ADD_TEST )
@@ -4543,4 +4526,4 @@ function (Mathematica_JLink_ADD_TEST)
45434526 add_test (${_cmd} )
45444527endfunction (Mathematica_JLink_ADD_TEST )
45454528
4546- endif (Mathematica_KERNEL_EXECUTABLE AND Mathematica_JLink_FOUND AND JAVA_FOUND )
4529+ endif (Mathematica_KERNEL_EXECUTABLE AND Mathematica_JLink_FOUND )
0 commit comments