FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add version info resource file for Window build by 9prady9 · Pull Request #3025 · arrayfire/arrayfire · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cmake  (1) .in  (1) .txt  (5) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ include(GetPrerequisites)
include(CheckCXXCompilerFlag)
include(SplitDebugInfo)

# Use the function generate_product_version on Windows
# to attach version info in dll file attributes.
# Make sure to pass appropriate arguments for each backend
# to generate the correct resource file
include(generate_product_version)

set_policies(
TYPE NEW
POLICIES CMP0073
Expand Down
45 changes: 45 additions & 0 deletions CMakeModules/generate_product_version.cmake
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function(generate_product_version outfile)
set(options)
set(oneValueArgs
COMPANY_NAME
FILE_DESCRIPTION
FILE_NAME
ORIGINAL_FILE_NAME
COMPANY_COPYRIGHT
)
set(multiValueArgs)
cmake_parse_arguments(PRODUCT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(NOT PRODUCT_COMPANY_NAME OR "${PRODUCT_COMPANY_NAME}" STREQUAL "")
set(PRODUCT_COMPANY_NAME "ArrayFire")
endif()
if(NOT PRODUCT_FILE_DESCRIPTION OR "${PRODUCT_FILE_DESCRIPTION}" STREQUAL "")
set(PRODUCT_FILE_DESCRIPTION "ArrayFire Library")
endif()
if(NOT PRODUCT_FILE_NAME OR "${PRODUCT_FILE_NAME}" STREQUAL "")
set(PRODUCT_FILE_NAME "${PROJECT_NAME}")
endif()
if(NOT PRODUCT_ORIGINAL_FILE_NAME OR "${PRODUCT_ORIGINAL_FILE_NAME}" STREQUAL "")
set(PRODUCT_ORIGINAL_FILE_NAME "${PRODUCT_FILE_NAME}")
endif()
if(NOT PRODUCT_FILE_DESCRIPTION OR "${PRODUCT_FILE_DESCRIPTION}" STREQUAL "")
set(PRODUCT_FILE_DESCRIPTION "${PRODUCT_FILE_NAME}")
endif()
if(NOT PRODUCT_COMPANY_COPYRIGHT OR "${PRODUCT_COMPANY_COPYRIGHT}" STREQUAL "")
string(TIMESTAMP PRODUCT_CURRENT_YEAR "%Y")
set(PRODUCT_COMPANY_COPYRIGHT "${PRODUCT_COMPANY_NAME} (C) Copyright ${PRODUCT_CURRENT_YEAR}")
endif()

set(PRODUCT_VERSION ${PROJECT_VERSION})
set(PRODUCT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(PRODUCT_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(PRODUCT_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(PRODUCT_INTERNAL_FILE_NAME ${PRODUCT_ORIGINAL_FILE_NAME})

set(ver_res_file "${PROJECT_BINARY_DIR}/${PRODUCT_FILE_NAME}_version_info.rc")
configure_file(
${PROJECT_SOURCE_DIR}/CMakeModules/version_info.rc.in
${ver_res_file}
)
set(${outfile} ${ver_res_file} PARENT_SCOPE)
endfunction()
50 changes: 50 additions & 0 deletions CMakeModules/version_info.rc.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include <winresrc.h>

#define VER_FILEVERSION @PRODUCT_VERSION_MAJOR@,@PRODUCT_VERSION_MINOR@,@PRODUCT_VERSION_PATCH@
#define VER_FILEVERSION_STR "@PRODUCT_VERSION@\0"


#define VER_PRODUCTVERSION @PRODUCT_VERSION_MAJOR@,@PRODUCT_VERSION_MINOR@,@PRODUCT_VERSION_PATCH@
#define VER_PRODUCTVERSION_STR "@PRODUCT_VERSION@\0"

#ifndef NDEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS VER_DEBUG
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "@PRODUCT_COMPANY_NAME@\0"
VALUE "FileDescription", "@PRODUCT_FILE_DESCRIPTION@\0"
VALUE "FileVersion", "@PRODUCT_VERSION@\0"
VALUE "InternalName", "@PRODUCT_INTERNAL_FILE_NAME@\0"
VALUE "LegalCopyright", "@PRODUCT_COMPANY_COPYRIGHT@\0"
VALUE "OriginalFilename", "@PRODUCT_ORIGINAL_FILE_NAME@\0"
VALUE "ProductName", "@PRODUCT_FILE_NAME@\0"
VALUE "ProductVersion", "@PRODUCT_VERSION@\0"
END
END

BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END
6 changes: 5 additions & 1 deletion src/api/unified/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

generate_product_version(af_unified_ver_res_file
FILE_NAME "af"
FILE_DESCRIPTION "Unified Backend Dynamic-link library"
)

add_library(af "")
add_library(ArrayFire::af ALIAS af)

target_sources(af
PRIVATE
${af_unified_ver_res_file}
${CMAKE_CURRENT_SOURCE_DIR}/algorithm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/arith.cpp
${CMAKE_CURRENT_SOURCE_DIR}/array.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/backend/cpu/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@

include(InternalUtils)

generate_product_version(af_cpu_ver_res_file
FILE_NAME "afcpu"
FILE_DESCRIPTION "CPU Backend Dynamic-link library"
)

add_library(afcpu "")
add_library(ArrayFire::afcpu ALIAS afcpu)

# CPU backend source files
target_sources(afcpu
PRIVATE
$<$<PLATFORM_ID:Windows>:${af_cpu_ver_res_file}>
Array.cpp
Array.hpp
anisotropic_diffusion.cpp
Expand Down
6 changes: 6 additions & 0 deletions src/backend/cuda/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause

generate_product_version(af_cuda_ver_res_file
FILE_NAME "afcuda"
FILE_DESCRIPTION "CUDA Backend Dynamic-link library"
)

dependency_check(CUDA_FOUND "CUDA not found.")
if(AF_WITH_CUDNN)
dependency_check(cuDNN_FOUND "CUDNN not found.")
Expand Down Expand Up @@ -351,6 +356,7 @@ else()
endif()

cuda_add_library(afcuda
$<$<PLATFORM_ID:Windows>:${af_cuda_ver_res_file}>
${thrust_sort_sources}

EnqueueArgs.hpp
Expand Down
6 changes: 6 additions & 0 deletions src/backend/opencl/CMakeLists.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

include(InternalUtils)

generate_product_version(af_opencl_ver_res_file
FILE_NAME "afopencl"
FILE_DESCRIPTION "OpenCL Backend Dynamic-link library"
)

set(AF_OPENCL_BLAS_LIBRARY CLBlast CACHE STRING "Select OpenCL BLAS back-end")
set_property(CACHE AF_OPENCL_BLAS_LIBRARY PROPERTY STRINGS "clBLAS" "CLBlast")

Expand Down Expand Up @@ -45,6 +50,7 @@ add_library(ArrayFire::afopencl ALIAS afopencl)

target_sources(afopencl
PRIVATE
$<$<PLATFORM_ID:Windows>:${af_opencl_ver_res_file}>
Array.cpp
Array.hpp
Kernel.cpp
Expand Down

Back | FazBrowse Home | New Git URL