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
parent9abd4af8fe85514c1df214a21100cb9ed9b51d1e (diff)
First attempt to use CMake to build.
Diffstat (limited to 'PyArcWelder')
-rw-r--r--PyArcWelder/CMakeLists.txt54
-rw-r--r--PyArcWelder/PyArcWelder.vcxproj6
-rw-r--r--PyArcWelder/PyArcWelder.vcxproj.filters6
-rw-r--r--PyArcWelder/sourcelist.cmake6
4 files changed, 72 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)
diff --git a/PyArcWelder/PyArcWelder.vcxproj b/PyArcWelder/PyArcWelder.vcxproj
index 1657d94..3f6138f 100644
--- a/PyArcWelder/PyArcWelder.vcxproj
+++ b/PyArcWelder/PyArcWelder.vcxproj
@@ -179,6 +179,12 @@
<Project>{31478bae-104b-4cc3-9876-42fa90cbd5fe}</Project>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Text Include="CMakeLists.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="sourcelist.cmake" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/PyArcWelder/PyArcWelder.vcxproj.filters b/PyArcWelder/PyArcWelder.vcxproj.filters
index 8544f81..96be875 100644
--- a/PyArcWelder/PyArcWelder.vcxproj.filters
+++ b/PyArcWelder/PyArcWelder.vcxproj.filters
@@ -42,4 +42,10 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
+ <ItemGroup>
+ <Text Include="CMakeLists.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="sourcelist.cmake" />
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/PyArcWelder/sourcelist.cmake b/PyArcWelder/sourcelist.cmake
new file mode 100644
index 0000000..5be1348
--- /dev/null
+++ b/PyArcWelder/sourcelist.cmake
@@ -0,0 +1,6 @@
+set(PyArcWelderSources ${PyArcWelderSources}
+ py_arc_welder.cpp
+ py_arc_welder_extension.cpp
+ py_logger.cpp
+ python_helpers.cpp
+) \ No newline at end of file