Skip to content

Commit

Permalink
Restore get_default_mathematica_dir and rename get_default_mathematic…
Browse files Browse the repository at this point in the history
…a_dirs to get_default_wolfram_dirs.
  • Loading branch information
rafal-c committed Oct 19, 2020
1 parent c4999f2 commit 279877f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmake/FindWolframLanguage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ macro(find_wolfram_language_on_path)
endmacro()

function(find_wolfram_language_in_default_dir WolframLanguage_VERSION)
get_default_mathematica_dirs(${WolframLanguage_VERSION} _DEFAULT_DIRS)
get_default_wolfram_dirs(${WolframLanguage_VERSION} _DEFAULT_DIRS)
find_program(WolframLanguage_EXE
NAMES ${_MMA_FIND_NAMES}
HINTS ${_DEFAULT_DIRS}
Expand Down
50 changes: 35 additions & 15 deletions cmake/Wolfram/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,48 @@

include_guard()

function(get_default_mathematica_dirs MATHEMATICA_VERSION DEFAULT_MATHEMATICA_INSTALL_DIRS)
function(get_default_mathematica_dir MATHEMATICA_VERSION DEFAULT_MATHEMATICA_INSTALL_DIR)
set(_M_INSTALL_DIR NOTFOUND)
if(APPLE)
set(_M_INSTALL_DIR
"/Applications/WolframDesktop ${MATHEMATICA_VERSION}.app"
"/Applications/WolframDesktop.app"
find_path(_M_INSTALL_DIR "Contents" PATHS
"/Applications/Mathematica ${MATHEMATICA_VERSION}.app"
"/Applications/Mathematica.app"
"/Applications/WolframEngine ${MATHEMATICA_VERSION}.app"
"/Applications/WolframEngine.app")
)
set(_M_INSTALL_DIR "${_M_INSTALL_DIR}/Contents")
elseif(WIN32)
set(_M_INSTALL_DIR "C:/Program\ Files/Wolfram\ Research/Mathematica/${MATHEMATICA_VERSION}")
else()
set(_M_INSTALL_DIR "/usr/local/Wolfram/Mathematica/${MATHEMATICA_VERSION}")
endif()
if(NOT IS_DIRECTORY "${_M_INSTALL_DIR}" AND IS_DIRECTORY "$ENV{MATHEMATICA_HOME}")
set(_M_INSTALL_DIR "$ENV{MATHEMATICA_HOME}")
endif()
set(${DEFAULT_MATHEMATICA_INSTALL_DIR} "${_M_INSTALL_DIR}" PARENT_SCOPE)
endfunction()

function(get_wolfram_product_default_dirs PRODUCT_NAME PRODUCT_VERSION DEFAULT_PRODUCT_INSTALL_DIR)
set(_DEFAULT_INSTALL_DIR NOTFOUND)
if(APPLE)
set(_DEFAULT_INSTALL_DIR
"/Applications/${PRODUCT_NAME} ${PRODUCT_VERSION}.app"
"/Applications/${PRODUCT_NAME}.app")
elseif(WIN32)
set(_M_INSTALL_DIR
"C:/Program\ Files/Wolfram\ Research/WolframDesktop/${MATHEMATICA_VERSION}"
"C:/Program\ Files/Wolfram\ Research/Mathematica/${MATHEMATICA_VERSION}"
"C:/Program\ Files/Wolfram\ Research/WolframEngine/${MATHEMATICA_VERSION}")
set(_DEFAULT_INSTALL_DIR "C:/Program\ Files/Wolfram\ Research/${PRODUCT_NAME}/${PRODUCT_VERSION}")
else()
set(_M_INSTALL_DIR
"/usr/local/Wolfram/WolframDesktop/${MATHEMATICA_VERSION}"
"/usr/local/Wolfram/Mathematica/${MATHEMATICA_VERSION}"
"/usr/local/Wolfram/WolframEngine/${MATHEMATICA_VERSION}")
set(_DEFAULT_INSTALL_DIR "/usr/local/Wolfram/${PRODUCT_NAME}/${PRODUCT_VERSION}")
endif()
set(${DEFAULT_MATHEMATICA_INSTALL_DIRS} "${_M_INSTALL_DIR}" PARENT_SCOPE)
set(${DEFAULT_PRODUCT_INSTALL_DIR} "${_DEFAULT_INSTALL_DIR}" PARENT_SCOPE)
endfunction()

function(get_default_wolfram_dirs WL_VERSION DEFAULT_INSTALL_DIRS)
get_wolfram_product_default_dirs(WolframDesktop ${WL_VERSION} _WD_INSTALL_DIRS)
get_wolfram_product_default_dirs(Mathematica ${WL_VERSION} _M_INSTALL_DIRS)
get_wolfram_product_default_dirs(WolframEngine ${WL_VERSION} _WE_INSTALL_DIRS)
set(${DEFAULT_INSTALL_DIRS}
"${_WD_INSTALL_DIRS}"
"${_M_INSTALL_DIRS}"
"${_WE_INSTALL_DIRS}"
PARENT_SCOPE)
endfunction()

function(detect_system_id DETECTED_SYSTEM_ID)
Expand Down

0 comments on commit 279877f

Please sign in to comment.