Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moose
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sahil Moza
moose
Commits
bac0758f
Commit
bac0758f
authored
7 years ago
by
Dilawar Singh
Browse files
Options
Downloads
Plain Diff
Merge commit '
5dd6acfa
' into chamcham
parents
584bdafa
5dd6acfa
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
moose-core/CMakeLists.txt
+28
-7
28 additions, 7 deletions
moose-core/CMakeLists.txt
moose-core/pymoose/CMakeLists.txt
+8
-21
8 additions, 21 deletions
moose-core/pymoose/CMakeLists.txt
moose-core/python/setup.cmake.py
+34
-40
34 additions, 40 deletions
moose-core/python/setup.cmake.py
with
70 additions
and
68 deletions
moose-core/CMakeLists.txt
+
28
−
7
View file @
bac0758f
set
(
CMAKE_LEGACY_CYGWIN_WIN32 0
)
cmake_minimum_required
(
VERSION 2.8 FATAL_ERROR
)
project
(
pymoose
)
if
(
COMMAND cmake_policy
)
...
...
@@ -21,24 +22,29 @@ include(FindPkgConfig)
# getgit revision number
find_program
(
GIT_EXEC git
)
if
(
GIT_EXEC
)
execute_process
(
COMMAND
${
GIT_EXEC
}
rev-parse --short HEAD
execute_process
(
COMMAND
${
GIT_EXEC
}
rev-parse --short HEAD
OUTPUT_VARIABLE GIT_HEAD
OUTPUT_STRIP_TRAILING_WHITESPACE
)
)
else
(
GIT_EXEC
)
set
(
GIT_HEAD 'HEAD'
)
message
(
STATUS
"Couldn't fetch version from git repo"
)
endif
()
# If from command line, version info is not passed, use the git to generate a
# version file. If GIT fails, use the previous known version.
if
(
NOT VERSION_MOOSE
)
set
(
VERSION_MOOSE
"3.1.3-
${
GIT_HEAD
}
"
)
endif
(
)
endif
()
add_definitions
(
-DMOOSE_VERSION=
"
${
VERSION_MOOSE
}
"
)
message
(
STATUS
"MOOSE Version
${
VERSION_MOOSE
}
"
)
# Write VERSION to a file VERSION so that setup.cmake.py can use it.
set
(
VERSION_FILE
${
CMAKE_CURRENT_SOURCE_DIR
}
/python/VERSION
)
message
(
STATUS
"+ Writing
${
VERSION_MOOSE
}
to
${
VERSION_FILE
}
"
)
file
(
WRITE
${
VERSION_FILE
}
${
VERSION_MOOSE
}
)
message
(
STATUS
"| Writing
${
VERSION_MOOSE
}
to
${
VERSION_FILE
}
"
)
# This snippet is from LLVM project.
# Sanity check our source directory to make sure that we are not trying to
...
...
@@ -418,8 +424,11 @@ set(_platform "CMAKE" )
set
(
PYMOOSE_BDIST_FILE
${
PYMOOSE_BDIST_DIR
}
/pymoose-
${
VERSION_MOOSE
}
.
${
_platform
}
.tar.gz
)
message
(
STATUS
"binary distribution file
${
PYMOOSE_BDIST_FILE
}
"
)
add_custom_target
(
bdist ALL DEPENDS
${
PYMOOSE_BDIST_FILE
}
)
# Any command using setup.cmake.py must run in the same directory.
add_custom_command
(
OUTPUT
${
PYMOOSE_BDIST_FILE
}
COMMAND
${
PYTHON_EXECUTABLE
}
setup.cmake.py bdist -p
${
_platform
}
-d
${
PYMOOSE_BDIST_DIR
}
COMMAND
${
PYTHON_EXECUTABLE
}
setup.cmake.py bdist_dumb -p
${
_platform
}
-d
${
PYMOOSE_BDIST_DIR
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/python
COMMENT
"bdist is saved to
${
PYMOOSE_BDIST_DIR
}
"
VERBATIM
...
...
@@ -429,7 +438,19 @@ add_custom_command(TARGET bdist POST_BUILD
COMMENT
"Unarchiving bdist file
${
PYMOOSE_BDIST_FILE
}
to
${
PYMOOSE_BDIST_INSTALL_DIR
}
"
VERBATIM
)
add_dependencies
(
bdist _moose
)
# Copy python files from source to current binary directory. Make sure to call
# this before building bdist.
file
(
GLOB_RECURSE PYTHON_SRCS
"
${
CMAKE_SOURCE_DIR
}
/python/*"
)
add_custom_target
(
copy_pymoose DEPENDS
${
PYTHON_SRCS
}
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
CMAKE_CURRENT_SOURCE_DIR
}
/python
${
CMAKE_CURRENT_BINARY_DIR
}
/python
COMMENT
"Copying required python files and other files to build directory"
VERBATIM
)
add_dependencies
(
bdist copy_pymoose
)
add_dependencies
(
copy_pymoose _moose
)
######################### INSTALL ##############################################
...
...
@@ -486,7 +507,7 @@ foreach( _test_script ${PY_TEST_SCRIPTS} )
WORKING_DIRECTORY
${
PYMOOSE_TEST_DIRECTORY
}
)
set_tests_properties
(
${
_test_name
}
PROPERTIES ENVIRONMENT
"PYTHONPATH=
${
PROJEC
T_BINARY_DIR
}
/python"
PROPERTIES ENVIRONMENT
"PYTHONPATH=
${
CMAKE_CURREN
T_BINARY_DIR
}
/python"
)
endforeach
(
)
...
...
This diff is collapsed.
Click to expand it.
moose-core/pymoose/CMakeLists.txt
+
8
−
21
View file @
bac0758f
...
...
@@ -49,7 +49,7 @@ set_target_properties(_moose PROPERTIES
COMPILE_FLAGS
"
${
PYTHON_INCLUDE_FLAGS
}
"
LIBRARY_OUTPUT_DIRECTORY
${
PYMOOSE_OUTPUT_DIRECTORY
}
PREFIX
""
SUFFIX
".so"
SUFFIX
${
PYTHON_SO_EXTENSION
}
)
if
(
NOT
(
PYTHON_SO_EXTENSION STREQUAL
""
))
...
...
@@ -77,7 +77,7 @@ if(MACOSX)
target_link_libraries
(
_moose
${
SYSTEM_SHARED_LIBS
}
)
ELSE
(
MACOSX
)
else
(
MACOSX
)
target_link_libraries
(
_moose
"-Wl,--whole-archive"
${
MOOSE_LIBRARIES
}
...
...
@@ -87,25 +87,12 @@ ELSE(MACOSX)
${
SYSTEM_SHARED_LIBS
}
)
endif
(
MACOSX
)
# Make this target dependant on all python files in python folder.
add_custom_target
(
copy_python_files
COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
CMAKE_SOURCE_DIR
}
/python
${
CMAKE_BINARY_DIR
}
/python
COMMENT
"Copying required python files and other files to build directory"
VERBATIM
)
add_dependencies
(
_moose copy_python_files
)
# Print message at the end of build process.
add_custom_command
(
TARGET _moose POST_BUILD
add_custom_command
(
TARGET _moose POST_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E cmake_echo_color --cyan
"MOOSE python extention is successfully built. Now "
" 1. Run 'make install' to install it for single user. "
" 2. Run 'sudo make install' to install it system-wide. "
" "
"NOTE: Run 'pip uninstall moose' to uninstall moose."
"MOOSE python extention is successfully built. Now "
" Run 'sudo make install' to install it. "
" "
"NOTE: Run 'pip uninstall moose' to uninstall moose."
VERBATIM
)
This diff is collapsed.
Click to expand it.
moose-core/python/setup.cmake.py
+
34
−
40
View file @
bac0758f
# -*- coding: utf-8 -*-
from
__future__
import
print_function
"""
setup.py:
Script to install python targets.
NOTE: This script is to be called by CMake. Not intended to be used standalone.
"""
# NOTE: This script is to be called by CMake. Not intended to be used standalone.
__author__
=
"
Dilawar Singh
"
__copyright__
=
"
Copyright 2013, Dilawar Singh and NCBS Bangalore
"
...
...
@@ -19,47 +15,45 @@ __status__ = "Development"
import
os
import
sys
try
:
from
setuptools
import
setup
except
Exception
as
e
:
from
distutils.core
import
setup
# NOTE: Though setuptool is preferred we use distutils.
# 1. setuptool normalize VERSION even when it is compatible with PyPI
# guidelines. This caused havoc on our OBS build.
from
distutils.core
import
setup
script_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)
)
version
=
'
3.1.3
'
try
:
with
open
(
os
.
path
.
join
(
script_dir
,
'
VERSION
'
),
'
r
'
)
as
f
:
version
=
f
.
read
(
)
except
Exception
as
e
:
print
(
'
Failed to read VERSION %s
'
%
e
)
print
(
'
Using default %s
'
%
version
)
# Version file must be available. It MUST be written by cmake. Or create
# manually.
with
open
(
os
.
path
.
join
(
script_dir
,
'
VERSION
'
),
'
r
'
)
as
f
:
version
=
f
.
read
(
)
print
(
'
Got %s from VERSION file
'
%
version
)
# importlib is available only for python3.
suffix
=
'
.so
'
try
:
import
importlib.machinery
suffix
=
importlib
.
machinery
.
EXTENSION_SUFFIXES
[
-
1
]
except
ImportError
as
e
:
pass
suffix
=
importlib
.
machinery
.
EXTENSION_SUFFIXES
[
0
].
split
(
'
.
'
)[
-
1
]
except
Exception
as
e
:
print
(
'
[WARN] Failed to determine importlib suffix
'
)
suffix
=
'
.so
'
setup
(
name
=
'
pymoose
'
,
version
=
version
,
description
=
'
Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)
'
,
author
=
'
MOOSERes
'
,
author_email
=
'
bhalla@ncbs.res.in
'
,
maintainer
=
'
Dilawar Singh
'
,
maintainer_email
=
'
dilawars@ncbs.res.in
'
,
url
=
'
http://moose.ncbs.res.in
'
,
packages
=
[
'
rdesigneur
'
,
'
moose
'
,
'
moose.SBML
'
,
'
moose.neuroml
'
,
'
moose.genesis
'
,
'
moose.chemUtil
'
],
install_requires
=
[
'
python-libsbml
'
,
'
numpy
'
],
package_dir
=
{
'
moose
'
:
'
moose
'
,
'
rdesigneur
'
:
'
rdesigneur
'
},
package_data
=
{
'
moose
'
:
[
'
_moose%s
'
%
suffix
]
},
)
name
=
'
pymoose
'
,
version
=
version
,
description
=
'
Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)
'
,
author
=
'
MOOSERes
'
,
author_email
=
'
bhalla@ncbs.res.in
'
,
maintainer
=
'
Dilawar Singh
'
,
maintainer_email
=
'
dilawars@ncbs.res.in
'
,
url
=
'
http://moose.ncbs.res.in
'
,
packages
=
[
'
rdesigneur
'
,
'
moose
'
,
'
moose.SBML
'
,
'
moose.genesis
'
,
'
moose.neuroml
'
,
'
moose.neuroml2
'
,
'
moose.chemUtil
'
],
install_requires
=
[
'
python-libsbml
'
,
'
numpy
'
],
package_dir
=
{
'
moose
'
:
'
moose
'
,
'
rdesigneur
'
:
'
rdesigneur
'
},
package_data
=
{
'
moose
'
:
[
'
_moose
'
+
suffix
]
},
)
This diff is collapsed.
Click to expand it.
Preview
0%
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