feat(create): add C++ module scaffold with App/ and Gui/ targets (#251)
Some checks failed
Build and Test / build (pull_request) Failing after 2m2s

Establish build infrastructure for Kindred-specific C++ features:

- CreateGlobal.h: export macros (CreateExport, CreateGuiExport)
- App/: CreateApp shared library (PyMOD_INIT_FUNC, Py::ExtensionModule)
- Gui/: CreateGui shared library (links CreateApp + FreeCADGui)
- CMakeLists.txt: add_subdirectory(App) + conditional add_subdirectory(Gui)

Scaffold only — no features. Follows the Assembly module pattern.
Existing Python Init.py/InitGui.py bootstrap unchanged.
This commit is contained in:
2026-02-17 11:50:44 -06:00
parent 6c11d64c5f
commit 5d8a253956
10 changed files with 213 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
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);
}

View File

@@ -0,0 +1,23 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <Base/Interpreter.h>
namespace Create
{
class Module: public Py::ExtensionModule<Module>
{
public:
Module()
: Py::ExtensionModule<Module>("CreateApp")
{
initialize("Kindred Create module.");
}
};
PyObject* initModule()
{
return Base::Interpreter().addModule(new Module);
}
} // namespace Create

View File

@@ -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
$<$<COMPILE_LANGUAGE:CXX>:"${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})

View File

@@ -0,0 +1,11 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef CREATE_PRECOMPILED_H
#define CREATE_PRECOMPILED_H
#include <FCConfig.h>
#include <string>
#include <vector>
#endif // CREATE_PRECOMPILED_H

View File

@@ -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

View File

@@ -0,0 +1,26 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <FCGlobal.h>
#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

View File

@@ -0,0 +1,21 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
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);
}

View File

@@ -0,0 +1,23 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <Base/Interpreter.h>
namespace CreateGui
{
class Module: public Py::ExtensionModule<Module>
{
public:
Module()
: Py::ExtensionModule<Module>("CreateGui")
{
initialize("Kindred Create GUI module.");
}
};
PyObject* initModule()
{
return Base::Interpreter().addModule(new Module);
}
} // namespace CreateGui

View File

@@ -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
$<$<COMPILE_LANGUAGE:CXX>:"${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})

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef CREATEGUI_PRECOMPILED_H
#define CREATEGUI_PRECOMPILED_H
#include <FCConfig.h>
#include <string>
#include <Gui/QtAll.h>
#endif // CREATEGUI_PRECOMPILED_H