From eeaaf5d258ab228221046332646e0a6d08f8b7e8 Mon Sep 17 00:00:00 2001 From: Thad House Date: Sat, 11 Jul 2020 13:54:15 -0700 Subject: [PATCH] [build] Add Azure build using cmake on Windows (#2588) More people are starting to use this build, so make sure it doesn't break. Also tests that build succeeds with OpenCV 4. --- azure-pipelines.yml | 2 ++ azure-templates/job-build-vcpkg.yml | 26 ++++++++++++++++++++++++++ azure-templates/vcpkg_x64-windows.txt | 3 +++ wpiutil/CMakeLists.txt | 8 ++++++-- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 azure-templates/job-build-vcpkg.yml create mode 100644 azure-templates/vcpkg_x64-windows.txt diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e4590ba721..fc4d4408fb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,6 +23,8 @@ trigger: stages: - stage: Build jobs: + - template: azure-templates/job-build-vcpkg.yml + - template: azure-templates/job-build.yml parameters: jobName: Linux_Arm diff --git a/azure-templates/job-build-vcpkg.yml b/azure-templates/job-build-vcpkg.yml new file mode 100644 index 0000000000..ee445344bb --- /dev/null +++ b/azure-templates/job-build-vcpkg.yml @@ -0,0 +1,26 @@ +jobs: +- job: Windows_CMake + pool: + vmImage: 'windows-2019' + + variables: + vcpkgGitRef: 544f8e4593764f78faa94bac2adb81cca5232943 + + steps: + - task: Cache@2 + displayName: Cache vcpkg + inputs: + key: $(Build.SourcesDirectory)/azure-templates/vcpkg_x64-windows.txt | "$(vcpkgGitCommitId)" | "$(Agent.OS)" + path: '$(Build.BinariesDirectory)/vcpkg' + - task: run-vcpkg@0 + displayName: Run vcpkg + inputs: + vcpkgArguments: '@$(Build.SourcesDirectory)/azure-templates/vcpkg_x64-windows.txt' + vcpkgGitCommitId: $(vcpkgGitRef) + - task: run-cmake@0 + displayName: Build With CMake + inputs: + cmakeListsOrSettingsJson: 'CMakeListsTxtAdvanced' + vcpkgTriplet: '$(RUNVCPKG_VCPKG_TRIPLET)' + useVcpkgToolchainFile: true + cmakeAppendedArgs: '-DWITHOUT_JAVA=ON -DWITHOUT_ALLWPILIB=OFF -DWITHOUT_CSCORE=OFF' diff --git a/azure-templates/vcpkg_x64-windows.txt b/azure-templates/vcpkg_x64-windows.txt new file mode 100644 index 0000000000..a1a1332a3d --- /dev/null +++ b/azure-templates/vcpkg_x64-windows.txt @@ -0,0 +1,3 @@ +--triplet +x64-windows +opencv diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt index 559c8ed52f..ba1af82b3f 100644 --- a/wpiutil/CMakeLists.txt +++ b/wpiutil/CMakeLists.txt @@ -64,7 +64,11 @@ if (NOT WITHOUT_JAVA) execute_process(COMMAND python3 ${CMAKE_SOURCE_DIR}/wpiutil/generate_numbers.py ${CMAKE_BINARY_DIR}/wpiutil RESULT_VARIABLE generateResult) if(NOT (generateResult EQUAL "0")) - message(FATAL_ERROR "python3 generate_numbers.py failed") + # Try python + execute_process(COMMAND python ${CMAKE_SOURCE_DIR}/wpiutil/generate_numbers.py ${CMAKE_BINARY_DIR}/wpiutil RESULT_VARIABLE generateResult) + if(NOT (generateResult EQUAL "0")) + message(FATAL_ERROR "python and python3 generate_numbers.py failed") + endif() endif() set(CMAKE_JNI_TARGET true) @@ -171,7 +175,7 @@ set_property(TARGET wpiutil PROPERTY FOLDER "libraries") target_compile_features(wpiutil PUBLIC cxx_std_17) if (MSVC) - target_compile_options(wpiutil PUBLIC /permissive- /Zc:throwingNew) + target_compile_options(wpiutil PUBLIC /permissive- /Zc:throwingNew /MP) target_compile_definitions(wpiutil PRIVATE -D_CRT_SECURE_NO_WARNINGS) endif() wpilib_target_warnings(wpiutil)