feat(create): add C++ module scaffold with App/ and Gui/ targets (#251)
Some checks failed
Build and Test / build (pull_request) Failing after 2m2s
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:
21
src/Mod/Create/App/AppCreate.cpp
Normal file
21
src/Mod/Create/App/AppCreate.cpp
Normal 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);
|
||||||
|
}
|
||||||
23
src/Mod/Create/App/AppCreatePy.cpp
Normal file
23
src/Mod/Create/App/AppCreatePy.cpp
Normal 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
|
||||||
35
src/Mod/Create/App/CMakeLists.txt
Normal file
35
src/Mod/Create/App/CMakeLists.txt
Normal 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})
|
||||||
11
src/Mod/Create/App/PreCompiled.h
Normal file
11
src/Mod/Create/App/PreCompiled.h
Normal 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
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
# Kindred Create core module
|
# Kindred Create core module
|
||||||
# Handles auto-loading of ztools and Silo addons
|
# 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
|
# Generate version.py from template with Kindred Create version
|
||||||
configure_file(
|
configure_file(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/version.py.in
|
${CMAKE_CURRENT_SOURCE_DIR}/version.py.in
|
||||||
|
|||||||
26
src/Mod/Create/CreateGlobal.h
Normal file
26
src/Mod/Create/CreateGlobal.h
Normal 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
|
||||||
21
src/Mod/Create/Gui/AppCreateGui.cpp
Normal file
21
src/Mod/Create/Gui/AppCreateGui.cpp
Normal 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);
|
||||||
|
}
|
||||||
23
src/Mod/Create/Gui/AppCreateGuiPy.cpp
Normal file
23
src/Mod/Create/Gui/AppCreateGuiPy.cpp
Normal 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
|
||||||
34
src/Mod/Create/Gui/CMakeLists.txt
Normal file
34
src/Mod/Create/Gui/CMakeLists.txt
Normal 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})
|
||||||
12
src/Mod/Create/Gui/PreCompiled.h
Normal file
12
src/Mod/Create/Gui/PreCompiled.h
Normal 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
|
||||||
Reference in New Issue
Block a user