Comments (15)
Ok so I think I found an acceptable solution, which doesn't require modifying the xsimd library @ToKiNoBug
For short, with cmake <3.28 you’d use :
include(FetchContent)
FetchContent_Declare(
xsimd
GIT_REPOSITORY [email protected]:xtensor-stack/xsimd.git
GIT_TAG 11.1.0
GIT_SHALLOW ON
)
FetchContent_GetProperties(xsimd)
if(NOT xsimd_POPULATED)
FetchContent_Populate(xsimd)
add_subdirectory(${xsimd_SOURCE_DIR} ${xsimd_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
And with cmake >= 3.28 we’ll be able to use this syntax :
include(FetchContent)
FetchContent_Declare(
xsimd
GIT_REPOSITORY [email protected]:xtensor-stack/xsimd.git
GIT_TAG 11.1.0
GIT_SHALLOW ON
# Other content options...
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(xsimd)
If you want more details it all relies on the EXCLUDE_FROM_ALL
flag of the FetchContent functions. You can check this StackOverflow post and the CMake Discourse post mentionned earlier
from xsimd.
Thanks for using xsimd :-) PR welcome!
from xsimd.
@ToKiNoBug I actually need to install xsimd alongside my project, because it's a library with xsimd needed in the headers. So I actually use the behaviour you wanna get rid of.
Do you think it could be possible to add an option to keep it ? Or should I rather use a cmake feature I'm not aware of ?
(sorry for the question but I'm recently struggling a lot with modern cmake setup)
from xsimd.
@ToKiNoBug I actually need to install xsimd alongside my project, because it's a library with xsimd needed in the headers. So I actually use the behaviour you wanna get rid of.
Do you think it could be possible to add an option to keep it ? Or should I rather use a cmake feature I'm not aware of ? (sorry for the question but I'm recently struggling a lot with modern cmake setup)
Ofcourse, it' really easy to implement. But I'm not sure what the default behavior should be like. When used as subproject, should we skip installation by default?
from xsimd.
Do you think it could be possible to add an option to keep it ? Or should I rather use a cmake feature I'm not aware of ? (sorry for the question but I'm recently struggling a lot with modern cmake setup)
I have dig into this problem but I found indeed there is no such cmake feature. The installation behavior of subprojects can not be controlled by parent project, unless the subproject provide an option to do it.
from xsimd.
@ToKiNoBug I actually need to install xsimd alongside my project, because it's a library with xsimd needed in the headers. So I actually use the behaviour you wanna get rid of.
Do you think it could be possible to add an option to keep it ? Or should I rather use a cmake feature I'm not aware of ? (sorry for the question but I'm recently struggling a lot with modern cmake setup)
Ofcourse, it' really easy to implement. But I'm not sure what the default behavior should be like. When used as subproject, should we skip installation by default?
I would say this should depends on the PUBLIC / PRIVATE / INTERFACE dependency type you declared. Imo both public and interface should make sure your dependency is installed alongside your project, whereas private should not.
But I'm not sure this is the actual behaviour of cmake. In which cas are you ?
from xsimd.
I would say this should depends on the PUBLIC / PRIVATE / INTERFACE dependency type you declared. Imo both public and interface should make sure your dependency is installed alongside your project, whereas private should not.
But I'm not sure this is the actual behaviour of cmake. In which cas are you ?
Usually I use external projects privately, but this time I decide to leave the default behavior unchanged. I will add an option named XSIMD_SKIP_INSTALL
, the default value is OFF
. If anyone like me don't want to install xsimd files, just set this option to ON before introducing xsimd.
from xsimd.
I would say this should depends on the PUBLIC / PRIVATE / INTERFACE dependency type you declared. Imo both public and interface should make sure your dependency is installed alongside your project, whereas private should not.
But I'm not sure this is the actual behaviour of cmake. In which cas are you ?Usually I use external projects privately, but this time I decide to leave the default behavior unchanged. I will add an option named
XSIMD_SKIP_INSTALL
, the default value isOFF
. If anyone like me don't want to install xsimd files, just set this option to ON before introducing xsimd.
I'm not sure to understand, in your target_link_libraries
did you declared xsimd as a public, private or interface dependency ? (I'm curious)
from xsimd.
I'm not sure to understand, in your
target_link_libraries
did you declared xsimd as a public, private or interface dependency ? (I'm curious)
Yes, for examlpe, when distributing shared libs or executables.
from xsimd.
I'm not sure to understand, in your
target_link_libraries
did you declared xsimd as a public, private or interface dependency ? (I'm curious)Yes, for examlpe, when distributing shared libs or executables.
Sorry, I was not clear. Which one of these (PUBLIC / PRIVATE / INTERFACE) are you using when you're having "unwanted" installation of xsimd ?
from xsimd.
I'm not sure to understand, in your
target_link_libraries
did you declared xsimd as a public, private or interface dependency ? (I'm curious)Yes, for examlpe, when distributing shared libs or executables.
Sorry, I was not clear. Which one of these (PUBLIC / PRIVATE / INTERFACE) are you using when you're having "unwanted" installation of xsimd ?
PRIVATE. For me, xsimd headers are not required by my public headers. I am developing an application instead of library, so I only need to distribute executables and shared libs, there is no need to distribute internal headers to users.
from xsimd.
Ok, so I would also assume Cmake should not install xsimd alongside your binaries 🤔
Might be interesting to ask more experienced folks on the CMake discourse forum about how they think we should handle this. I'll try to do so later in the week.
from xsimd.
I asked the question on CMake discourse, I'll let you know what they think
from xsimd.
I asked the question on CMake discourse, I'll let you know what they think
I look forward for official opinons, but I think maybe you have paid too much attention on linkage type or library type, they are not that important.
In my opinon, it is the type of software(app or lib) that decides whether a subproject should be installed. xsimd can never guess whether it should be installed, so we need an option to control.
However, the default behavior is still worth to be disgussed.
from xsimd.
Since #972 got merged, I think we can close this bug, @ToKiNoBug
from xsimd.
Related Issues (20)
- Build failure on ARM v8 with SVE (`neoverse_v1`) architecture HOT 4
- Obsolete the `version()` method from register description
- Change representation of instruction set extensions HOT 1
- error: no member named 'bitwise_rshift' in namespace 'xsimd' HOT 4
- Any plans to add support for element-wise max? HOT 2
- When would xsimd has next new Release? HOT 4
- xtensor triggers xsimd error on arm64: <bool, xsimd::neon64> usage of batch type with unsupported type HOT 8
- Wrong rounding mode in nearbyint_as_int testcase
- riscv64, s390x error: ‘aligned_mode’ in namespace ‘xsimd’ does not name a type; did you mean ‘aligned_free’? HOT 3
- CHECK_EQ( extract(xsimd::polar(T(val0), T(val1))), std::polar(val0, val1) ) is NOT correct! HOT 3
- Doc search doesn't work HOT 2
- Over branching creation due to specialisation choices HOT 2
- `xsimd::exp` broken on aarch64 and GCC 10.2.1 with `--fast-math` HOT 1
- How to implement an expand function / scatter for masks? HOT 9
- Build failure on armv7l-linux and riscv64-linux (11.2.0, 12.0.0) (`error: 'batch_bool_cast' was not declared in this scope`) HOT 2
- Build failure on armv7a-linux with >=xsimd-11.2.0 HOT 2
- pow broken for 0^(-x) HOT 1
- scalar implementation without code duplication HOT 4
- ppc64el fails with clang : too few template arguments for class template 'batch' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xsimd.