Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFormerLurker <hochgebe@gmail.com>2020-05-12 20:04:06 +0300
committerFormerLurker <hochgebe@gmail.com>2020-05-12 20:04:06 +0300
commit3f28fa125bbed6da8db3c2563a9fd599d5c9c026 (patch)
tree6c242ca32d9595007e71a3fa91e368e6d6fa808c /PyArcWelder/CMakeLists.txt
parent9abd4af8fe85514c1df214a21100cb9ed9b51d1e (diff)
First attempt to use CMake to build.
Diffstat (limited to 'PyArcWelder/CMakeLists.txt')
-rw-r--r--PyArcWelder/CMakeLists.txt54
1 files changed, 54 insertions, 0 deletions
diff --git a/PyArcWelder/CMakeLists.txt b/PyArcWelder/CMakeLists.txt
new file mode 100644
index 0000000..a26340d
--- /dev/null
+++ b/PyArcWelder/CMakeLists.txt
@@ -0,0 +1,54 @@
+cmake_minimum_required (VERSION "3.16")
+
+project(PyArcWelder C CXX)
+
+# PythonLibs is required to build a python extension
+find_package(PythonLibs REQUIRED)
+
+# Add definitions from ArcWelder and GcodeProcessorLib
+add_definitions(${ArcWelder_DEFINITIONS} ${GcodeProcessorLib_DEFINITIONS})
+
+# Include Python, ArcWelder and GcodeProcessorLib
+include_directories(${PYTHON_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} ${GcodeProcessorLib_INCLUDE_DIRS})
+
+# include sourcelist.cmake, which contains our source list and exposes it as the
+# PyArcWelderSources variable
+include(sourcelist.cmake)
+
+# Create our library
+add_library(${PROJECT_NAME} SHARED ${PyArcWelderSources})
+
+set_target_properties(
+ ${PROJECT_NAME}
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME ${PROJECT_NAME}
+ LINKER_LANGUAGE C
+)
+
+if(WIN32)
+ set_target_properties(
+ ${PROJECT_NAME}
+ PROPERTIES
+ SUFFIX ".pyd"
+ )
+endif()
+
+# Link to ArcWelder, GcodeProcessorLib and the Python Libraries
+target_link_libraries(${PROJECT_NAME} ArcWelder GcodeProcessorLib)
+
+# On Windows, it is required to link to the Python libraries
+if(WIN32)
+ target_link_libraries(${PROJECT_NAME} ArcWelder GcodeProcessorLib ${PYTHON_LIBRARIES})
+endif()
+
+# Expose the GcodeProcessorLib, and ArcWelder's Definitions.
+set(${PROJECT_NAME}_DEFINITIONS ${GcodeProcessorLib_DEFINITIONS}
+ ${ArcWelder_DEFINITIONS}
+ CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
+
+# Expose the GcodeProcessorLib, ArcWelder and PyArcWelder's Definitions.
+set(${PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/
+ ${ArcWelder_INCLUDE_DIRS}
+ ${GcodeProcessorLib_INCLUDE_DIRS}
+ CACHE INTERNAL "${PROJECT_NAME}: Include Directories" FORCE)