Skip to content

Commit 9a14b5c

Browse files
author
Dilawar Singh
committed
Minor tweaks...
1 parent 9f475b3 commit 9a14b5c

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
22

3-
project(PyMOOSE DESCRIPTION "MOOSE Python Module")
3+
# Project to build MOOSE's python module.
4+
project(PyMOOSE)
45

56
# cmake related macros.
67
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

CheckCXXCompiler.cmake

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ endif()
44

55
########################### COMPILER MACROS #####################################
66
include(CheckCXXCompilerFlag)
7-
CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 )
8-
CHECK_CXX_COMPILER_FLAG( "-std=c++0x" COMPILER_SUPPORTS_CXX0X )
9-
CHECK_CXX_COMPILER_FLAG( "-Wno-strict-aliasing" COMPILER_WARNS_STRICT_ALIASING )
7+
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11 )
8+
CHECK_CXX_COMPILER_FLAG("-Wno-strict-aliasing" COMPILER_WARNS_STRICT_ALIASING )
109

1110
# Turn warning to error: Not all of the options may be supported on all
1211
# versions of compilers. be careful here.
@@ -22,7 +21,6 @@ elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR ("${CMAKE_CXX_COMPI
2221
add_definitions( -Wno-unused-local-typedef )
2322
endif()
2423

25-
2624
add_definitions(-fPIC)
2725
if(COMPILER_WARNS_STRICT_ALIASING)
2826
add_definitions( -Wno-strict-aliasing )
@@ -45,11 +43,9 @@ if(COMPILER_SUPPORTS_CXX11)
4543
add_definitions( -mllvm -inline-threshold=1000 )
4644
endif(APPLE)
4745
else(COMPILER_SUPPORTS_CXX11)
48-
add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS -DBOOST_NO_SCOPED_ENUMS )
49-
message(FATAL_ERROR "\
50-
The compiler ${CMAKE_CXX_COMPILER} is too old. \
51-
Please use a compiler which has c++11 support.
52-
")
46+
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} is too old. \n"
47+
"Please use a compiler which has c++11 support."
48+
)
5349
endif(COMPILER_SUPPORTS_CXX11)
5450

5551
set(COMPILER_IS_TESTED ON)

pymoose/CMakeLists.txt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,7 @@ add_definitions(-std=c++11)
1818
add_definitions(-DUSE_NUMPY)
1919
add_definitions(-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
2020

21-
# set module extensiton. default is .so. Also check ../python/setup.cmake.py
22-
execute_process(COMMAND
23-
${PYTHON_EXECUTABLE} -c
24-
"import importlib.machinery
25-
print(importlib.machinery.EXTENSION_SUFFIXES[-1])"
26-
OUTPUT_VARIABLE PYTHON_SO_EXTENSION
27-
OUTPUT_STRIP_TRAILING_WHITESPACE)
28-
if(NOT PYTHON_SO_EXTENSION)
29-
message(STATUS "Python so ext could not be determined. Using default .so")
30-
set(PYTHON_SO_EXTENSION ".so")
31-
endif()
21+
set(PYTHON_SO_EXTENSION ".so")
3222
message(STATUS "Python so extension ${PYTHON_SO_EXTENSION}" )
3323

3424
# TARGET
@@ -124,6 +114,7 @@ set(_platform "CMAKE")
124114
set(PYMOOSE_BDIST_FILE ${CMAKE_BINARY_DIR}/pymoose-${VERSION_MOOSE}.${_platform}.tar.gz)
125115
set(PYMOOSE_INSTALL_DIR ${CMAKE_BINARY_DIR}/_pymoose_temp_install)
126116
file(MAKE_DIRECTORY ${PYMOOSE_INSTALL_DIR})
117+
127118
add_custom_command(TARGET _moose POST_BUILD
128119
COMMAND ${PYTHON_EXECUTABLE} setup.py build_py
129120
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_dumb --skip-build
@@ -132,6 +123,14 @@ add_custom_command(TARGET _moose POST_BUILD
132123
COMMENT "python's binary distribution is saved to ${CMAKE_BINARY_DIR}"
133124
VERBATIM)
134125

126+
# Copy python tree to BUILD directory. User can set PYTHONPATH to
127+
# ${CMAKE_BINARY_DIR}/python.
128+
add_custom_target(copy_python_tree ALL
129+
COMMAND ${CMAKE_COMMAND} -E copy_directory
130+
${CMAKE_SOURCE_DIR}/python ${CMAKE_BINARY_DIR}/python
131+
DEPENDS _moose)
132+
133+
135134
install(CODE "execute_process(
136135
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_INSTALL_PREFIX} tar xf ${PYMOOSE_BDIST_FILE}
137136
)"

0 commit comments

Comments
 (0)