Skip to content

Commit dd7375d

Browse files
committed
Add CMake build system.
1 parent b55b867 commit dd7375d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 3.31)
2+
project(Python-for-ooRexx CXX)
3+
4+
# Configuration.
5+
set(oorexx_library $ENV{REXX_HOME}/api)
6+
set(python_version 3.12.7)
7+
8+
# Variables.
9+
set(target PyRexx)
10+
11+
# Target.
12+
add_library(${target} SHARED src/PyRexx.cpp)
13+
14+
# ooRexx library.
15+
target_include_directories(${target} PRIVATE ${oorexx_library})
16+
17+
# Python library.
18+
find_package(Python3 ${python_version} EXACT REQUIRED COMPONENTS Development.Embed)
19+
target_link_libraries(${target} PRIVATE Python3::Python)
20+
21+
# Create distribution.
22+
add_custom_command(
23+
TARGET ${target}
24+
POST_BUILD
25+
26+
COMMAND ${CMAKE_COMMAND}
27+
ARGS -E copy $<TARGET_FILE:${target}> ${CMAKE_SOURCE_DIR}/dist/$<TARGET_FILE_NAME:${target}>
28+
29+
COMMAND ${CMAKE_COMMAND}
30+
ARGS -E copy ${CMAKE_SOURCE_DIR}/src/PyRexx.cls ${CMAKE_SOURCE_DIR}/src/pyrexx.py ${CMAKE_SOURCE_DIR}/dist
31+
)

0 commit comments

Comments
 (0)