Skip to content

Commit 374bf50

Browse files
author
Dilawar Singh
committed
This seems to work just fine.
1 parent 4746ec4 commit 374bf50

19 files changed

+67
-38
lines changed

CMakeLists.txt

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
22
project(MOOSE)
33

4-
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
4+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
55
include(CheckCXXCompiler.cmake)
66
include(CheckIncludeFileCXX)
7+
include(FindPythonModule)
78

8-
# getgit revision number
9-
find_program( GIT_EXEC git )
10-
if(GIT_EXEC)
11-
execute_process(
12-
COMMAND ${GIT_EXEC} rev-parse --short HEAD
13-
OUTPUT_VARIABLE GIT_HEAD
14-
OUTPUT_STRIP_TRAILING_WHITESPACE
15-
)
16-
else(GIT_EXEC)
17-
set(GIT_HEAD 'HEAD')
18-
message(STATUS "Couldn't fetch version from git repo" )
19-
endif()
209

10+
string(TIMESTAMP STAMP "%Y%m%d")
2111
# If from command line, version info is not passed, use the git to generate a
2212
# version file. If GIT fails, use the previous known version.
2313
if(NOT VERSION_MOOSE)
24-
set(VERSION_MOOSE "3.2.0-${GIT_HEAD}")
14+
set(VERSION_MOOSE "3.2.dev${STAMP}")
2515
endif()
2616

2717
add_definitions( -DMOOSE_VERSION="${VERSION_MOOSE}")
@@ -376,9 +366,8 @@ endif()
376366
install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
377367
install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)
378368

379-
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py install --skip-build
380-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})"
381-
CONFIGURATION Debug Release)
369+
# NOTE: Install macro for _moose (pymoose) has been moved to
370+
# pymoose/CMakeLists.txt file.
382371

383372
# Print message to start build process
384373
if(${CMAKE_BUILD_TOOL} MATCHES "make")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cmake/FindPythonModule.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This is from https://cmake.org/pipermail/cmake/2011-January/041666.html
2+
function(find_python_module module)
3+
string(TOUPPER ${module} module_upper)
4+
if(NOT PY_${module_upper})
5+
if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
6+
set(${module}_FIND_REQUIRED TRUE)
7+
endif()
8+
# A module's location is usually a directory, but for binary modules
9+
# it's a .so file.
10+
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
11+
"import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)"
12+
RESULT_VARIABLE _${module}_status
13+
OUTPUT_VARIABLE _${module}_location
14+
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
15+
if(NOT _${module}_status)
16+
set(PY_${module_upper} ${_${module}_location} CACHE STRING
17+
"Location of Python module ${module}")
18+
endif(NOT _${module}_status)
19+
endif(NOT PY_${module_upper})
20+
find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper})
21+
endfunction(find_python_module)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)