Skip to content

Build with CMake #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Jul 5, 2019
Merged

Build with CMake #4

merged 57 commits into from
Jul 5, 2019

Conversation

BrennanConroy
Copy link
Member

@BrennanConroy BrennanConroy commented Apr 2, 2019

- script: echo Hello, world!
displayName: 'Run a one-line script'
- powershell: "& vcpkg.exe install cpprestsdk cpprestsdk:x64-windows --vcpkg-root ./submodules/vcpkg"
displayName: vcpkg install dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include this beforeBuild steps, extra cMakeRunArgs and the like for each OS in the README.md?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also be good to include instructions to run git submodule update --init and whatever build scripts we decide to add.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh duh, I meant to add a readme...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y'know what's even better than a README (though there should be one as well)? build.cmd ;)

@analogrelay analogrelay requested review from analogrelay and a team April 12, 2019 20:28
@analogrelay
Copy link
Contributor

analogrelay commented Apr 12, 2019

Added @aspnet/build since they should have some awareness of what's going on here ;). As a reminder, this client does not ship in binary form so the only thing we need here is a public PR/master validation build.

@halter73
Copy link
Member

Shouldn't the linux test timeout fail the SignalR-Client-Cpp-ci pipeline?

image

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LDFLAGS}")

find_package(cpprestsdk CONFIG REQUIRED)
set(CPPREST_LIB "cpprestsdk::cpprest")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent 24 minutes building/installing the cpprestsdk on my mac using ./submodules/vcpkg/vcpkg install cpprestsdk (thanks C++/Boost), but when I run cmake, I get the following error:

shalter@halter73-mbp build.Release (brecon/cmake% u=)$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake -DENABLE_TESTING=1 -DCMAKE_BUILD_TYPE=Release
CMake Error at CMakeLists.txt:18 (find_package):
  Could not find a package configuration file provided by "cpprestsdk" with
  any of the following names:

    cpprestsdkConfig.cmake
    cpprestsdk-config.cmake

  Add the installation prefix of "cpprestsdk" to CMAKE_PREFIX_PATH or set
  "cpprestsdk_DIR" to a directory containing one of the above files.  If
  "cpprestsdk" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!
See also "/Users/shalter/source/aspnet/SignalR-Client-Cpp/CMakeFiles/CMakeOutput.log".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same problem :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see the vcpkg folder on either (or both) of your machines

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the submodules/vcpkg directory? Mine is just what's in https://github.com/Microsoft/vcpkg/tree/d1110ceb7feb527ac58f274239d435e32dca4b84 without changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a bare minimum you should have a new file vcpkg that's runnable on your machine. But more importantly I'm looking for the submodules/vcpkg/installed folder.

@@ -0,0 +1,201 @@
Apache License
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pilchie Could you verify that this is the correct License file?

Copied it from https://github.com/aspnet/AspNetCore

@BrennanConroy
Copy link
Member Author

@halter73 @anurse @mikaelm12
I'd like approval so I can start iterating on other work!

@@ -3,3 +3,41 @@
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at https://github.com/aspnet/AspNetCore.

Use https://github.com/aspnet/AspNetCore/issues for issues with this project.

### Build on Windows ###
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention dependencies that need to be installed on non-macOs platform like cmake for Windows and cmake/"build-essentials"/gcc/g++ on linux.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to gather that info and improve the readme at a later time.

@halter73
Copy link
Member

halter73 commented Jul 3, 2019

I wanted to approve this last night, but I couldn't get the cpprestsdk installed on my Windows machine. Here's the output:

Elapsed time for package boost-integer:x86-windows: 3.129 s
Starting package 19/63: boost-system:x86-windows
Building package boost-system[core]:x86-windows...
-- Using cached F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/downloads/boostorg-system-boost-1.69.0.tar.gz
-- Using source at F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/src/ost-1.69.0-9d1d01900c
-- Building x86-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:56 (message):
    Command failed: F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/tools/boost-build/b2.exe;--stagedir=F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/x86-windows-rel/stage;--build-dir=F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/x86-windows-rel;--user-config=F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/x86-windows-rel/user-config.jam;-j8;--debug-configuration;--debug-building;--debug-generators;--disable-icu;--ignore-site-config;--hash;-q;-sZLIB_INCLUDE="F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/include";-sBZIP2_INCLUDE="F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/include";threading=multi;threadapi=win32;runtime-link=shared;link=shared;address-model=32;architecture=x86;toolset=msvc-14.1;-sZLIB_BINARY=zlib;-sZLIB_LIBPATH="F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/lib";-sBZIP2_BINARY=bz2;-sBZIP2_LIBPATH="F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/lib";variant=release;debug-symbols=on
    Working Directory: F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/src/ost-1.69.0-9d1d01900c/build
    Error code: 1
    See logs for more information:
      F:\dev\aspnet\SignalR-Client-Cpp\submodules\vcpkg\buildtrees\boost-system\build-x86-windows-rel-out.log

Call Stack (most recent call first):
  installed/x86-windows/share/boost-build/boost-modular-build.cmake:270 (vcpkg_execute_required_process)
  ports/boost-system/portfile.cmake:14 (boost_modular_build)
  scripts/ports.cmake:71 (include)


Error: Building package boost-system:x86-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: boost-system:x86-windows
  Vcpkg version: 2018.11.23-nohash

Additionally, attach any relevant sections from the log files above.

And here's the contents of boost-system\build-x86-windows-rel-out.log:

notice: found boost-build.jam at F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/tools/boost-build/boost-build.jam
notice: loading Boost.Build from F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/tools/boost-build/src/kernel
notice: Site configuration files will be ignored due to the
notice: --ignore-site-config command-line option.
notice: Loading explicitly specified user configuration file:
    F:\dev\aspnet\SignalR-Client-Cpp\submodules\vcpkg\buildtrees\boost-system\x86-windows-rel\user-config.jam
notice: Searching 'F:\dev\aspnet\SignalR-Client-Cpp\submodules\vcpkg\buildtrees\boost-system\x86-windows-rel' for user-config configuration file 'user-config.jam'.
notice: Loading user-config configuration file 'user-config.jam' from 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/buildtrees/boost-system/x86-windows-rel'.

warning: Did not find command for MSVC toolset. If you have Visual Studio 2017 installed you will need to specify the full path to the command, set VS150COMNTOOLS for your installation, or build from the 'Visual Studio Command Prompt for VS 2017'.

notice: will use 'cl.exe' for msvc, condition <toolset>msvc
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>', setup: 'x86'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>32', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>32', setup: 'x86'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>', setup: 'x86'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>32', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>32', setup: 'x86'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>64', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>/<address-model>64', setup: 'amd64'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>64', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>x86/<address-model>64', setup: 'amd64'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>ia64/<address-model>', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>ia64/<address-model>', setup: 'x86_ia64'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>ia64/<address-model>64', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>ia64/<address-model>64', setup: 'x86_ia64'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>arm/<address-model>', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>arm/<address-model>', setup: 'x86_arm'
notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>arm/<address-model>32', setup: 'F:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/installed/x86-windows/share/boost-build/nothing.bat' notice: [msvc-cfg] condition: '<toolset>msvc/<architecture>arm/<address-model>32', setup: 'x86_arm'
notice: [cmdline-cfg] toolset msvc-14.1 not previously configured; attempting to auto-configure now
error: msvc initialization: parameter 'version' inconsistent
error: no value was specified in earlier initialization
error: an explicit value is specified now

I don't have VS 2017 installed. Do you think that's the problem? I do have VS 2019 RTM and Preview installed. Now they're both even on the system/C drive.

@halter73
Copy link
Member

halter73 commented Jul 3, 2019

I installed VS 2017 and still see the same issue.

@halter73
Copy link
Member

halter73 commented Jul 3, 2019

I tried this on another Windows PC with VS 2017 and 2019. I was able to install the cpprestsdk (don't know why though), but I got stuck on the first cmake command:

C:\dev\aspnet\SignalR-Client-Cpp\build.release [master ≡]> ."C:\dev\aspnet\SignalR-Client-Cpp\submodules\vcpkg\downloads\tools\cmake-3.12.4-windows\cmake-3.12.4-win32-x86\bin\cmake.exe" .. -A x64 -DCMAKE_TOOLCHAIN_FILE=..\submodules\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
CMake Error: The source directory "C:/dev/aspnet/SignalR-Client-Cpp/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" is a file, not a directory.
Specify --help for usage, or press the help button on the CMake GUI.

Maybe we should try building this repo on a fresh VM (could this would be a good use for the new windows 10 sandbox?), so we know what the actual dependency.

Building worked fine on my macOS and linux machines though.

@halter73
Copy link
Member

halter73 commented Jul 3, 2019

It looks like the issue with installing the cpprestsdk on windows can be fixed by updating vcpkg.

microsoft/vcpkg#5302

@BrennanConroy
Copy link
Member Author

I don't think VS2017 is required, however if you have 2019 you might need to install the v141 toolset.

When you installed VS2017 did you follow the message from the warning?

"warning: Did not find command for MSVC toolset. If you have Visual Studio 2017 installed you will need to specify the full path to the command, set VS150COMNTOOLS for your installation, or build from the 'Visual Studio Command Prompt for VS 2017'."

@halter73
Copy link
Member

halter73 commented Jul 3, 2019

When you installed VS2017 did you follow the message from the warning?

No, because I was hoping VS2017 wouldn't be necessary. I can try it, but maybe we should just upgrade vcpkg instead.

@BrennanConroy BrennanConroy merged commit b23a75e into master Jul 5, 2019
@BrennanConroy BrennanConroy deleted the brecon/cmake branch July 5, 2019 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make SignalR C++ tests output test results to AzP
4 participants