Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jul 5, 2024
1 parent 82926e5 commit a5bd975
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 27 deletions.
13 changes: 12 additions & 1 deletion .ci/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ if [ "$SYSTEM_COLLECTIONID" != "" ]; then
echo "Azure detected"
CI_NAME="$(echo "$AGENT_OS" | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$BUILD_SOURCESDIRECTORY"
CI_TYPE="azure"
elif [ "$HOME" != "" ]; then
# GitHub Actions
echo "Github Actions detected"
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
CI_BUILD_DIR="$GITHUB_WORKSPACE"
CI_TYPE="github_action"
else
# for executing in non ci environment
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
CI_TYPE="other"
fi

if [ ${BUILD_ARCHIVES} = true ]; then
Expand Down Expand Up @@ -80,12 +83,20 @@ elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${IS_ARCHIVE_SKIPPED}"
fi

if [[ $CI_TYPE == "github_action" ]]; then
export CCACHE_COMPILERCHECK=content
export CCACHE_NOCOMPRESS=true
BUILD_OPTION="${BUILD_OPTION} -DCMAKE_GITHUB_ACTION=ON"
else
BUILD_OPTION="${BUILD_OPTION} -DCMAKE_GITHUB_ACTION=OFF"
fi

echo "Build option: ${BUILD_OPTION}"

mkdir -p build/.ccache

cd build
cmake -G "Visual Studio 17 2022" ${BUILD_OPTION} -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_GITHUB_ACTION=1 ../ || exit 2
cmake -G "Visual Studio 17 2022" ${BUILD_OPTION} -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ../ || exit 2
./ccache.exe -zp || true
cmake --build . --target package --config Release -- -nologo -v:m -maxcpucount || exit 3
./ccache.exe -sv || true
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if (USE_CCACHE_CACHING)
if (DEFINED ENV{CCACHE_DIR})
set (CCACHE_DIR_CACHE_LOCATION $ENV{CCACHE_DIR})
message ( STATUS "Found CCache (${CCACHE_FOUND}) and its env settings: ${CCACHE_DIR_CACHE_LOCATION}. Will try to use it." )
elseif (WIN32 AND NOT CMAKE_GITHUB_ACTION)
elseif (WIN32 AND (NOT CMAKE_GITHUB_ACTION))
set (CCACHE_DIR_CACHE_LOCATION "$ENV{AppData}/.ccache")
message ( STATUS "Found CCache (${CCACHE_FOUND}) and set ccache dir: ${CCACHE_DIR_CACHE_LOCATION}. Will try to use it." )
else()
Expand All @@ -81,6 +81,7 @@ if (USE_CCACHE_CACHING)
else()
set(HYPERHDR_CCACHE_PARAMS
CCACHE_MAXSIZE=600M
CCACHE_NOCOMPRESS=true
CCACHE_DIR=${CCACHE_DIR_CACHE_LOCATION}
CCACHE_SLOPPINESS=pch_defines,time_macros
CCACHE_INODECACHE=true
Expand Down
28 changes: 3 additions & 25 deletions cmake/installers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -586,32 +586,10 @@ macro(DeployWindows TARGET)
FILES "${CMAKE_BINARY_DIR}/qt.conf"
DESTINATION "bin"
COMPONENT "HyperHDR"
)

execute_process(
COMMAND ${SEVENZIP_BIN} e ${PROJECT_SOURCE_DIR}/resources/lut/lut_lin_tables.tar.xz -o${CMAKE_CURRENT_BINARY_DIR} -aoa -y
RESULT_VARIABLE STATUS
OUTPUT_VARIABLE OUTPUT1
)
if(STATUS AND NOT STATUS EQUAL 0)
message( FATAL_ERROR "LUT tar.xz Bad exit status: ${STATUS} ${OUTPUT1}")
else()
message( STATUS "LUT tar.xz tar extracted")
endif()

execute_process(
COMMAND ${SEVENZIP_BIN} e ${CMAKE_CURRENT_BINARY_DIR}/lut_lin_tables.tar -o${CMAKE_CURRENT_BINARY_DIR} -aoa -y
RESULT_VARIABLE STATUS
OUTPUT_VARIABLE OUTPUT1
)
if(STATUS AND NOT STATUS EQUAL 0)
message( FATAL_ERROR "LUT tar Bad exit status")
else()
message( STATUS "LUT tar extracted")
endif()
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/lut_lin_tables.3d
FILES ${PROJECT_SOURCE_DIR}/resources/lut/lut_lin_tables.tar.xz
DESTINATION "bin"
COMPONENT "HyperHDR"
)
Expand Down Expand Up @@ -659,7 +637,7 @@ macro(DeployWindows TARGET)
endif()
endif()

if (WINDEPLOYQT_EXECUTABLE AND NOT CMAKE_GITHUB_ACTION)
if (WINDEPLOYQT_EXECUTABLE AND (NOT CMAKE_GITHUB_ACTION))
set(WINDEPLOYQT_PARAMS_RUNTIME --verbose 0 --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler)
message(STATUS "Found windeployqt: ${WINDEPLOYQT_EXECUTABLE} PATH_HINT:${My_Qt6Core_EXECUTABLE_DIR}${QT_BIN_DIR}")
add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} ${WINDEPLOYQT_PARAMS_RUNTIME} "$<TARGET_FILE:${TARGET}>")
Expand Down
5 changes: 5 additions & 0 deletions cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_VERT "${NSIS_HYP_LOGO_VERT}
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_HORI "${NSIS_HYP_LOGO_HORI}")

SET ( CPACK_NSIS_MODIFY_PATH ON )
if(DO_NOT_BUILD_ARCHIVES)
SET ( CPACK_NSIS_COMPRESSOR "" )
else()
SET ( CPACK_NSIS_COMPRESSOR "/SOLID lzma" )
endif()
SET ( CPACK_NSIS_MUI_ICON ${NSIS_HYP_ICO})
SET ( CPACK_NSIS_MUI_UNIICON ${NSIS_HYP_ICO})
SET ( CPACK_NSIS_MUI_HEADERIMAGE ${NSIS_HYP_LOGO_HORI} )
Expand Down
Binary file added cmake/windows/plugins/ExtractLut.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions cmake/windows/template/NSIS.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@
SetCompress off

;Require administrator access
RequestExecutionLevel admin
Expand Down Expand Up @@ -792,6 +793,16 @@ Section "-Core installation"
; Install Visual c++ Redistributable
ExecWait '"$INSTDIR\bin\vc_redist.x64.exe" /install /quiet /norestart'

Push "$INSTDIR\bin\lut_lin_tables.tar.xz"
Push "$INSTDIR\bin\lut_lin_tables.3d"

ExtractLut::extract
Pop $0
StrCmp $0 success SUCCESS
MessageBox MB_OK|MB_ICONSTOP "$0"
MessageBox MB_OK|MB_ICONSTOP "Please extract $INSTDIR\bin\lut_lin_tables.tar.xz manually using 7-zip"
SUCCESS:

SectionEnd

Section "-Add to path"
Expand Down Expand Up @@ -914,6 +925,7 @@ Section "Uninstall"
;Remove files we installed.
;Keep the list of directories here in sync with the File commands above.
@CPACK_NSIS_DELETE_FILES@
Delete "$INSTDIR\bin\lut_lin_tables.3d"
@CPACK_NSIS_DELETE_DIRECTORIES@

!ifdef CPACK_NSIS_ADD_REMOVE
Expand Down

0 comments on commit a5bd975

Please sign in to comment.