mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +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_MODERN "Compile with OpenGL modern renderer" ON)
|
||||||
option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy 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_UART "Compile with libserialport" ON)
|
||||||
option(WITH_LUA "Compile with lua scripting support" ON)
|
option(WITH_LUA "Compile with lua scripting support" ON)
|
||||||
option(WITH_OPENVR "Compile with OpenVR" ON)
|
option(WITH_OPENVR "Compile with OpenVR" ON)
|
||||||
@@ -89,7 +90,6 @@ set(SOURCES
|
|||||||
"parser.cpp"
|
"parser.cpp"
|
||||||
"nullrenderer.cpp"
|
"nullrenderer.cpp"
|
||||||
"renderer.cpp"
|
"renderer.cpp"
|
||||||
"PyInt.cpp"
|
|
||||||
"ResourceManager.cpp"
|
"ResourceManager.cpp"
|
||||||
"sn_utils.cpp"
|
"sn_utils.cpp"
|
||||||
"Segment.cpp"
|
"Segment.cpp"
|
||||||
@@ -215,6 +215,13 @@ if (WITH_CRASHPAD)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_PYTHON)
|
||||||
|
add_definitions(-DWITH_PYTHON)
|
||||||
|
set(SOURCES ${SOURCES} "PyInt.cpp")
|
||||||
|
else()
|
||||||
|
set(SOURCES ${SOURCES} "PyIntStub.cpp")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_UART)
|
if (WITH_UART)
|
||||||
add_definitions(-DWITH_UART)
|
add_definitions(-DWITH_UART)
|
||||||
set(SOURCES ${SOURCES} "uart.cpp")
|
set(SOURCES ${SOURCES} "uart.cpp")
|
||||||
@@ -402,9 +409,11 @@ endif()
|
|||||||
find_package(glfw3 REQUIRED)
|
find_package(glfw3 REQUIRED)
|
||||||
target_link_libraries(${PROJECT_NAME} glfw)
|
target_link_libraries(${PROJECT_NAME} glfw)
|
||||||
|
|
||||||
find_package(PythonLibs 2 REQUIRED)
|
if (WITH_PYTHON)
|
||||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
find_package(PythonLibs 2 REQUIRED)
|
||||||
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
find_package(PNG 1.6 REQUIRED)
|
find_package(PNG 1.6 REQUIRED)
|
||||||
|
|||||||
@@ -998,6 +998,10 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
if (iPause)
|
if (iPause)
|
||||||
iTextMode = GLFW_KEY_F1; // jak pauza, to pokazać zegar
|
iTextMode = GLFW_KEY_F1; // jak pauza, to pokazać zegar
|
||||||
|
|
||||||
|
#ifndef WITH_PYTHON
|
||||||
|
python_enabled = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Console::ModeSet(iFeedbackMode, iFeedbackPort); // tryb pracy konsoli sterowniczej
|
Console::ModeSet(iFeedbackMode, iFeedbackPort); // tryb pracy konsoli sterowniczej
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
5
PyInt.h
5
PyInt.h
@@ -27,6 +27,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#pragma GCC diagnostic ignored "-Wregister"
|
#pragma GCC diagnostic ignored "-Wregister"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#undef _DEBUG // bez tego macra Py_DECREF powoduja problemy przy linkowaniu
|
#undef _DEBUG // bez tego macra Py_DECREF powoduja problemy przy linkowaniu
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
@@ -34,6 +35,10 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#else
|
#else
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#define PyObject void
|
||||||
|
#define PyThreadState void
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#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