16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

cmake_path removed

This commit is contained in:
maj00r
2026-05-11 16:57:32 +02:00
parent 3786ecd98f
commit 4258af45dd
3 changed files with 14 additions and 47 deletions

View File

@@ -69,7 +69,7 @@ endif()
option(WITH_OPENGL_MODERN "Compile with OpenGL modern renderer" ON) option(WITH_OPENGL_MODERN "Compile with OpenGL modern renderer" ON)
option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON) option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON)
option(WITH_PYTHON "Compile with python3" ON) option(WITH_PYTHON "Python 3.14 embedded scripting" ON)
option(WITH_UART "Compile with libserialport" ON) option(WITH_UART "Compile with libserialport" ON)
option(WITH_LUA "Compile with lua scripting support" ON) option(WITH_LUA "Compile with lua scripting support" ON)
option(WITH_OPENVR "Compile with OpenVR" OFF) option(WITH_OPENVR "Compile with OpenVR" OFF)
@@ -81,10 +81,6 @@ option(WITH_BETTER_RENDERER "Experimental multi-backend renderer based on NVRHI"
option(GENERATE_PDB "Generate executable with program debugging symbols" ON) option(GENERATE_PDB "Generate executable with program debugging symbols" ON)
option(ENABLE_MCC "Enable multicore compilation" ON) option(ENABLE_MCC "Enable multicore compilation" ON)
option(WITHDUMPGEN "Enable generating DMP files on crash" ON) option(WITHDUMPGEN "Enable generating DMP files on crash" ON)
if(WIN32)
option(WITH_PYTHON_AUTO_INSTALL_WIN "If Python 3.14 Development is missing, install into tools/python314 (network)" ON)
endif()
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
# vcpkg init # vcpkg init
@@ -468,37 +464,15 @@ endif()
target_link_libraries(${PROJECT_NAME} glfw) target_link_libraries(${PROJECT_NAME} glfw)
if(WITH_PYTHON) if(WITH_PYTHON)
set(_py_tools "${CMAKE_SOURCE_DIR}/tools/python314")
set(_pyv 3.14.0)
if(WIN32)
if(EXISTS "${_py_tools}/python.exe" AND NOT Python3_ROOT_DIR)
set(Python3_ROOT_DIR "${_py_tools}" CACHE PATH "Python 3.14 (tools/python314)")
endif()
find_package(Python3 3.14 QUIET COMPONENTS Development)
endif()
find_package(Python3 3.14 REQUIRED COMPONENTS Development) find_package(Python3 3.14 REQUIRED COMPONENTS Development)
target_include_directories(${PROJECT_NAME} PRIVATE ${Python3_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PRIVATE ${Python3_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Python3_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${Python3_LIBRARIES})
if(WIN32) if(WIN32)
cmake_path(GET Python3_EXECUTABLE PARENT_PATH _px) set(EU07_PY_DLL "${Python3_ROOT_DIR}/python314.dll")
set(_rt "") set(EU07_PY_ZLIB "${Python3_ROOT_DIR}/zlib1.dll")
if(Python3_RUNTIME_LIBRARY_DIRS) set(EU07_PY_LIBDIR "${Python3_ROOT_DIR}/Lib")
list(GET Python3_RUNTIME_LIBRARY_DIRS 0 _rt) set(EU07_PY_DLLSDIR "${Python3_ROOT_DIR}/DLLs")
endif()
if(NOT _rt)
set(_rt "${_px}")
endif()
set(EU07_PY_DLL "${_rt}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.dll")
set(EU07_PY_ZLIB "${_rt}/zlib1.dll")
set(EU07_PY_LIBDIR "${_px}/Lib")
set(EU07_PY_DLLSDIR "${_px}/DLLs")
set(_vpt "${VCPKG_INSTALLED_PATH}/tools/python3")
if(NOT EXISTS "${EU07_PY_LIBDIR}")
set(EU07_PY_LIBDIR "${_vpt}/Lib")
endif()
if(NOT EXISTS "${EU07_PY_DLLSDIR}")
set(EU07_PY_DLLSDIR "${_vpt}/DLLs")
endif()
endif() endif()
endif() endif()
@@ -583,18 +557,11 @@ if (WIN32)
endif () endif ()
if(WIN32 AND WITH_PYTHON) if(WIN32 AND WITH_PYTHON)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_DLL}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_DLL}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
if(EXISTS "${EU07_PY_ZLIB}")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_ZLIB}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_ZLIB}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${EU07_PY_LIBDIR}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/python64/Lib" COMMAND ${CMAKE_COMMAND} -E copy_directory "${EU07_PY_LIBDIR}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/python64/Lib"
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${EU07_PY_DLLSDIR}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/python64/DLLs" COMMAND ${CMAKE_COMMAND} -E copy_directory "${EU07_PY_DLLSDIR}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>/python64/DLLs"
) )
endif() endif()

View File

@@ -98,7 +98,7 @@ MaSzyna compiles and runs natively on **Linux** and **Windows**. Other platforms
| `-DCMAKE_BUILD_TYPE=Release` | Release build | | `-DCMAKE_BUILD_TYPE=Release` | Release build |
| `-DCMAKE_BUILD_TYPE=RelWithDebInfo` | Release build with debug symbols | | `-DCMAKE_BUILD_TYPE=RelWithDebInfo` | Release build with debug symbols |
| `-DWITH_BETTER_RENDERER=ON/OFF` | Enable/disable NVRHI-based renderer | | `-DWITH_BETTER_RENDERER=ON/OFF` | Enable/disable NVRHI-based renderer |
| `-DPython3_ROOT_DIR=<path>` | Root directory of the **Python 3.14** install to use (embedding); needed if several versions are present | | `-DPython3_ROOT_DIR=<path>` | Root of the **Python 3.14** install on Windows (`python.exe`, `Lib`, `DLLs`) for embed/copy steps; on Linux, optional if CMake picks the wrong interpreter |
> **Linux note:** `WITH_BETTER_RENDERER` uses DirectX 12 through NVRHI and is **not supported on Linux**. > **Linux note:** `WITH_BETTER_RENDERER` uses DirectX 12 through NVRHI and is **not supported on Linux**.
@@ -107,9 +107,9 @@ MaSzyna compiles and runs natively on **Linux** and **Windows**. Other platforms
## Windows ## Windows
Install **Python 3.14 x64** from [python.org](https://www.python.org/downloads/windows/) and include the optional **Python native development** feature (headers and `.lib` for embedding). If CMake picks another interpreter, pass `-DPython3_ROOT_DIR="C:\Path\To\Python314"` on the `cmake` line. Install **Python 3.14 x64** from [python.org](https://www.python.org/downloads/windows/) and include the optional **Python native development** feature (headers and `.lib` for embedding). Pass `-DPython3_ROOT_DIR="C:\Path\To\Python314"` on the `cmake` line when you want the layout under that directory used for embedding and for copying `Lib` / `DLLs` next to the executable.
**AppVeyor CI** builds with the worker images preinstalled Python at `C:/Python314-x64` (see [`appveyor.yml`](./appveyor.yml): `-DPython3_ROOT_DIR=...` and `-DWITH_PYTHON_AUTO_INSTALL_WIN=OFF`). **AppVeyor CI** builds with the worker images preinstalled Python at `C:/Python314-x64` (see [`appveyor.yml`](./appveyor.yml): `-DPython3_ROOT_DIR=...`).
```powershell ```powershell
# Clone repository with submodules # Clone repository with submodules

View File

@@ -22,7 +22,7 @@ before_build:
- cmd: | - cmd: |
if not exist build mkdir build if not exist build mkdir build
cd build cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%CONFIG% -DPython3_ROOT_DIR=C:/Python314-x64 -DWITH_PYTHON_AUTO_INSTALL_WIN=OFF cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%CONFIG% -DPython3_ROOT_DIR=C:/Python314-x64
build_script: build_script:
- cmd: | - cmd: |