Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ include(buildpresets.cmake)
# include Modules
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")

# include pythonAux Macros
include(${PROJECT_SOURCE_DIR}/cmake/pythonAux.cmake)

#check compiller
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -89,32 +92,6 @@ macro(list_subdirectories2 retval curdir return_relative)
set(${retval} ${list_of_dirs})
endmacro()

#macro to switch pythonInterp
macro(usePython ver)
if (${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
set(PYTHON_EXECUTABLE ${PYTHON2_EXECUTABLE})
set(PYTHON_VERSION_STRING ${PYTHON2_VERSION_STRING})
set(PYTHON_VERSION_MAJOR ${PYTHON2_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON2_VERSION_MINOR})
set(PYTHON_VERSION_PATCH ${PYTHON2_VERSION_PATCH})
set(PYTHONINTERP_FOUND TRUE)
elseif(${ver} EQUAL 3 AND ${PYTHON3INTERP_FOUND})
set(PYTHON_EXECUTABLE ${PYTHON3_EXECUTABLE})
set(PYTHON_VERSION_STRING ${PYTHON3_VERSION_STRING})
set(PYTHON_VERSION_MAJOR ${PYTHON3_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${PYTHON3_VERSION_MINOR})
set(PYTHON_VERSION_PATCH ${PYTHON3_VERSION_PATCH})
set(PYTHONINTERP_FOUND TRUE)
else(${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
unset(PYTHON_EXECUTABLE)
unset(PYTHON_VERSION_STRING)
unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR)
unset(PYTHON_VERSION_PATCH)
set(PYTHONINTERP_FOUND FALSE)
endif(${ver} EQUAL 2 AND ${PYTHON2INTERP_FOUND})
endmacro()



###################
Expand Down
26 changes: 0 additions & 26 deletions Deps/findPythonModules/CMakeLists.txt

This file was deleted.

16 changes: 2 additions & 14 deletions Deps/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
find_package(Python3Interp)
find_package(Python2Interp)

usePython(3)
message(${PYTHON3_MODULE_PATH})

execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import os;print(os.path.dirname(os.__file__))"
RESULT_VARIABLE _RESULT
OUTPUT_VARIABLE PYTHON_MODULE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(_RESULT)
message(FATAL_ERROR "Failed to determine python information")
endif(_RESULT)
unset(_RESULT)

message(${PYTHON_MODULE_PATH})
message(${PYTHON2_MODULE_PATH})
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
set(module "Ice")

usePython(2)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set(module "matplotlib")

usePython(2)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)

if(PY_${module_upper})
SET (MATPLOTLIB_PY_MODULES PY_${module_upper})
list(APPEND DEPS python3-matplotlib)
list(APPEND DEPS_DEV python3-matplotlib)
list(APPEND DEPS python-matplotlib)
list(APPEND DEPS_DEV python-matplotlib python3-matplotlib)
endif(PY_${module_upper})
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

set(module "numpy")

usePython(2)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)

if(PY_${module_upper})
SET (NUMPY_MODULES PY_${module_upper})
list(APPEND DEPS "python3-numpy")
list(APPEND DEPS_DEV "python3-numpy")
list(APPEND DEPS python-numpy)
list(APPEND DEPS_DEV python-numpy python3-numpy)
endif(PY_${module_upper})
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set(module "cv2")

usePython(2)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)

if(PY_${module_upper})
SET (OpenCV_PY_MODULES PY_${module_upper})
list(APPEND DEPS "opencv-python")
list(APPEND DEPS_DEV "opencv-python")
list(APPEND DEPS opencv-python)
list(APPEND DEPS_DEV opencv-python)
endif(PY_${module_upper})
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set(module "pip")

usePython(3)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)

if(PY_${module_upper})
SET (OpenCV_PY_MODULES PY_${module_upper})
list(APPEND DEPS "python3-pip")
list(APPEND DEPS_DEV "python3-pip")
list(APPEND DEPS python-pip)
list(APPEND DEPS_DEV python-pip python3-pip)
endif(PY_${module_upper})
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

set(module "PyQt5")

usePython(2)
find_python_module(${module} REQUIRED)

string(TOUPPER ${module} module_upper)

if(PY_${module_upper})
SET (QT5_PY_MODULES PY_${module_upper})
list(APPEND DEPS python3-pyqt5 python3-pyqt5.qtsvg)
list(APPEND DEPS_DEV python3-pyqt5 python3-pyqt5.qtsvg)
list(APPEND DEPS python-pyqt5 python-pyqt5.qtsvg)
list(APPEND DEPS_DEV python-pyqt5 python-pyqt5.qtsvg python3-pyqt5 python3-pyqt5.qtsvg)
endif(PY_${module_upper})
19 changes: 16 additions & 3 deletions cmake/modules/FindPython2Interp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# PYTHON2_VERSION_PATCH - Python patch version found e.g. 2
#
# Nuke the cache, somebody might have looked for Python 2...
# copy from: https://gitlab.dune-project.org/quality/dune-python/blob/694ae69fe57de42b1a87373ed9eea8d76a1ebfd3/cmake/modules/FindPython2Interp.cmake
# copied from: https://gitlab.dune-project.org/quality/dune-python/blob/694ae69fe57de42b1a87373ed9eea8d76a1ebfd3/cmake/modules/FindPython2Interp.cmake
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
find_package(PythonInterp 2)
find_package(PythonInterp 2 REQUIRED)
find_package_handle_standard_args(Python2Interp
REQUIRED_VARS PYTHONINTERP_FOUND)
# Set all those variables that we promised
Expand All @@ -35,4 +35,17 @@ set(PYTHON2_VERSION_PATCH ${PYTHON_VERSION_PATCH})
# Now nuke the cache to allow later rerunning of find_package(PythonInterp)
# with a different required version number.
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
set(PYTHONINTERP_FOUND FALSE)

#Searching module path of python2
execute_process(
COMMAND ${PYTHON2_EXECUTABLE} -c "import os;print(os.path.dirname(os.__file__))"
RESULT_VARIABLE _RESULT
OUTPUT_VARIABLE PYTHON2_MODULE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(_RESULT)
message(FATAL_ERROR "Failed to determine python information")
endif(_RESULT)
unset(_RESULT)
18 changes: 16 additions & 2 deletions cmake/modules/FindPython3Interp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
find_package(PythonInterp 3)
find_package(PythonInterp 3 REQUIRED)
find_package_handle_standard_args(Python3Interp
REQUIRED_VARS PYTHONINTERP_FOUND)
# Set all those variables that we promised
Expand All @@ -37,4 +37,18 @@ set(PYTHON3_VERSION_PATCH ${PYTHON_VERSION_PATCH})
# Now nuke the cache to allow later rerunning of find_package(PythonInterp)
# with a different required version number.
unset(PYTHON_EXECUTABLE CACHE)
set(PYTHONINTERP_FOUND FALSE)
set(PYTHONINTERP_FOUND FALSE)


#Searching module path of python3
execute_process(
COMMAND ${PYTHON3_EXECUTABLE} -c "import os;print(os.path.dirname(os.__file__))"
RESULT_VARIABLE _RESULT
OUTPUT_VARIABLE PYTHON3_MODULE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(_RESULT)
message(FATAL_ERROR "Failed to determine python information")
endif(_RESULT)
unset(_RESULT)
26 changes: 3 additions & 23 deletions src/libs/easyiceconfig_py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
cmake_minimum_required(VERSION 2.8)

configure_file(
easyiceconfig/hardcodedpaths.py.in
easyiceconfig/hardcodedpaths.py
@ONLY
)

file(GLOB ModuleFiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig
${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig/*)

string(REGEX REPLACE "[^;]+\\.in;?" "" ModuleFiles "${ModuleFiles}")

configure_module_python(easyiceconfig)

add_custom_target(easyiceconfig_py ALL)
foreach(ModuleFile ${ModuleFiles})
add_custom_command(TARGET easyiceconfig_py
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/easyiceconfig/${ModuleFile} ${CMAKE_CURRENT_BINARY_DIR}/easyiceconfig/${ModuleFile}
)
endforeach(ModuleFile ${ModuleFiles})
copy_to_binary_python(easyiceconfig_py easyiceconfig)

### Install
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/easyiceconfig
DESTINATION ${PYTHON_MODULE_PATH}
COMPONENT core
)
install_python(easyiceconfig core)
2 changes: 1 addition & 1 deletion src/libs/easyiceconfig_py/easyiceconfig/easyiceconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import re
import Ice

from easyiceconfig.hardcodedpaths import HARDCODED_PATHS
from .hardcodedpaths import HARDCODED_PATHS


ENV_PATH_NAME = "ICE_CONFIG_PATH"
Expand Down
11 changes: 4 additions & 7 deletions src/libs/parallelIce_py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
cmake_minimum_required(VERSION 2.8)

### Install
configure_module_python(parallelIce)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/parallelIce
add_custom_target(parallelIce_py ALL)
copy_to_binary_python(parallelIce_py parallelIce)

DESTINATION ${PYTHON_MODULE_PATH}

COMPONENT core

)
install_python(parallelIce core)