Skip to content

Commit 25fe9f1

Browse files
committed
fix license dir on windows
1 parent 56b4289 commit 25fe9f1

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

CMakeLists.txt

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -373,45 +373,43 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/pypylon/
373373
PATTERN "__pycache__" EXCLUDE
374374
)
375375

376-
# Install Pylon license files - get path from pylon target
376+
# Install Pylon license files
377377
if(DEFINED SKBUILD_METADATA_DIR)
378-
# Try to get pylon installation directory from the target
379-
get_target_property(PYLON_IMPORTED_LOCATION pylon::pylon IMPORTED_LOCATION)
380-
if(PYLON_IMPORTED_LOCATION)
381-
get_filename_component(PYLON_LIB_DIR ${PYLON_IMPORTED_LOCATION} DIRECTORY)
382-
get_filename_component(PYLON_ROOT_DIR ${PYLON_LIB_DIR} DIRECTORY)
383-
if(WIN32)
378+
# Get license directory based on platform
379+
if(WIN32)
380+
if(DEFINED ENV{PYLON_DEV_DIR})
384381
set(PYLON_LICENSE_DIR "$ENV{PYLON_DEV_DIR}/../Licenses")
385-
elseif(APPLE)
386-
set(PYLON_LICENSE_DIR "/Library/Frameworks/pylon.framework/Resources/licenses")
387-
else()
388-
set(PYLON_LICENSE_DIR "${PYLON_ROOT_DIR}/share/pylon/licenses")
382+
elseif(DEFINED ENV{PYLON_ROOT})
383+
set(PYLON_LICENSE_DIR "$ENV{PYLON_ROOT}/Licenses")
389384
endif()
390-
elseif(DEFINED ENV{PYLON_ROOT})
391-
if(WIN32)
392-
set(PYLON_LICENSE_DIR "$ENV{PYLON_DEV_DIR}/../Licenses")
393-
elseif(APPLE)
394-
set(PYLON_LICENSE_DIR "/Library/Frameworks/pylon.framework/Resources/licenses")
395-
else()
385+
elseif(APPLE)
386+
set(PYLON_LICENSE_DIR "/Library/Frameworks/pylon.framework/Resources/licenses")
387+
else() # Linux
388+
if(DEFINED ENV{PYLON_ROOT})
396389
set(PYLON_LICENSE_DIR "$ENV{PYLON_ROOT}/share/pylon/licenses")
397390
endif()
398391
endif()
399-
400-
if(DEFINED PYLON_LICENSE_DIR AND EXISTS "${PYLON_LICENSE_DIR}/License.txt")
401-
message(STATUS "Installing Pylon license from ${PYLON_LICENSE_DIR}")
392+
393+
# Output license directory for debugging
394+
message(STATUS "Pylon license directory: ${PYLON_LICENSE_DIR}")
395+
396+
397+
# Install main license if found
398+
if(EXISTS "${PYLON_LICENSE_DIR}/License.txt")
402399
install(FILES "${PYLON_LICENSE_DIR}/License.txt"
403400
DESTINATION "${SKBUILD_METADATA_DIR}/licenses"
404401
RENAME "PYLON_LICENSE.txt")
405402
else()
406-
message(FATAL_ERROR "Pylon license not found at expected location: ${PYLON_LICENSE_DIR}")
403+
message(FATAL_ERROR "Pylon license not found at: ${PYLON_LICENSE_DIR}")
407404
endif()
408-
409-
if(DEFINED PYLON_LICENSE_DIR AND EXISTS "${PYLON_LICENSE_DIR}/pylon_Third-Party_Licenses.txt")
405+
406+
# Install third-party licenses if found
407+
if(EXISTS "${PYLON_LICENSE_DIR}/pylon_Third-Party_Licenses.txt")
410408
install(FILES "${PYLON_LICENSE_DIR}/pylon_Third-Party_Licenses.txt"
411409
DESTINATION "${SKBUILD_METADATA_DIR}/licenses"
412410
RENAME "PYLON_THIRD_PARTY_LICENSES.txt")
413411
else()
414-
message(WARNING "Pylon third-party licenses not found at expected location: ${PYLON_LICENSE_DIR}")
412+
message(FATAL_ERROR "Pylon third-party license not found at: ${PYLON_LICENSE_DIR}")
415413
endif()
416414
else()
417415
message(WARNING "SKBUILD_METADATA_DIR not defined")

0 commit comments

Comments
 (0)