Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone desktop
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone desktop
Commits
96253e87
Commit
96253e87
authored
7 months ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Find julia command, shared dir, and cflags automatically
parent
4f8fe971
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
c++/CMakeLists.txt
+47
-5
47 additions, 5 deletions
c++/CMakeLists.txt
with
47 additions
and
5 deletions
c++/CMakeLists.txt
+
47
−
5
View file @
96253e87
...
@@ -6,11 +6,53 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
...
@@ -6,11 +6,53 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++20"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++20"
)
# julia
# find `julia` command
# TODO: use JULIA_BINDIR
if
(
NOT DEFINED JULIA_BIN
)
# with
find_program
(
JULIA_BIN julia
)
# ${JULIA_BINDIR}/../lib
if
(
NOT JULIA_BIN
)
# ${JULIA_BINDIR}/../include/
message
(
FATAL_ERROR
"Julia binary not found. Please set the JULIA_BIN variable."
)
endif
()
endif
()
# Find Julia's shared directory
execute_process
(
COMMAND
${
JULIA_BIN
}
-e
"print(joinpath(Sys.BINDIR, Base.DATAROOTDIR,
\"
julia
\"
))"
OUTPUT_VARIABLE JL_SHAREDIR
)
# Get flags from julia-config.jl
execute_process
(
COMMAND
${
JL_SHAREDIR
}
/julia-config.jl --cflags
OUTPUT_VARIABLE JULIA_CFLAGS
)
execute_process
(
COMMAND
${
JL_SHAREDIR
}
/julia-config.jl --cflags
OUTPUT_VARIABLE JULIA_CXXFLAGS
)
execute_process
(
COMMAND
${
JL_SHAREDIR
}
/julia-config.jl --ldflags
OUTPUT_VARIABLE JULIA_LDFLAGS
)
execute_process
(
COMMAND
${
JL_SHAREDIR
}
/julia-config.jl --ldlibs
OUTPUT_VARIABLE JULIA_LDLIBS
)
# Strip any leading/trailing whitespace from the flags
string
(
STRIP
"
${
JULIA_CFLAGS
}
"
JULIA_CFLAGS
)
string
(
STRIP
"
${
JULIA_CXXFLAGS
}
"
JULIA_CXXFLAGS
)
string
(
STRIP
"
${
JULIA_LDFLAGS
}
"
JULIA_LDFLAGS
)
string
(
STRIP
"
${
JULIA_LDLIBS
}
"
JULIA_LDLIBS
)
# Set the flags
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
JULIA_CFLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
JULIA_CXXFLAGS
}
"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
${
JULIA_LDFLAGS
}
"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"
${
CMAKE_SHARED_LINKER_FLAGS
}
${
JULIA_LDFLAGS
}
"
)
# Link the libraries
#target_link_libraries(${PROJECT_NAME} ${JULIA_LDLIBS})
set
(
JULIA_DIR
""
CACHE PATH
"Base directory where julia lib/ and include/ directories are located"
)
set
(
JULIA_DIR
""
CACHE PATH
"Base directory where julia lib/ and include/ directories are located"
)
find_library
(
JULIA_LIB NAMES julia HINTS
${
JULIA_DIR
}
/lib
)
find_library
(
JULIA_LIB NAMES julia HINTS
${
JULIA_DIR
}
/lib
)
if
(
NOT JULIA_LIB
)
if
(
NOT JULIA_LIB
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment