AnyarInc / Ascent

A fast and flexible C++ simulation engine and differential equation solver.
Apache License 2.0
123 stars 15 forks source link

cmake doesn't build anything #3

Closed yurivict closed 4 years ago

yurivict commented 5 years ago

With BUILD_EXAMPLES=OFF BUILD_UNIT_TESTS=OFF I am getting

-- Build files have been written to: /usr/ports/math/ascent/work/.build
===>  Building for Ascent-0.3.0.11
ninja: no work to do.
===>  Staging for Ascent-0.3.0.11
===>   Generating temporary packing list
ninja: error: unknown target 'install/strip'
*** Error code 1
stephenberry commented 5 years ago

Because this is a header only library, if you do not built examples or unit tests, then you have nothing to build. Just include the path to the Ascent "include" directory in your project and use the files directly.

yurivict commented 5 years ago

It doesn't install anything. Even a headers-only library needs to install headers.

stephenberry commented 5 years ago

I'm not sure your use case, but usually it is your project's CMake file that will have a line like: include_directories(../Ascent/include)

This will then allow you to use the Ascent headers in your project. You could also go into your IDE's properties and include the folder.

yurivict commented 5 years ago

For packaging it's optimal to have cmake install the headers into a standard location. See for example, Eigen3.

stephenberry commented 5 years ago

I could certainly add something like that. But, it is simply creating another copy of the files and requiring the use of calling CMake whenever the repository is pulled. I tend to find it a better practice to clone repositories to common locations or locations specific to a project, in this way there is no need to run CMake with updates and the files aren't duplicated. How important to your process is the specification of an install path?

yurivict commented 5 years ago

cmake has a standard instruction for installing files. See here, for example: https://stackoverflow.com/questions/10487256/cmake-how-to-properly-copy-static-librarys-header-file-into-usr-include

yurivict commented 4 years ago

This issue hasn't been properly resolved.

usually it is your project's CMake file that will have a line like: include_directories(../Ascent/include)

The above isn't true. In order to properly create a package the project needs to install its files. In your case, installing means copying files into ${DESTDIR}${PREFIX}/include/... cmake has instructions for this.

mwalcott3 commented 4 years ago

Pull request #7 should fix this issue.

If it is accepted you should be able install ascent and use it like this:

find_package(ascent REQUIRED)
...Other stuff...
target_link_libraries(${PROJECT_NAME} ascent::ascent)