Commit graph

120 commits

Author SHA1 Message Date
Martin Kinkelin
48dc005c88 CMake: Fix hacky way of determining LLVM libs for jit-rt
Fixing issues like #3079 and the recent regression with Ubuntu 19.10 and
its LLVM 9 (CircleCI).
2019-10-21 00:46:47 +02:00
Johan Engelen
a5c453f766 Fix CMake configuring with LLVM 10 (current trunk) 2019-10-16 22:53:46 +02:00
Martin Kinkelin
f4c7623205
CMake: Fix regression for make (#3191)
Fixes #3188.
2019-10-16 22:33:23 +02:00
Martin Kinkelin
dd04ea5191 Don't link ldc-build-runtime and ldc-prune-cache against LLVM libs 2019-09-29 16:26:30 +02:00
Martin Kinkelin
30a14659a1 CMake: Use add_executable() for LDC_LINK_MANUALLY
Letting CMake link the executable instead of really invoking the C++
compiler manually. This simplifies cross-compilation with CMake
toolchain files, such as for Android.
2019-09-29 15:20:04 +02:00
Martin Kinkelin
3f7cf75200 CMake: Drop detection of unsupported ldc2 and gdc host compilers 2019-07-28 02:37:39 +02:00
Moritz Maxeiner
77d8a7b68a Support building with gdmd host compiler 2019-06-09 02:49:23 +02:00
Martin Kinkelin
5ab43e95e0 Parallelize compilation of LDC D unittests
This serial step (unless using explicit -DCOMPILE_D_MODULES_SEPARATELY=ON,
which may decrease LDC performance due to missing cross-module
optimizations) used to take more than 4 minutes for Shippable...
2019-03-02 19:54:36 +01:00
Martin Kinkelin
8bd540e114 CMake: Find LLVMSPIRVLib library if built in-tree 2019-03-02 19:54:36 +01:00
Martin Kinkelin
e445d9e03e CMake: Add option COMPILE_D_MODULES_SEPARATELY
And enable it for 1st Shippable build, decreasing the build time by a
very rough 3 minutes.
2018-11-17 14:29:55 +01:00
Martin Kinkelin
0e00487efe FindLLVM.cmake: Add llvm-config for v7.0 and v8.0 2018-11-02 02:53:39 +01:00
Martin Kinkelin
c0d269d5d9 Support clang on Windows
E.g., via:

cmake -G Ninja -DCMAKE_C_COMPILER:PATH=clang-cl.exe
               -DCMAKE_CXX_COMPILER:PATH=clang-cl.exe
2018-10-26 23:57:03 +02:00
Martin Kinkelin
b19a22a998 Fix compilation issues on macOS with DMD host compiler >= 2.079
... due to its D `long` C++ mangling change.
2018-05-19 16:31:42 +02:00
Martin
fb7fd86d97 Merge branch 'master' into merge-2.079
Conflicts:
	runtime/druntime
	runtime/phobos
2018-04-21 16:01:26 +02:00
Johan Engelen
9609a9e845 Fix building on Solaris (#2639)
Resolves GH issue #2638  https://github.com/ldc-developers/ldc/issues/2638
2018-04-19 00:42:34 +02:00
Martin
025c69cc65 Merge branch 'master' into merge-2.079
Conflicts:
	appveyor.yml
	driver/main.cpp
	runtime/druntime
	runtime/phobos
2018-04-15 18:46:39 +02:00
Martin
a2808ec46e 64-bit OSX: Mangle [u]long as C++ [u]int64_t
This is a breaking ABI change and affects LDC itself as mixed D/C++ code
base. So we now need to check the front-end version of the D host
compiler and adapt the corresponding C++ types accordingly.
2018-04-13 21:13:38 +02:00
Martin
2d3deda639 CMake: Try to fix linking with the LLVMWindowsManifest library 2018-03-25 18:22:08 +02:00
Johan Engelen
6ff5433cc8
Make base LLVM version available in LDC code. (#2522) 2018-01-21 14:12:19 +01:00
Johan Engelen
f338b559ff CMake: use llvm-config to determine LLVM's cmake directory, if possible.
This should fix https://github.com/NixOS/nixpkgs/issues/33127
2018-01-05 17:30:32 +01:00
kinke
f4038aab7c Merge pull request #2279 from kinke/cmake2
[MSVC] CMake: Prepare for LLVM 5.0
2017-08-19 21:58:13 +02:00
Nicholas Wilson
f27109c8e8 New spirv and 6.0 compilation fixes (#2276)
Update to a new SPIRV-LLVM and fix compilation issues for LLVM6.0
2017-08-18 15:23:56 +08:00
Martin
acfa2dfb1c [MSVC] CMake: Prepare for LLVM 5.0
Some LLVM libs were missing from the linker flags for current LLVM 5.0.
It was only during troubleshooting that I noticed the MSVC special case in
FindLLVM.cmake. Getting rid of it entirely made the issues disappear. I
checked llvm-config.exe, and it's returning appropriate switches for the
MS toolchain, no need for special processing.

This apparently also leads to LLVM_CXXFLAGS being used for the first time
when building with MSVC. These include /W4, a level further up from
CMake's default /W3, so I disabled a few more frequent warnings.

I also had to link in a lib from Microsoft's Debug Info Access SDK
manually. As the VS command prompt unfortunately doesn't even include the
DIA SDK dir in the LIBPATH environment variable, I even had to specify a
full path, relying on the `VSINSTALLDIR` environment variable.
2017-08-17 23:49:37 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Johan Engelen
704d95c54c CMake: fix LTO build: prevent applying LTO flags when building the runtime libraries.
Resolves issue #2082
2017-04-29 15:24:39 +02:00
kinke
1dfe11c961 Merge pull request #2030 from kinke/crossLib
Enable cross-static-lib generation for LLVM 3.9+
2017-04-08 20:25:13 +02:00
Joseph Rushton Wakeling
f457ab78a2 Add option to avoid recursing in get_git_head_revision cmake function
Since this function is only ever invoked from the base directory of the
LDC source tree, it does not need to recurse in order to get the correct
git revision for LDC.  This patch therefore adds a parameter that can be
set to `TRUE` or `FALSE` depending on whether one wants to use recursion
or not, and sets it to false in when calling `get_git_head_revision` in
LDC's own `CMakeLists.txt`.

This should prevent issues that arise when building from source tarballs
that have been extracted into a subdirectory of another git tree (!).
This is unfortunately a real possibility: apart from folks using git to
version their home directory [1], it has also proven an issue when using
source tarballs to build the LDC snap package [2].

[1]42946460
[2]https://github.com/ldc-developers/ldc2.snap/issues/21#issuecomment-287575769

Fixes https://github.com/ldc-developers/ldc/issues/2042.
2017-03-30 01:37:41 +02:00
Johan Engelen
fd84666def Travis LLVM 4.0 + CircleCI LLVM trunk (#2031)
* Travis: add LLVM 4.0 testing

* CMake: remove the `-Wstring-conversion` cxxflag, added in LLVM 4.0, that is not recognized by gcc-4.9 on Travis.

* CircleCI: With Travis testing 4.0, move CircleCI back to testing LLVM trunk
2017-03-19 13:12:17 +01:00
Martin
ad3294b3ae Enable cross-static-lib generation for LLVM 3.9+
By directly integrating LLVM's `llvm-lib.exe` driver to generate static
libs for MSVC targets and a stripped-down version of the `llvm-ar` tool
for the other targets.

Introduce command-line option `-archiver=<file>` to allow the user to
specify an external archiver to be invoked.
2017-03-12 03:56:46 +01:00
Martin
c5565d7955 Clean up FindLLVM.cmake a bit 2017-03-11 21:25:38 +01:00
Remi THEBAULT
031003dc68 cmake does not look for libconfig 2017-02-24 23:31:01 +01:00
Johan Engelen
305fcddd57 [CMake] Add option to build LDC using LTO: -DLDC_BUILD_WITH_LTO={OFF, ON, FULL, THIN}.
When LDC_BUILD_WITH_LTO is set, the script adds -flto switch for the C++ compiler and D compiler, but only if they can create an executable with it.

Tested on OSX with ThinLTO (both with and without ThinLTO LLVM build). Some extra work is probably needed on Linux. On Windows, it won't do anything as the cmdline flag checks will fail.
On Linux, we should also enable the thinlto cache if possible.
Quick measurements indicate ~3% percent increased performance for -O0 and -O3 compilation, and a ~20% ldc2 file size reduction. Future step is adding PGO ;-)
2017-02-04 16:03:57 +01:00
Johan Engelen
29f148778d [CMake] Add CheckDSourceCompiles.cmake macro that can check whether a piece of D code compiles with some optional compiler flags. 2017-01-25 22:54:55 +01:00
Johan Engelen
4e671e1ca3 Add support for LLVM 5.0 (current LLVM trunk) (#1985) 2017-01-25 20:36:20 +01:00
Johan Engelen
0e34826757 CMake: add version check to findLLVM (#1940) 2016-12-22 18:09:56 +01:00
Johan Engelen
23c1749937 For non-tagged commits, change version string to e.g. "1.1.0git-c693e26" (#1887)
Also appends "-dirty" to version string when the working copy is dirty.
2016-11-17 22:33:36 +01:00
Rainer Schuetze
cd4bc7cc02 fix build with LLVM 4.0: debuginfomsf needed by debuginfocodeview 2016-09-20 08:36:32 +02:00
Johan Engelen
d63d3794db [CMake] Add new LLVM versions to FindLLVM.cmake. 2016-09-04 12:47:34 +02:00
Johan Engelen
d8697cdcb0 [cmake] Remove code that tries to resolve "~" in host compiler variable passed by the user. It conflicts with -DD_COMPILER="dmd", which is much more important to support. 2016-08-08 16:47:45 +02:00
Johan Engelen
29d1a2037c [cmake] Fix passing of host compiler with relative path by ENV{DMD}. 2016-08-08 16:27:15 +02:00
Johan Engelen
dfbb930440 [cmake] Fix passing of host compiler flags with cmake -DD_COMPILER. 2016-08-08 16:26:22 +02:00
Johan Engelen
bd5c3b9b65 [cmake] Fix CMake for when multiple D_COMPILER_FLAGS are passed. 2016-08-08 16:22:03 +02:00
David Nadlinger
557a2562b5 cmake: Respect D_COMPILER_FLAGS when extracting linker flags
It is somewhat unclear whether the variable can actually be set
in a valid way at this point, though.
2016-07-27 00:25:23 +01:00
David Nadlinger
92db654c8b cmake: Directly use (g)cc for linking on Unix-like systems
This allows us to properly take CMAKE_EXE_LINKER_FLAGS into
account without running into gcc/ld layering issues.

GitHub: Fixes #1494, alternative fix for #1460.
2016-07-27 00:25:22 +01:00
David Nadlinger
dea2bfbfe0 cmake: Print useful message instead of regex error on invalid llvm-config 2016-07-26 18:49:05 +01:00
Johan Engelen
cc2f7c8121 Fix FindLLVM for LLVM 4.0 2016-07-19 17:47:59 +02:00
Kai Nacke
ed79298915 Merge pull request #1507 from redstar/cmakellvm
LLVM/MSVC: Use library path to search for LLVM libraries.
2016-05-20 23:04:43 +02:00
Kai Nacke
22e2928005 LLVM/MSVC: Use library path to search for LLVM libraries.
For MSVC each LLVM library was prefixed with the absolute path of the
library location. This leads to problems with the command line length.

This PR uses "-LIBPATH:" as link flag for the LLVM libraries and
only appends the suffix .lib to the library names.

It is important to handle the command line options in the right way.
Otherwise spaces in paths may be lost.

A special problem is the automatic conversion of linker options starting
with "-" to "/". If the linker argument does not start with "-" then the
argument is not considered as a link flag. On the other hand if "-" is
used then the prepending of "-L" for LDC does not generate a valid option.
2016-05-20 22:22:38 +02:00
Kai Nacke
41a9dcecea LLVM: Prevent linking error if linking against AMDGPU target.
As usual the AMDGPUUtils library is missing in the list of libraries.
2016-05-20 21:34:22 +02:00
Kai Nacke
4bc9610611 Revert "LLVM: Use /LIBPATH for MSVC"
This reverts commit f35b45b823.
2016-05-20 20:25:33 +02:00