diff --git a/src/Mod/Create/App/AppCreate.cpp b/src/Mod/Create/App/AppCreate.cpp new file mode 100644 index 0000000000..db2901fb24 --- /dev/null +++ b/src/Mod/Create/App/AppCreate.cpp @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include +#include + + +namespace Create +{ +extern PyObject* initModule(); +} + +/* Python entry */ +PyMOD_INIT_FUNC(CreateApp) +{ + PyObject* mod = Create::initModule(); + Base::Console().log("Loading Create module... done\n"); + + // Future: Create::FeatureFlipPocket::init(); etc. + + PyMOD_Return(mod); +} diff --git a/src/Mod/Create/App/AppCreatePy.cpp b/src/Mod/Create/App/AppCreatePy.cpp new file mode 100644 index 0000000000..5955a10757 --- /dev/null +++ b/src/Mod/Create/App/AppCreatePy.cpp @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include + + +namespace Create +{ +class Module: public Py::ExtensionModule +{ +public: + Module() + : Py::ExtensionModule("CreateApp") + { + initialize("Kindred Create module."); + } +}; + +PyObject* initModule() +{ + return Base::Interpreter().addModule(new Module); +} + +} // namespace Create diff --git a/src/Mod/Create/App/CMakeLists.txt b/src/Mod/Create/App/CMakeLists.txt new file mode 100644 index 0000000000..81891be843 --- /dev/null +++ b/src/Mod/Create/App/CMakeLists.txt @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +set(Create_LIBS + FreeCADApp +) + +SET(Module_SRCS + AppCreate.cpp + AppCreatePy.cpp + PreCompiled.h +) +SOURCE_GROUP("Module" FILES ${Module_SRCS}) + +SET(Create_SRCS + ${Module_SRCS} +) + +add_library(Create SHARED ${Create_SRCS}) +target_include_directories(Create PRIVATE + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR} +) +target_link_libraries(Create ${Create_LIBS}) + +if(FREECAD_USE_PCH) + target_precompile_headers(Create PRIVATE + $<$:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">) +endif() + +SET_BIN_DIR(Create CreateApp /Mod/Create) +SET_PYTHON_PREFIX_SUFFIX(Create) + +INSTALL(TARGETS Create DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Create/App/PreCompiled.h b/src/Mod/Create/App/PreCompiled.h new file mode 100644 index 0000000000..3941db3971 --- /dev/null +++ b/src/Mod/Create/App/PreCompiled.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef CREATE_PRECOMPILED_H +#define CREATE_PRECOMPILED_H + +#include + +#include +#include + +#endif // CREATE_PRECOMPILED_H diff --git a/src/Mod/Create/CMakeLists.txt b/src/Mod/Create/CMakeLists.txt index ab610853cd..f1fcf43771 100644 --- a/src/Mod/Create/CMakeLists.txt +++ b/src/Mod/Create/CMakeLists.txt @@ -1,6 +1,13 @@ # Kindred Create core module # Handles auto-loading of ztools and Silo addons +# C++ module targets +add_subdirectory(App) + +if(BUILD_GUI) + add_subdirectory(Gui) +endif(BUILD_GUI) + # Generate version.py from template with Kindred Create version configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/version.py.in diff --git a/src/Mod/Create/CreateGlobal.h b/src/Mod/Create/CreateGlobal.h new file mode 100644 index 0000000000..3f333477d5 --- /dev/null +++ b/src/Mod/Create/CreateGlobal.h @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include + +#ifndef CREATE_GLOBAL_H +#define CREATE_GLOBAL_H + +// CreateApp +#ifndef CreateExport +# ifdef Create_EXPORTS +# define CreateExport FREECAD_DECL_EXPORT +# else +# define CreateExport FREECAD_DECL_IMPORT +# endif +#endif + +// CreateGui +#ifndef CreateGuiExport +# ifdef CreateGui_EXPORTS +# define CreateGuiExport FREECAD_DECL_EXPORT +# else +# define CreateGuiExport FREECAD_DECL_IMPORT +# endif +#endif + +#endif // CREATE_GLOBAL_H diff --git a/src/Mod/Create/Gui/AppCreateGui.cpp b/src/Mod/Create/Gui/AppCreateGui.cpp new file mode 100644 index 0000000000..3d5939ca53 --- /dev/null +++ b/src/Mod/Create/Gui/AppCreateGui.cpp @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include +#include + + +namespace CreateGui +{ +extern PyObject* initModule(); +} + +/* Python entry */ +PyMOD_INIT_FUNC(CreateGui) +{ + PyObject* mod = CreateGui::initModule(); + Base::Console().log("Loading CreateGui module... done\n"); + + // Future: CreateGui::ViewProviderFlipPocket::init(); etc. + + PyMOD_Return(mod); +} diff --git a/src/Mod/Create/Gui/AppCreateGuiPy.cpp b/src/Mod/Create/Gui/AppCreateGuiPy.cpp new file mode 100644 index 0000000000..825b2b15a5 --- /dev/null +++ b/src/Mod/Create/Gui/AppCreateGuiPy.cpp @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#include + + +namespace CreateGui +{ +class Module: public Py::ExtensionModule +{ +public: + Module() + : Py::ExtensionModule("CreateGui") + { + initialize("Kindred Create GUI module."); + } +}; + +PyObject* initModule() +{ + return Base::Interpreter().addModule(new Module); +} + +} // namespace CreateGui diff --git a/src/Mod/Create/Gui/CMakeLists.txt b/src/Mod/Create/Gui/CMakeLists.txt new file mode 100644 index 0000000000..95945630a8 --- /dev/null +++ b/src/Mod/Create/Gui/CMakeLists.txt @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +set(CreateGui_LIBS + Create + FreeCADGui +) + +SET(Module_SRCS + AppCreateGui.cpp + AppCreateGuiPy.cpp + PreCompiled.h +) +SOURCE_GROUP("Module" FILES ${Module_SRCS}) + +SET(CreateGui_SRCS + ${Module_SRCS} +) + +add_library(CreateGui SHARED ${CreateGui_SRCS}) +target_include_directories(CreateGui PRIVATE + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) +target_link_libraries(CreateGui ${CreateGui_LIBS}) + +if(FREECAD_USE_PCH) + target_precompile_headers(CreateGui PRIVATE + $<$:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">) +endif() + +SET_BIN_DIR(CreateGui CreateGui /Mod/Create) +SET_PYTHON_PREFIX_SUFFIX(CreateGui) + +INSTALL(TARGETS CreateGui DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/Create/Gui/PreCompiled.h b/src/Mod/Create/Gui/PreCompiled.h new file mode 100644 index 0000000000..2d1d818a72 --- /dev/null +++ b/src/Mod/Create/Gui/PreCompiled.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: LGPL-2.1-or-later + +#ifndef CREATEGUI_PRECOMPILED_H +#define CREATEGUI_PRECOMPILED_H + +#include + +#include + +#include + +#endif // CREATEGUI_PRECOMPILED_H