Skip to content

Commit 9f55f26

Browse files
committed
Prepare pip package using local OMSimulator build
1 parent 33c40b0 commit 9f55f26

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ project(OMSimulator)
88
option(OMS_ENABLE_OMSimulator "Enable OMSimulator component" ON)
99
option(OMS_ENABLE_OMSimulatorGui "Enable OMSimulator GUI component" OFF)
1010
option(OMS_ENABLE_PIP "Enable pip component" OFF)
11+
option(OMS_ENABLE_LOCAL_PIP "Prepare pip package using local OMSimulator build" OFF)
1112
option(OMS_ENABLE_TESTSUITE "Enable the OMSimulator testsuite" OFF)
1213
option(OMS_ENABLE_COVERAGE "Instrument the OMSimulator C++ sources for code coverage" OFF)
1314

@@ -86,7 +87,7 @@ if(OMS_ENABLE_OMSimulatorGui)
8687
add_subdirectory(src/OMSimulatorGui)
8788
endif()
8889

89-
if(OMS_ENABLE_PIP)
90+
if(OMS_ENABLE_PIP OR OMS_ENABLE_LOCAL_PIP)
9091
add_subdirectory(src/pip)
9192
endif()
9293

src/pip/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
project(pip)
22

3+
if(OMS_ENABLE_LOCAL_PIP)
4+
set(OMS_PIP_CMDCLASS "")
5+
else()
6+
set(OMS_PIP_CMDCLASS
7+
"[tool.setuptools.cmdclass]
8+
build_py = \"build_helpers.OMSInstaller\""
9+
)
10+
endif()
11+
312
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build_helpers.py" "${CMAKE_CURRENT_BINARY_DIR}/build_helpers.py" @ONLY)
413
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pyproject.toml" "${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml" @ONLY)
514

@@ -9,3 +18,10 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml" DESTINATION ${CMAKE_C
918
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.in" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)
1019
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)
1120
install(FILES "${CMAKE_SOURCE_DIR}/OSMC-License.txt" DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/install/)
21+
22+
if(OMS_ENABLE_LOCAL_PIP)
23+
message(STATUS "Local pip package enabled")
24+
install(DIRECTORY "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/OMSimulator/" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/install/OMSimulator/")
25+
# Copy the platform-specific OMSimulator shared library
26+
install(FILES "$<TARGET_FILE:OMSimulatorLib>" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/install/OMSimulator/")
27+
endif()

src/pip/pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@ Download = "https://pypi.org/project/OMSimulator/#files"
3232
packages = ["OMSimulator"] ## dynamically created
3333
zip-safe = false
3434

35-
[tool.setuptools.cmdclass]
36-
build_py = "build_helpers.OMSInstaller"
35+
[tool.setuptools.package-data]
36+
OMSimulator = ["**/*"]
37+
38+
@OMS_PIP_CMDCLASS@

0 commit comments

Comments
 (0)