Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ControlSystemAdapter-DoocsAdapter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ControlSystemAdapter-DoocsAdapter
Commits
9b7c9552
Commit
9b7c9552
authored
5 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
added FindMako (to find the python mako module)
parent
c2027f8f
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
cmake/FindMako.cmake
+84
-0
84 additions, 0 deletions
cmake/FindMako.cmake
with
84 additions
and
0 deletions
cmake/FindMako.cmake
0 → 100644
+
84
−
0
View file @
9b7c9552
# First check for python executable
if
(
NOT PYTHON_EXECUTABLE
)
find_program
(
PYTHON_EXECUTABLE python
)
if
(
NOT PYTHON_EXECUTABLE
)
message
(
FATAL_ERROR
"Please check for python before searching for mako"
)
endif
()
endif
()
# If mako was installed by this process previously, check that it is still there
if
(
MAKO_EXTERNAL_INSTALL
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
"-c
\"
import mako
\"
"
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
/external/python
ERROR_VARIABLE DUMMY
OUTPUT_VARIABLE DUMMY
RESULT_VARIABLE MAKO_STILL_THERE
)
if
(
MAKO_STILL_THERE
)
return
()
endif
()
endif
()
# If mako is not found ...
if
(
NOT FOUND_MAKO
)
# Then look for it by importing it
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import mako"
ERROR_VARIABLE DUMMY
OUTPUT_VARIABLE DUMMY
RESULT_VARIABLE FOUND_MAKO
)
if
(
FOUND_MAKO EQUAL 0
)
message
(
STATUS
"[Mako] Found"
)
set
(
FOUND_MAKO TRUE CACHE INTERNAL
"Found mako python package"
)
set
(
MAKO_EXTERNAL_INSTALL FALSE CACHE INTERNAL
"Manual install of mako"
)
return
()
endif
()
else
()
# If mako already found then continue
# We have checked that it was still there, if we installed it
return
()
endif
()
message
(
STATUS
"[Mako] Not found"
)
# Now try and install mako using pip
if
(
NOT PIP_EXECUTABLE
)
find_program
(
PIP_EXECUTABLE pip
)
endif
()
if
(
NOT PIP_EXECUTABLE
)
message
(
FATAL_ERROR
"cannot install package without pip"
)
else
()
message
(
STATUS
"[pip] found:
${
PIP_EXECUTABLE
}
"
)
endif
()
# We install it in the build directory
execute_process
(
COMMAND
${
PIP_EXECUTABLE
}
install mako
--install-option=--install-purelib=
${
PROJECT_BINARY_DIR
}
/external/python
--install-option=--install-scripts=
${
PROJECT_BINARY_DIR
}
/external/python
--install-option=--prefix=
${
PROJECT_BINARY_DIR
}
/external/python
OUTPUT_VARIABLE PIP_OUTPUT
ERROR_VARIABLE PIP_ERROR
RESULT_VARIABLE PIP_INSTALLATION_WORKED
)
if
(
NOT PIP_INSTALLATION_WORKED EQUAL 0
)
message
(
STATUS
"
${
PIP_OUTPUT
}
"
)
message
(
STATUS
"
${
PIP_ERROR
}
"
)
message
(
FATAL_ERROR
"Could not install mako. Please see error message above"
)
else
()
message
(
STATUS
"[Mako] installed in
${
PROJECT_BINARY_DIR
}
/external/python"
)
endif
()
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
-c
"import mako"
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
/external/python
ERROR_VARIABLE DUMMY
OUTPUT_VARIABLE DUMMY
RESULT_VARIABLE FOUND_MAKO
)
if
(
FOUND_MAKO EQUAL 0
)
message
(
STATUS
"[Mako] now available in build directory"
)
set
(
FOUND_MAKO TRUE CACHE INTERNAL
"Found mako python package"
)
set
(
MAKO_EXTERNAL_INSTALL TRUE CACHE INTERNAL
"Manual install of mako"
)
return
()
else
()
message
(
FATAL_ERROR
"Could not install mako"
)
endif
()
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