Files

44 lines
1.8 KiB
CMake
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# WP-P4-35 官方 CAM G-code 后处理插件(Fanuc/Grbl,ABI 1.2;纯 C ABI,不链接内核)。
# 独立 CMake 工程;未加入 shared CMake,供 Lead/聚合构建注册。
cmake_minimum_required(VERSION 3.16)
project(vde_official_cam_gcode LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
add_library(vde_official_cam_gcode SHARED cam_gcode_plugin.cpp)
target_compile_definitions(vde_official_cam_gcode PRIVATE VDE_PLUGIN_IMPL=1)
target_include_directories(vde_official_cam_gcode PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../include")
if(MSVC)
target_compile_options(vde_official_cam_gcode PRIVATE /W4 /utf-8)
else()
target_compile_options(vde_official_cam_gcode PRIVATE -Wall -Wextra -Wpedantic)
endif()
# 与 shared CMake 的官方插件输出约定一致:<build>/plugins/official/<dirname>。
set(_out "${CMAKE_BINARY_DIR}/plugins/official/cam_gcode")
set_target_properties(vde_official_cam_gcode PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${_out}"
RUNTIME_OUTPUT_DIRECTORY "${_out}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${_out}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${_out}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${_out}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${_out}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${_out}"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${_out}"
LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${_out}"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${_out}")
if(WIN32)
set_target_properties(vde_official_cam_gcode PROPERTIES PREFIX "")
endif()
add_custom_command(TARGET vde_official_cam_gcode POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/vde-plugin.json"
"${_out}/vde-plugin.json")