Skip to content

Commit

Permalink
Improve 1k/fetch.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 committed Mar 24, 2024
1 parent 4ccd045 commit d1cf78b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions 1k/fetch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ function(_1kfetch_init)
list(GET _1kdist_url 1 _1kdist_ver)
set(_1kdist_base_url "${_1kdist_base_url}/v${_1kdist_ver}" PARENT_SCOPE)
set(_1kdist_ver ${_1kdist_ver} PARENT_SCOPE)
if(NOT _1kfetch_cache_dir)
file(REAL_PATH "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../cache" _1kfetch_cache_dir)
set(_1kfetch_cache_dir "${_1kfetch_cache_dir}" CACHE STRING "" FORCE)
endif()
if(NOT _1kfetch_manifest)
file(REAL_PATH "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../manifest.json" _1kfetch_manifest)
set(_1kfetch_manifest "${_1kfetch_manifest}" CACHE STRING "" FORCE)
endif()
endfunction()

# fetch prebuilt from 1kdist
Expand Down Expand Up @@ -97,10 +105,11 @@ function(_1kcm_add_pkg uri)
endforeach()
set(binary_dir "")
if(IS_ABSOLUTE ${source_dir})
string(LENGTH "${_AX_ROOT}/cache/" _offset)
string(LENGTH ${source_dir} _len)
math(EXPR _len "${_len} - ${_offset}" OUTPUT_FORMAT DECIMAL)
string(SUBSTRING ${source_dir} ${_offset} ${_len} _path)
# string(LENGTH "${_1kfetch_cache_dir}/" _offset)
# string(LENGTH "${source_dir}" _len)
# math(EXPR _len "${_len} - ${_offset}" OUTPUT_FORMAT DECIMAL)
# string(SUBSTRING ${source_dir} ${_offset} ${_len} _path)
get_filename_component(_path ${source_dir} NAME)
set(binary_dir "${CMAKE_BINARY_DIR}/1kiss/${_path}")
endif()

Expand Down

3 comments on commit d1cf78b

@paulocoutinhox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not delete the not used code? Why always comment it if it will not be used?

@halx99
Copy link
Collaborator Author

@halx99 halx99 commented on d1cf78b Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latest commit already removed

@paulocoutinhox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thanks for answer.

Please sign in to comment.