This repository was archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
feat add windows compilation support #54
Open
agrandville
wants to merge
29
commits into
google:dev
Choose a base branch
from
agrandville:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
62808c7
feat add windows support
agrandville 8b52bc6
fix cmake minimal version
agrandville 37b6ada
fix build set version
agrandville 0bfde54
fix disable appveyor remote desktop
agrandville 6306bc6
fix static cast size_t to CK_ULONG
agrandville 7dc0df0
feat add Win64 compilation support
agrandville e6db92d
fix appveyor error 'version already exists'
agrandville 9a83334
fix windows CMake generator name
agrandville 223a83b
fix downgrade to Visual Studio 14 2015
agrandville e0f7c14
doc add windows compilation notes
agrandville ed359d6
feat publish github release
agrandville 1e143db
fix change artifact zip path
agrandville 762c472
fix change artifact zip path
agrandville c229b27
Update .appveyor.yml
agrandville 8ad94de
Update CMakeLists.txt
agrandville ae4eb73
Update .appveyor.yml
agrandville 292cb09
Update .appveyor.yml
agrandville 172a6dc
Update .appveyor.yml
agrandville 83838a4
feat release appVeyor builds
agrandville c75abcb
feat disable appveyor RDP on finish
agrandville 8322301
fix PR regression
agrandville 92fa357
fix merge win32/cryptoki.h with pkcs11-env.h
agrandville 38dd4a7
fix remove getopt source
agrandville 6644bdc
Import pristine copy of NetBSD getopt code
agrandville 524e6aa
fix windows portability
agrandville 2decd75
fix update getopt build
agrandville f5a1536
fix remove unnecessary include
agrandville 71f3f71
fix remove unnecessary GTest libraries
agrandville 0c8badc
fix remove appveyor RDP on finish
agrandville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,49 @@ | ||
| version: 0.0.0-{build} | ||
| configuration: Release | ||
| platform: | ||
| - x86 | ||
| #- x64 | ||
| cache: | ||
| - C:/Tools/vcpkg/installed/ | ||
| environment: | ||
| APPVEYOR_SAVE_CACHE_ON_ERROR: true | ||
| matrix: | ||
| - GENERATOR: "Visual Studio 14 2015" | ||
| TARGET: x86-windows | ||
| - GENERATOR: "Visual Studio 14 2015 Win64" | ||
| TARGET: x64-windows | ||
| install: | ||
| # Update vcpkg | ||
| - cd c:\tools\vcpkg | ||
| - cmd: git fetch | ||
| - cmd: git checkout 2021.05.12 | ||
| - cmd: bootstrap-vcpkg.bat | ||
| - cmd: vcpkg install gtest:x86-windows | ||
| - cmd: vcpkg install gtest:x64-windows | ||
| - cmd: vcpkg update | ||
| - cmd: vcpkg upgrade --no-dry-run | ||
| build_script: | ||
| - cmd: if exist "C:\projects\pkcs11test\build" rd /s /q C:\projects\pkcs11test\build | ||
| - cmd: mkdir C:\projects\pkcs11test\build | ||
| - cmd: cd C:\projects\pkcs11test\build | ||
| - cmd: vcpkg integrate install | ||
| - cmd: cmake .. -G "%GENERATOR%" -DVCPKG_TARGET_TRIPLET=%TARGET% -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
| - cmd: cmake --build . --config RelWithDebInfo | ||
| - cmd: ctest -C RelWithDebInfo --progress --verbose | ||
| - cmd: cpack | ||
| artifacts: | ||
| - path: "build/*.zip" | ||
| name: artifacts-zip | ||
|
|
||
| deploy: | ||
| release: pkcs11test-v$(APPVEYOR_BUILD_VERSION) | ||
| description: 'Windows binaries auto-built by AppVeyor' | ||
| provider: GitHub | ||
| auth_token: | ||
| secure: KX9JW8h86LzNA1TDJy2adlFIV+E455sZqXTc/HQDPLSbHRTwEv5zpcdRA/n9xJGp | ||
| artifact: artifacts-zip | ||
| draft: true | ||
| prerelease: false | ||
| on: | ||
| branch: dev | ||
| # APPVEYOR_REPO_TAG: true # deploy on tag push only | ||
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,70 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| project(p11test) | ||
|
|
||
| set(VERSION "0.0.0") | ||
| set(VERSION_MAJOR 0) | ||
| set(VERSION_MINOR 0) | ||
| set(VERSION_PATCH 0) | ||
|
|
||
| set(SOURCES cipher.cc | ||
| describe.cc | ||
| digest.cc | ||
| dual.cc | ||
| globals.cc | ||
| hmac.cc | ||
| init.cc | ||
| key.cc | ||
| keypair.cc | ||
| login.cc | ||
| object.cc | ||
| pkcs11-describe.cc | ||
| pkcs11test.cc | ||
| rng.cc | ||
| session.cc | ||
| sign.cc | ||
| slot.cc | ||
| tookan.cc | ||
| ) | ||
|
|
||
| if(MSVC) | ||
| list(APPEND INCLUDE_DIRS | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/third_party/netbsd) | ||
|
|
||
| list(APPEND SOURCES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/third_party/netbsd/getopt_long.c) | ||
|
|
||
| endif() | ||
|
|
||
| list(APPEND INCLUDE_DIRS | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/third_party/pkcs11) | ||
|
|
||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTRICT_P11") | ||
| find_package(GTest CONFIG REQUIRED COMPONENTS CXX_LIB) | ||
| add_executable(${PROJECT_NAME} ${SOURCES}) | ||
| target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest) | ||
| target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ) | ||
|
|
||
| if(${VCPKG_TARGET_TRIPLET} MATCHES ".*windows-static$") | ||
| message(FATAL_ERROR "GTest library doesn't support static linking for now") | ||
| # switch to MultiThreaded runtime library (MT) vs MultiThreaded DLL (MD) | ||
| set_property(TARGET ${PROJECT_NAME} PROPERTY | ||
| MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
| endif() | ||
|
|
||
|
|
||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/p11test.exe DESTINATION bin) | ||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/p11test.pdb DESTINATION bin OPTIONAL) | ||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/gtest.dll DESTINATION bin) | ||
|
|
||
| # Packaging | ||
| set(CPACK_PACKAGE_NAME ${PACKAGE_NAME}) | ||
| set(CPACK_PACKAGE_VENDOR "plcs11test") | ||
| set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) | ||
| set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) | ||
| set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) | ||
| set(CPACK_GENERATOR "ZIP") | ||
| set(CPACK_SOURCE_GENERATOR "ZIP") | ||
| set(CPACK_SOURCE_IGNORE_FILES "build/*;\.git/*") | ||
|
|
||
| include(CPack) |
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,38 @@ | ||
| # Building pkcs11test for Windows | ||
|
|
||
| This document describes process of building both 32-bit and 64-bit versions of pkcs11test on 64-bit Windows machine. | ||
|
|
||
| ## Required software | ||
|
|
||
| - [Visual Studio](https://visualstudio.microsoft.com/vs/community/) (Community) | ||
| - [C/C++ dependency manager from Microsoft](https://vcpkg.io/) | ||
| - [CMake](https://cmake.org/) | ||
|
|
||
| ## Prepare working directories | ||
|
|
||
| set P11TEST_HOME=C:\Projects\pkcs11test | ||
| set VCPKG_HOME=C:\Projects\vcpkg | ||
|
|
||
| ## Build GTest | ||
|
|
||
| cd %VCPKG_HOME% | ||
| bootstrap-vcpkg.bat | ||
| vcpkg install gtest:x86-windows | ||
| vcpkg install gtest:x64-windows | ||
| vcpkg integrate install | ||
|
|
||
| ## Build pkcs11test | ||
| git clone https://github.com/google/pkcs11test.git %P11TEST_HOME% | ||
| ## x86 | ||
| mkdir %P11TEST_HOME%\tmp | ||
| cd %P11TEST_HOME%\tmp | ||
| cmake .. -A Win32 -DCMAKE_TOOLCHAIN_FILE=%VCPKG_HOME%/scripts/buildsystems/vcpkg.cmake | ||
| cmake --build . --config RelWithDebInfo | ||
| cmake -DCMAKE_INSTALL_PREFIX=%P11TEST_HOME%\out32 -DCMAKE_INSTALL_CONFIG_NAME=RelWithDebInfo -P cmake_install.cmake | ||
|
|
||
| ## x64 | ||
| mkdir %P11TEST_HOME%\tmp | ||
| cd %P11TEST_HOME%\tmp | ||
| cmake .. -A x64 -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=%VCPKG_HOME%/scripts/buildsystems/vcpkg.cmake | ||
| cmake --build . --config RelWithDebInfo | ||
| cmake -DCMAKE_INSTALL_PREFIX=%P11TEST_HOME%\out64 -DCMAKE_INSTALL_CONFIG_NAME=RelWithDebInfo -P cmake_install.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
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.