Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 967F0200D0D for ; Fri, 25 Aug 2017 21:08:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9521C16D180; Fri, 25 Aug 2017 19:08:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB91716D17C for ; Fri, 25 Aug 2017 21:08:41 +0200 (CEST) Received: (qmail 89940 invoked by uid 500); 25 Aug 2017 19:08:39 -0000 Mailing-List: contact dev-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mesos.apache.org Delivered-To: mailing list dev@mesos.apache.org Received: (qmail 89923 invoked by uid 99); 25 Aug 2017 19:08:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Aug 2017 19:08:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id ACC991A244F for ; Fri, 25 Aug 2017 19:08:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.328 X-Spam-Level: X-Spam-Status: No, score=-1.328 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_SOFTFAIL=0.972] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id p7LhNkNsBxmf for ; Fri, 25 Aug 2017 19:08:36 +0000 (UTC) Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 5C8305F3D0 for ; Fri, 25 Aug 2017 19:08:36 +0000 (UTC) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 3xf9g74B0zz10HX; Fri, 25 Aug 2017 21:08:35 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 25 Aug 2017 12:08:35 -0700 From: andrew@schwartzmeyer.com To: dev@mesos.apache.org Cc: vinodkone=apache.org@schwartzmeyer.com, Vinod Kone Subject: Re: CMake build refactoring In-Reply-To: References: <899a9ecdea3811f7dd60b12046203a95@posteo.net> Message-ID: <18703f21aeb4f45316a368463c63ba76@posteo.net> X-Sender: andrew@schwartzmeyer.com User-Agent: Posteo Webmail archived-at: Fri, 25 Aug 2017 19:08:42 -0000 I have the Java libraries building now on both Linux and Windows (though the initial setup on Windows is a bit annoying to get all the tools in the right place, I'd like to follow up this chain with a `docs/cmake.md` with all the odd little bits of information). I also enabled the ZooKeeper unit tests (which I needed in order to integration test the patches that went upstream to ZooKeeper to give their C Client library a CMake build, too). Furthermore, with the Java library, I've successfully run Marathon against CMake built Mesos libraries on Linux. I do not have the Python libraries building yet, and there is a "Java examples" library that is not yet built. I'll make sure to file issues to update these. Joe is working to update the Mesosphere CI, I will check with him about updating `docker-build.sh`. Thanks Vinod! On 08/25/2017 11:59 am, Vinod Kone wrote: > This is great to hear. Thanks for your perseverance on making this > happen > Andy! > > Btw, do we build Java and Python libraries too now? > > Once we land the CMake changes, lets make sure to update > `support/docker-build.sh` to make sure it is continuously being tested > on > our CI. > > On Fri, Aug 25, 2017 at 11:47 AM, wrote: > >> Hello Mesos developers, >> >> I wanted to take the time to announce a (long) patch chain that fixes >> up >> the CMake build system. There were a lot of open bugs due to the >> initial >> design (and constraints of CMake 2), and by moving to CMake 3, I was >> able >> to rewrite the CMake build in a target-based dependency graph manner >> (the >> way CMake is meant to be used). >> >> The very end of the chain is here: https://reviews.apache.org/r/61753/ >> >> Joseph Wu is currently shepherding it. That final patch includes the >> what >> and the why explanation of this patch series. >> >> My main guideline in this effort was MESOS-3576, which pointed out the >> incorrectness of the link flags generated by CMake. This has been >> resolved, >> and moreover, a significant amount of superfluous CMake code was >> deleted >> (that final patch was about a 4 to 1 ratio of deletions to adds). >> >> I took a two-phase approach to this reworking. The first phase >> imported >> all of our third party dependencies correctly. Instead of linking to >> these >> dependencies by manually including their various include/library >> directories and compilation/link flags, each dependency was added to >> the >> CMake graph as an imported target. All necessary information for >> linking to >> the dependency is recorded in its target, and used is transitively >> passed >> to targets which take it as dependency by CMake. Adding a new >> dependency is >> now relatively simple, with many easy-to-replicate patterns available >> in >> 3rdparty/CMakeLists.txt. >> >> An important note is that this was also done for header-only >> libraries, >> including stout. CMake 3 has a notion of "interface libraries" where a >> header-only library can be represented as a CMake target like any >> other >> library. With this done correctly, linking stout to boost is as simple >> as >> `target_link_libraries(stout boost)`, and linking libprocess to stout >> is >> `target_link_libraries(process stout)`, and the boost dependency is >> understood transitively. >> >> The second phase was refactoring the Mesos build itself (that is, not >> the >> third party dependencies). With all our dependencies imported >> properly, I >> was able to delete the files of extraneous information such as >> `MasterConfigure.cmake`, `AgentConfigure.cmake`, etc. This information >> is >> instead correctly stored in the aforementioned CMake dependency graph. >> >> With this all put together, the entirety of the required CMake code to >> build the agent executable, on all platforms, is the following _two >> lines_: >> >> add_executable(mesos-agent main.cpp) >> target_link_libraries(mesos-agent PRIVATE mesos) >> >> All necessary link and compilation flags are parsed by CMake through >> the >> dependency graph as it visits libmesos as the mesos-agent dependency. >> >> I keep an updated tree on GitHub here for easy testing: >> https://github.com/andschwa/mesos/blob/cmake-refactor/src/sl >> ave/CMakeLists.txt >> >> As we move closer to deprecating Autotools, I wanted to ensure that >> the >> replacement build system was as correct and easy-to-use as possible. >> As >> with any build system (and any software engineering effort), there is >> always more to clean up and improve. However, I am satisfied with the >> result of my efforts, and I hope this build system makes your work as >> developers easier. If you have the time, please take a look at the the >> patches and give it a test. Let me know know I can make it work better >> for >> you. >> >> Thank you, >> >> Andrew Schwartzmeyer >>