2022-12-14 08:36:18 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO ermig1979/Simd
|
2023-03-11 04:32:44 +08:00
|
|
|
REF "v${VERSION}"
|
2024-08-27 16:29:16 +08:00
|
|
|
SHA512 663fa32e1952c67814e62a697e29f8e4589a444f927130dd8e8fed909ff303d731c7de647d45e43312f35515772a8b8557fe417895d7ec03d0e9977bc3a1b3ee
|
2022-12-14 08:36:18 +08:00
|
|
|
HEAD_REF master
|
2024-07-16 01:48:07 +08:00
|
|
|
PATCHES
|
|
|
|
fix-platform-detection.patch
|
2022-12-14 08:36:18 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS AND (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64"))
|
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
2024-03-20 07:49:04 +08:00
|
|
|
set(SIMD_PLATFORM "Win32")
|
2022-12-14 08:36:18 +08:00
|
|
|
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
2024-03-20 07:49:04 +08:00
|
|
|
set(SIMD_PLATFORM "x64")
|
2022-12-14 08:36:18 +08:00
|
|
|
endif()
|
2024-03-20 07:49:04 +08:00
|
|
|
|
2022-12-14 08:36:18 +08:00
|
|
|
if(VCPKG_PLATFORM_TOOLSET MATCHES "v140")
|
|
|
|
set(SOLUTION_TYPE vs2015)
|
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v141")
|
|
|
|
set(SOLUTION_TYPE vs2017)
|
|
|
|
elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v142")
|
|
|
|
set(SOLUTION_TYPE vs2019)
|
|
|
|
else()
|
|
|
|
set(SOLUTION_TYPE vs2022)
|
|
|
|
endif()
|
2024-03-20 07:49:04 +08:00
|
|
|
|
2022-12-14 08:36:18 +08:00
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/src/Simd/SimdConfig.h"
|
2024-03-20 07:49:04 +08:00
|
|
|
"//#define SIMD_STATIC"
|
|
|
|
"#define SIMD_STATIC")
|
2022-12-14 08:36:18 +08:00
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/prj/${SOLUTION_TYPE}/Simd.vcxproj"
|
2024-03-20 07:49:04 +08:00
|
|
|
"<ConfigurationType>DynamicLibrary</ConfigurationType>"
|
|
|
|
"<ConfigurationType>StaticLibrary</ConfigurationType>")
|
2023-03-31 05:18:14 +08:00
|
|
|
file(GLOB_RECURSE PROJ_FILES "${SOURCE_PATH}/prj/${SOLUTION_TYPE}/*.vcxproj")
|
|
|
|
foreach(PROJ_FILE ${PROJ_FILES})
|
|
|
|
vcpkg_replace_string(${PROJ_FILE}
|
|
|
|
" </ClCompile>"
|
|
|
|
" <DebugInformationFormat>OldStyle</DebugInformationFormat>\n </ClCompile>")
|
|
|
|
endforeach()
|
2024-03-20 07:49:04 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
|
|
file(GLOB_RECURSE PROJ_FILES "${SOURCE_PATH}/prj/${SOLUTION_TYPE}/*.vcxproj")
|
|
|
|
foreach(PROJ_FILE ${PROJ_FILES})
|
2022-12-14 08:36:18 +08:00
|
|
|
vcpkg_replace_string(${PROJ_FILE}
|
2024-03-20 07:49:04 +08:00
|
|
|
" </ClCompile>"
|
|
|
|
" <RuntimeLibrary Condition=\"'$(Configuration)'=='Debug'\">MultiThreadedDebugDLL</RuntimeLibrary>\n <RuntimeLibrary Condition=\"'$(Configuration)'=='Release'\">MultiThreadedDLL</RuntimeLibrary>\n </ClCompile>")
|
|
|
|
endforeach()
|
2022-12-14 08:36:18 +08:00
|
|
|
endif()
|
2024-03-20 07:49:04 +08:00
|
|
|
|
2022-12-14 08:36:18 +08:00
|
|
|
vcpkg_install_msbuild(
|
2024-03-20 07:49:04 +08:00
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PROJECT_SUBPATH "/prj/${SOLUTION_TYPE}/Simd.sln"
|
|
|
|
PLATFORM ${SIMD_PLATFORM}
|
2024-07-16 01:48:07 +08:00
|
|
|
TARGET "lib\\Simd"
|
2024-03-20 07:49:04 +08:00
|
|
|
RELEASE_CONFIGURATION "Release"
|
|
|
|
DEBUG_CONFIGURATION "Debug"
|
2022-12-14 08:36:18 +08:00
|
|
|
)
|
2023-03-31 05:18:14 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2023-01-12 15:26:28 +08:00
|
|
|
file(GLOB SIMD_HEADERS "${SOURCE_PATH}/src/Simd/*.hpp" "${SOURCE_PATH}/src/Simd/*.h")
|
|
|
|
file(COPY ${SIMD_HEADERS} DESTINATION "${CURRENT_PACKAGES_DIR}/include/Simd")
|
2024-07-16 01:48:07 +08:00
|
|
|
elseif((VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") AND (VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"))
|
|
|
|
message(FATAL_ERROR "Arm64 building with MSVC is currently not supported.")
|
|
|
|
else()
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/src/Simd/SimdConfig.h"
|
|
|
|
"//#define SIMD_STATIC"
|
|
|
|
"#define SIMD_STATIC"
|
2022-12-14 08:36:18 +08:00
|
|
|
)
|
|
|
|
endif()
|
2024-07-16 01:48:07 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SIMD_SHARED)
|
2022-12-14 08:36:18 +08:00
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}/prj/cmake"
|
2024-07-16 01:48:07 +08:00
|
|
|
OPTIONS
|
|
|
|
-DSIMD_TEST=OFF
|
|
|
|
-DSIMD_SHARED=${SIMD_SHARED}
|
|
|
|
-DSIMD_PYTHON=OFF
|
2022-12-14 08:36:18 +08:00
|
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_cmake_config_fixup()
|
2024-07-16 01:48:07 +08:00
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/SimdConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/simd/")
|
2022-12-14 08:36:18 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
endif()
|
|
|
|
|
2023-03-11 04:32:44 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|