mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
WITH_PYTHON build option
This commit is contained in:
@@ -47,6 +47,7 @@ endif()
|
||||
|
||||
option(WITH_OPENGL_MODERN "Compile with OpenGL modern renderer" ON)
|
||||
option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON)
|
||||
option(WITH_PYTHON "Compile with python2" ON)
|
||||
option(WITH_UART "Compile with libserialport" ON)
|
||||
option(WITH_LUA "Compile with lua scripting support" ON)
|
||||
option(WITH_OPENVR "Compile with OpenVR" ON)
|
||||
@@ -89,7 +90,6 @@ set(SOURCES
|
||||
"parser.cpp"
|
||||
"nullrenderer.cpp"
|
||||
"renderer.cpp"
|
||||
"PyInt.cpp"
|
||||
"ResourceManager.cpp"
|
||||
"sn_utils.cpp"
|
||||
"Segment.cpp"
|
||||
@@ -215,6 +215,13 @@ if (WITH_CRASHPAD)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_PYTHON)
|
||||
add_definitions(-DWITH_PYTHON)
|
||||
set(SOURCES ${SOURCES} "PyInt.cpp")
|
||||
else()
|
||||
set(SOURCES ${SOURCES} "PyIntStub.cpp")
|
||||
endif()
|
||||
|
||||
if (WITH_UART)
|
||||
add_definitions(-DWITH_UART)
|
||||
set(SOURCES ${SOURCES} "uart.cpp")
|
||||
@@ -402,9 +409,11 @@ endif()
|
||||
find_package(glfw3 REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} glfw)
|
||||
|
||||
find_package(PythonLibs 2 REQUIRED)
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
|
||||
if (WITH_PYTHON)
|
||||
find_package(PythonLibs 2 REQUIRED)
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(PNG 1.6 REQUIRED)
|
||||
|
||||
@@ -998,6 +998,10 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
if (iPause)
|
||||
iTextMode = GLFW_KEY_F1; // jak pauza, to pokazać zegar
|
||||
|
||||
#ifndef WITH_PYTHON
|
||||
python_enabled = false;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
Console::ModeSet(iFeedbackMode, iFeedbackPort); // tryb pracy konsoli sterowniczej
|
||||
#endif
|
||||
|
||||
5
PyInt.h
5
PyInt.h
@@ -27,6 +27,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma GCC diagnostic ignored "-Wregister"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
#ifdef _DEBUG
|
||||
#undef _DEBUG // bez tego macra Py_DECREF powoduja problemy przy linkowaniu
|
||||
#include "Python.h"
|
||||
@@ -34,6 +35,10 @@ http://mozilla.org/MPL/2.0/.
|
||||
#else
|
||||
#include "Python.h"
|
||||
#endif
|
||||
#else
|
||||
#define PyObject void
|
||||
#define PyThreadState void
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
42
PyIntStub.cpp
Normal file
42
PyIntStub.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "PyInt.h"
|
||||
|
||||
bool python_taskqueue::init()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void python_taskqueue::exit()
|
||||
{
|
||||
}
|
||||
|
||||
bool python_taskqueue::insert(python_taskqueue::task_request const &Task)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool python_taskqueue::run_file(std::string const &File, std::string const &Path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void python_taskqueue::acquire_lock()
|
||||
{
|
||||
}
|
||||
|
||||
void python_taskqueue::release_lock()
|
||||
{
|
||||
}
|
||||
|
||||
void python_taskqueue::update()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user