Depending on llvm-config allows for a few nice things (auto-detecting LLVM source tree, version numbers, etc), but it's makes bootstrapping a pain. Keep the llvm-config features around, but also fall back to being able to configure based on -DLLVM_MAIN_SRC_DIR=path/to/llvm.
Details
Diff Detail
Event Timeline
Seems to work fine for me, modulo having to set -std=c++11 manually in the CXXFLAGS, which is automatically set in libcxx and could be here too.
One issue is that, if there is a llvm-config executable in the path, it tried to use that, which I want to prevent (this happened to me while trying to rebuild with different options - libcxxabi wasn't installed anymore, but llvm-config depending on it still was).
Also, for some reason passing in CMAKE_SHARED_LINKER_FLAGS didn't work. Any idea why?
Never mind, it just put it in a different place that I expected it to. Fixed by using LIBCXXABI_CXX_ABI_LIBRARIES instead.
Well, if there's an invalid llvm-config on your system, you should probably remove llvm-config :) I think I can probably just reorder the if/elseif and get the behavior you want though, but that might cause issues with rerunning cmake on an already configured directory.
Interesting. Outside the realm of this patch, but I'll fix that too.
Well, if there's an invalid llvm-config on your system, you should probably remove llvm-config :) I think I can probably just reorder the if/elseif and get the behavior you want though, but that might cause issues with rerunning cmake on an already configured directory.
It's only invalid while rebuilding libcxxabi though, it'll work again just fine after ;)
Interesting. Outside the realm of this patch, but I'll fix that too.
Thanks!
Can't test because the machine I was testing on is currently rebuilding it's file system. But from reading the commit LGTM.
Keno, PTAL. I've fixed the following things in this revision:
- Allow the user to specify a specific LLVM tree even if llvm-config is on their system.
- Had accidentally removed LLVM_BINARY_DIR for llvm-config path, preventing it from finding the cmake files.
- Fixed behavior for re-running cmake in already configured directory.
I've verified that either path works (even under a re-run of cmake) and can correctly find the cmake files, build and run LIT.
If everything works for you, please approve and I'll commit it.
It ran though fine the first time, but I tried reconfiguring and I got:
cd libcxxabi-build && \ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/home/kfischer/julia-test/usr -DLLVM_PATH:PATH=/home/kfischer/julia-test/deps/llvm-svn -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/kfischer/julia-test/usr ../llvm-svn/projects/libcxxabi -DCMAKE_C_COMPILER="clang" -DCMAKE_CXX_COMPILER="clang++" -DLIBCXXABI_CXX_ABI_LIBRARIES="" -DCMAKE_CXX_FLAGS="-fno-stack-protector -cxxlib-nostd -static-intel -std=c++11" -- Configuring done You have changed variables that require your cache to be deleted. Configure will be re-run and you may have to reset some variables. The following variables have changed: CMAKE_C_COMPILER= clang CMAKE_CXX_COMPILER= clang++ -- The C compiler identification is -- The CXX compiler identification is -- Check for working C compiler: /home/kfischer/clang/bin/clang -- Check for working C compiler: /home/kfischer/clang/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /home/kfischer/clang/bin/clang++ -- Check for working CXX compiler: /home/kfischer/clang/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at CMakeLists.txt:49 (message): llvm-config not found and LLVM_MAIN_SRC_DIR not defined `` any ideas?
I think you need to not specify -DCMAKE_C(XX)?_COMPILER on the second run.
Cmake doesn't let you change compiler after the first run. Even though
you're configuring it as the same compiler, it might just reject those
options on a rerun.