Files
create/src/Mod/PartDesign/App/CMakeLists.txt
Markus Reitböck 5b6a0b1852 PartDesign: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
 should be considered an optimization, not a requirement. In particular, do not explicitly include a
 precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
 generated precompile header on the compiler command line instead. This is more portable across
 the major compilers and is likely to be easier to maintain. It will also avoid warnings being
 generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-23 22:39:36 +02:00

166 lines
3.4 KiB
CMake

include_directories(
SYSTEM
${CMAKE_SOURCE_DIR}/src/3rdParty/json/single_include/nlohmann/
)
generate_from_py(Body)
generate_from_py(Feature)
set(PartDesign_LIBS
${OCC_LIBRARIES}
${OCC_DEBUG_LIBRARIES}
Part
FreeCADApp
)
SET(Features_SRCS
Feature.cpp
Feature.h
FeatureSolid.cpp
FeatureSolid.h
Body.cpp
Body.h
FeatureBase.h
FeatureBase.cpp
)
SOURCE_GROUP("Features" FILES ${Features_SRCS})
SET(DatumFeatures_SRCS
ShapeBinder.h
ShapeBinder.cpp
DatumPlane.cpp
DatumPlane.h
DatumLine.cpp
DatumLine.h
DatumPoint.cpp
DatumPoint.h
DatumCS.h
DatumCS.cpp
)
SOURCE_GROUP("DatumFeatures" FILES ${DatumFeatures_SRCS})
SET(FeaturesTransformed_SRCS
FeatureTransformed.h
FeatureTransformed.cpp
FeatureMirrored.h
FeatureMirrored.cpp
FeatureLinearPattern.h
FeatureLinearPattern.cpp
FeaturePolarPattern.h
FeaturePolarPattern.cpp
FeatureScaled.h
FeatureScaled.cpp
FeatureMultiTransform.h
FeatureMultiTransform.cpp
)
SOURCE_GROUP("FeaturesTransformed" FILES ${FeaturesTransformed_SRCS})
SET(FeaturesDressUp_SRCS
FeatureDressUp.cpp
FeatureDressUp.h
FeatureFillet.cpp
FeatureFillet.h
FeatureChamfer.cpp
FeatureChamfer.h
FeatureDraft.cpp
FeatureDraft.h
FeatureThickness.cpp
FeatureThickness.h
)
SOURCE_GROUP("DressUpFeatures" FILES ${FeaturesDressUp_SRCS})
SET(FeaturesSketchBased_SRCS
FeatureExtrude.cpp
FeatureExtrude.h
FeatureSketchBased.cpp
FeatureSketchBased.h
FeaturePad.cpp
FeaturePad.h
FeaturePocket.cpp
FeaturePocket.h
FeatureRevolution.cpp
FeatureRevolution.h
FeatureGroove.cpp
FeatureGroove.h
FeatureRefine.cpp
FeatureRefine.h
FeatureAddSub.cpp
FeatureAddSub.h
FeatureHole.h
FeatureHole.cpp
FeatureBoolean.h
FeatureBoolean.cpp
FeaturePrimitive.h
FeaturePrimitive.cpp
FeaturePipe.h
FeaturePipe.cpp
FeatureLoft.h
FeatureLoft.cpp
FeatureHelix.h
FeatureHelix.cpp
)
SOURCE_GROUP("SketchBasedFeatures" FILES ${FeaturesSketchBased_SRCS})
SET(Module_SRCS
AppPartDesign.cpp
AppPartDesignPy.cpp
PreCompiled.h
Measure.cpp
Measure.h
)
SOURCE_GROUP("Module" FILES ${Module_SRCS})
SET(Python_SRCS
Body.pyi
BodyPyImp.cpp
Feature.pyi
FeaturePyImp.cpp
)
SOURCE_GROUP("Python" FILES ${Python_SRCS})
SET(PartDesign_SRCS
${Features_SRCS}
${DatumFeatures_SRCS}
${FeaturesTransformed_SRCS}
${FeaturesSketchBased_SRCS}
${FeaturesDressUp_SRCS}
${Module_SRCS}
${Python_SRCS}
)
add_library(PartDesign SHARED ${PartDesign_SRCS})
target_include_directories(
PartDesign
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_directories(PartDesign PUBLIC ${OCC_LIBRARY_DIR})
target_link_libraries(PartDesign ${PartDesign_LIBS})
if (MSVC)
target_compile_options(PartDesign PRIVATE /wd4275)
endif()
if (FREECAD_WARN_ERROR)
target_compile_warn_error(PartDesign)
endif()
if(FREECAD_USE_PCH)
target_precompile_headers(PartDesign PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
SET_BIN_DIR(PartDesign _PartDesign /Mod/PartDesign)
SET_PYTHON_PREFIX_SUFFIX(PartDesign)
INSTALL(TARGETS PartDesign DESTINATION ${CMAKE_INSTALL_LIBDIR})