aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Lakhtanov <ivan.lakhtanov@gmail.com>2016-09-20 12:43:08 (GMT)
committerIvan Lakhtanov <ivan.lakhtanov@gmail.com>2016-09-20 12:43:08 (GMT)
commitb25211738b84f915335625992826dbfe6b2d860f (patch)
treedfc94177640500dca7e84585776571fd51658fcc
parent66a2dc3499fdb9d19f84bd4f27964662b1768e85 (diff)
Fixes for build system and added FindJulia.cmakevaness-julia-backend
Bug: 368986 Differential Revision: https://phabricator.kde.org/D2575
-rw-r--r--cmake/FindJulia.cmake55
-rw-r--r--src/backends/CMakeLists.txt13
-rw-r--r--src/backends/julia/juliaserver/CMakeLists.txt2
3 files changed, 68 insertions, 2 deletions
diff --git a/cmake/FindJulia.cmake b/cmake/FindJulia.cmake
new file mode 100644
index 0000000..29abf00
--- /dev/null
+++ b/cmake/FindJulia.cmake
@@ -0,0 +1,55 @@
+if(Julia_FOUND)
+ return()
+endif()
+
+# Looking for Julia executable
+find_program(Julia_EXECUTABLE julia DOC "Julia executable")
+if(NOT Julia_EXECUTABLE)
+ return()
+endif()
+
+# Getting Julia version
+execute_process(
+ COMMAND ${Julia_EXECUTABLE} --version
+ OUTPUT_VARIABLE Julia_VERSION_STRING
+ RESULT_VARIABLE RETURN_CODE
+)
+if(RETURN_CODE EQUAL 0)
+ string(
+ REGEX REPLACE ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1"
+ Julia_VERSION_STRING ${Julia_VERSION_STRING}
+ )
+else()
+ return()
+endif()
+
+# Julia includes
+execute_process(
+ COMMAND ${Julia_EXECUTABLE} -E "JULIA_HOME"
+ OUTPUT_VARIABLE Julia_INCLUDE_DIRS
+ RESULT_VARIABLE RETURN_CODE
+)
+if(RETURN_CODE EQUAL 0)
+ set(
+ Julia_INCLUDE_DIRS
+ "${Julia_INCLUDE_DIRS}/../include/julia"
+ )
+ string(REGEX REPLACE "(\"|\n)" "" Julia_INCLUDE_DIRS ${Julia_INCLUDE_DIRS})
+ string(STRIP Julia_INCLUDE_DIRS ${Julia_INCLUDE_DIRS})
+ set(
+ Julia_INCLUDE_DIRS ${Julia_INCLUDE_DIRS}
+ CACHE PATH "Location of Julia include files"
+ )
+else()
+ return()
+endif()
+
+# Checking existance of main header. Some distos provide packages without actual includes
+find_path(Julia_MAIN_HEADER julia.h HINTS ${Julia_INCLUDE_DIRS})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Julia
+ REQUIRED_VARS Julia_EXECUTABLE Julia_MAIN_HEADER Julia_INCLUDE_DIRS
+ VERSION_VAR Julia_VERSION_STRING
+ FAIL_MESSAGE "Julia not found"
+)
diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt
index a5b1416..3fb5293 100644
--- a/src/backends/CMakeLists.txt
+++ b/src/backends/CMakeLists.txt
@@ -14,7 +14,6 @@ add_subdirectory(null)
add_subdirectory(maxima)
add_subdirectory(octave)
add_subdirectory(scilab)
-add_subdirectory(julia)
if(NOT WIN32)
add_subdirectory(sage)
@@ -90,3 +89,15 @@ find_package(LuaJIT)
if(LUAJIT_FOUND)
add_subdirectory(lua)
endif(LUAJIT_FOUND)
+
+set_package_properties(
+ Julia
+ PROPERTIES DESCRIPTION "Julia is a high-level, high-performance dynamic programming language for technical computing"
+ URL "http://julialang.org/"
+ TYPE OPTIONAL
+ PURPOSE "Backend to use Julia with Cantor.")
+
+find_package(Julia)
+if(Julia_FOUND)
+ add_subdirectory(julia)
+endif()
diff --git a/src/backends/julia/juliaserver/CMakeLists.txt b/src/backends/julia/juliaserver/CMakeLists.txt
index c6b6771..e412432 100644
--- a/src/backends/julia/juliaserver/CMakeLists.txt
+++ b/src/backends/julia/juliaserver/CMakeLists.txt
@@ -6,7 +6,7 @@ set(JuliaServer_SRCS
add_executable(cantor_juliaserver ${JuliaServer_SRCS})
target_link_libraries(cantor_juliaserver
- julia
+ ${JULIA_LIBRARY}
Qt5::Widgets
Qt5::DBus
)