Skip to content

Make cmake work better - #26

Open
Justasic wants to merge 2 commits into
NotUnlikeTheWaves:developmentfrom
Justasic:cmake-fixes
Open

Make cmake work better#26
Justasic wants to merge 2 commits into
NotUnlikeTheWaves:developmentfrom
Justasic:cmake-fixes

Conversation

@Justasic

@Justasic Justasic commented Aug 17, 2017

Copy link
Copy Markdown
Collaborator

I have added some stuff to make cmake work a bit better between not just linux distributions but also on windows if you decide to port the project to windows.

The following fixes were made:

  • CMake now tries to find boost, curl, and the required threading dependencies itself (curl was actually a missing dependency)
  • CMake now downloads the latest version of nlohmann/json automatically on configure so the local version can be removed from the repository.
  • Disallowed source directory builds (because those are messy) and instead encourage you make a build directory
  • Made CMake determine what C++ flags we use for setting the C++11 standard, this guarantees that cmake always uses C++11 or fails to configure.
  • I was forced to change the CMake required version to 3.1.3 because of the C++ standard stuff above. Most systems that support C++11 also have cmake 3.1.3 or higher

@NotUnlikeTheWaves NotUnlikeTheWaves left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

woah, cool stuff.

Comment thread CMakeLists.txt Outdated
# Download JSON.hpp
if (NOT EXISTS ${CMAKE_BINARY_DIR}/external/json/json.hpp)
message(STATUS "Downloading nlohmann's json.hpp library...")
file(DOWNLOAD https://raw.githubusercontent.com/nlohmann/json/develop/src/json.hpp ${CMAKE_BINARY_DIR}/external/json/json.hpp SHOW_PROGRESS)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Perhaps it's an option to get it from the master branch?

Comment thread CMakeLists.txt Outdated
find_package(Threads REQUIRED)

# Disable tests for JSON
set(BuildTests OFF CACHE INTERNAL "" FORCE)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

not review related but I this can be deleted if I'm correct, since nlohmann/json is only used as its raw header file instead of full repo w/ CMakeLists.txt.

@Justasic

Copy link
Copy Markdown
Collaborator Author

I found some new CMake code that lets me clone the whole nlohmann repo via ExternalProject as part of the build process and not build their cmake file. This will work better instead of the weird file download. I didn't do that before because ExternalProject wants to build nlohmann's tests and I didn't know how to disable it.

@NotUnlikeTheWaves

NotUnlikeTheWaves commented Aug 18, 2017

Copy link
Copy Markdown
Owner

originally I moved away from cloning nlohmann because it takes up a 200mb download (and disk space), most of it tests and benchmarks.

I accidentally closed this, so that's what's the close/reopen is.

@Justasic

Copy link
Copy Markdown
Collaborator Author

I'll see if I can make it so it only does a clone of one depth of history. If it's still too much I can just make it download like it does now. I misunderstood the original comment, I can add an option to download from the master branch (or any branch I guess for that matter)

@NotUnlikeTheWaves

Copy link
Copy Markdown
Owner

I meant it more that the master branch I expect to be more stable than the develop branch. If a shallow clone doesn't result in much disk usage I'm fine with that, too

@Justasic
Justasic force-pushed the cmake-fixes branch 6 times, most recently from bd801f0 to 8a5e842 Compare August 28, 2017 09:39
Justin Crawford and others added 2 commits August 28, 2017 12:19
Make cmake figure out stuff instead of us figuring it out for cmake,
     allowing us to compile on other platforms with more ease.
Added curl as a requirement in CMake.
Fixed finding threading for both C++11 and boost in cmake.
Download nlohmann's json library instead of keeping a local copy.
…date.

Websocketpp has updated and brought some bug fixes on their develop
branch which fixed a lot of issues with systems that had newer
openssl installations. (Fixes builds on my arch system)
@Justasic
Justasic force-pushed the cmake-fixes branch 2 times, most recently from 1560266 to fd185c2 Compare August 28, 2017 12:28
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.

2 participants