Mercurial > projects > ldc
annotate CMakeLists.txt @ 1611:3f728445fc42
Merge DMD r277: bugzilla 3495 Segfault(typinf.c) instantiating D variadic...
bugzilla 3495 Segfault(typinf.c) instantiating D variadic function with
too few arguments.
---
dmd/expression.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:21 -0300 |
parents | 3adcb70700cb |
children | 18bbb1436153 |
rev | line source |
---|---|
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
1 project(ldc) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
2 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
3 cmake_minimum_required(VERSION 2.6) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
4 # actually, 2.4 will work, with a warning |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
5 # if we required 2.4, 2.6+ would switch to a compatibility mode and cause problems on 2.6+ specifics |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
6 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
7 include(FindPerl) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
8 if(NOT PERL) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
9 message(FATAL_ERROR "perl not found") |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
10 endif(NOT PERL) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
11 |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
12 include(FindPkgConfig) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
13 if(NOT PKG_CONFIG_FOUND) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
14 message(FATAL_ERROR "pkg-config not found") |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
15 else(NOT PKG_CONFIG_FOUND) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
16 pkg_search_module(LIBCONFIGPP libconfig++) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
17 if(NOT LIBCONFIGPP_FOUND) |
1139
d82cc6e5bb65
Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1129
diff
changeset
|
18 set(LIBCONFIG_CXXFLAGS "" CACHE STRING "libconfig++ compiler flags") |
d82cc6e5bb65
Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1129
diff
changeset
|
19 set(LIBCONFIG_LDFLAGS "" CACHE STRING "libconfig++ linker flags") |
d82cc6e5bb65
Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1129
diff
changeset
|
20 else(NOT LIBCONFIGPP_FOUND) |
d82cc6e5bb65
Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1129
diff
changeset
|
21 set(LIBCONFIG_CXXFLAGS ${LIBCONFIGPP_CFLAGS} CACHE STRING "libconfig++ compiler flags") |
d82cc6e5bb65
Fixed error when pkg-config couldn't find libconfig, allows user to set flags manually.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1129
diff
changeset
|
22 set(LIBCONFIG_LDFLAGS ${LIBCONFIGPP_LDFLAGS} CACHE STRING "libconfig++ linker flags") |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
23 endif(NOT LIBCONFIGPP_FOUND) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
24 endif(NOT PKG_CONFIG_FOUND) |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
25 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
26 |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
27 find_program(LLVM_CONFIG llvm-config ${LLVM_INSTDIR}/bin DOC "path to llvm-config tool") |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
28 # get llvm's install dir. a little hackish, we could do something like llvm-config --prefix, but this does as well |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
29 string(REPLACE "/bin/llvm-config" "" LLVM_DIR ${LLVM_CONFIG}) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
30 |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
31 set(LLVM_INSTDIR ${LLVM_DIR} CACHE PATH "LLVM installation directory" FORCE) |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
32 if(NOT LLVM_INSTDIR) |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
33 message(FATAL_ERROR "llvm not found") |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
34 endif(NOT LLVM_INSTDIR) |
749
db2dd9861600
Add basic CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
35 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
36 execute_process( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
37 COMMAND ${PERL_EXECUTABLE} ${LLVM_CONFIG} --host-target |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
38 OUTPUT_VARIABLE HOST_TARGET |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
39 OUTPUT_STRIP_TRAILING_WHITESPACE |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
40 ) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
41 execute_process( |
1021
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
42 COMMAND /bin/sh ${PROJECT_SOURCE_DIR}/find-alt-triple.sh ${HOST_TARGET} |
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
43 OUTPUT_VARIABLE HOST_ALT_TARGET |
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
44 OUTPUT_STRIP_TRAILING_WHITESPACE |
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
45 ) |
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
46 execute_process( |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
47 COMMAND ${PERL_EXECUTABLE} ${LLVM_CONFIG} --cxxflags |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
48 OUTPUT_VARIABLE LLVM_CXXFLAGS |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
49 OUTPUT_STRIP_TRAILING_WHITESPACE |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
50 ) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
51 execute_process( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
52 COMMAND ${PERL_EXECUTABLE} ${LLVM_CONFIG} --ldflags |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
53 OUTPUT_VARIABLE LLVM_LDFLAGS |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
54 OUTPUT_STRIP_TRAILING_WHITESPACE |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
55 ) |
1519
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
56 execute_process( |
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
57 COMMAND ${PERL_EXECUTABLE} ${LLVM_CONFIG} --includedir |
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
58 OUTPUT_VARIABLE LLVM_INCLUDEDIR |
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
59 OUTPUT_STRIP_TRAILING_WHITESPACE |
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
60 ) |
1105
cdb7e1167803
- Fixed building tango-user-ldc on x86-32.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
61 |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
62 set(D_VERSION 1 CACHE STRING "D language version") |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
63 set(PROGRAM_PREFIX CACHE STRING "prepended to ldc binary name") |
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
64 set(PROGRAM_SUFFIX CACHE STRING "appended to ldc binary name") |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
65 option(USE_BOEHM_GC "use the Boehm garbage collector internally") |
821
8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
785
diff
changeset
|
66 option(GENERATE_OFFTI "generate complete ClassInfo.offTi arrays") |
1558
3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1547
diff
changeset
|
67 option(USE_METADATA "use metadata and related custom optimization passes") |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
68 |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
69 if(D_VERSION EQUAL 1) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
70 set(DMDFE_PATH dmd) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
71 set(LDC_EXE ldc) |
1453 | 72 set(LDMD_EXE ldmd) |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
73 add_definitions(-DDMDV1) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
74 elseif(D_VERSION EQUAL 2) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
75 set(DMDFE_PATH dmd2) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
76 set(LDC_EXE ldc2) |
1453 | 77 set(LDMD_EXE ldmd2) |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
78 add_definitions(-DDMDV2) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
79 else(D_VERSION EQUAL 1) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
80 message(FATAL_ERROR "unsupported D version") |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
81 endif(D_VERSION EQUAL 1) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
82 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
83 file(MAKE_DIRECTORY |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
84 ${PROJECT_BINARY_DIR}/bin |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
85 ${PROJECT_BINARY_DIR}/${DMDFE_PATH} |
1065
dc576c7e4b1e
Fix to make sure to create gen/ in build dir and unbreak build with older perl
Frits van Bommel <fvbommel wxs.nl>
parents:
1064
diff
changeset
|
86 ${PROJECT_BINARY_DIR}/gen |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
87 ) |
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
88 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
89 # idgen and impcnvgen |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
90 set_source_files_properties( |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
91 ${DMDFE_PATH}/idgen.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
92 ${DMDFE_PATH}/impcnvgen.c |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
93 PROPERTIES LANGUAGE CXX |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
94 ) |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
95 add_executable(idgen ${DMDFE_PATH}/idgen.c) |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
96 add_executable(impcnvgen ${DMDFE_PATH}/impcnvgen.c) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
97 # cmake 2.4 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
98 set_target_properties( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
99 idgen impcnvgen PROPERTIES |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
100 LINKER_LANGUAGE CXX |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
101 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} |
1051
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1032
diff
changeset
|
102 COMPILE_FLAGS ${LLVM_CXXFLAGS} |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
103 ) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
104 get_target_property(IDGEN_LOC idgen LOCATION) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
105 get_target_property(IMPCNVGEN_LOC impcnvgen LOCATION) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
106 # |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
107 add_custom_command( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
108 OUTPUT |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
109 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
110 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
111 # 2.4 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
112 COMMAND ${IDGEN_LOC} |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
113 #COMMAND idgen |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
114 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
115 DEPENDS idgen |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
116 ) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
117 add_custom_command( |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
118 OUTPUT ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
119 # 2.4 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
120 COMMAND ${IMPCNVGEN_LOC} |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
121 #COMMAND impcnvgen |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
122 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
123 DEPENDS impcnvgen |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
124 ) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
125 set(LDC_GENERATED |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
126 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
127 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
128 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
129 ) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
130 # idgen and impcnvgen done |
749
db2dd9861600
Add basic CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
131 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
132 set(DEFAULT_TARGET ${HOST_TARGET} CACHE STRING "default target") |
1021
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
133 set(DEFAULT_ALT_TARGET ${HOST_ALT_TARGET} CACHE STRING "default alt target") |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
134 |
1519
6182ceeb336a
LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k.
Christian Kamm <kamm incasoftware de>
parents:
1518
diff
changeset
|
135 include_directories(. ${DMDFE_PATH} ${DMDFE_PATH}/root ${PROJECT_BINARY_DIR}/${DMDFE_PATH} ${PROJECT_BINARY_DIR} ${LLVM_INCLUDEDIR}) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
136 |
1518
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
137 set(EXTRA_LLVM_MODULES "" CACHE STRING "extra llvm components to link in (see llvm-config --components)") |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
138 separate_arguments(EXTRA_LLVM_MODULES) |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
139 execute_process( |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
140 COMMAND ${PERL_EXECUTABLE} ${LLVM_CONFIG} --libfiles bitwriter linker ipo instrumentation backend ${EXTRA_LLVM_MODULES} |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
141 OUTPUT_VARIABLE LLVM_LIBS |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
142 OUTPUT_STRIP_TRAILING_WHITESPACE |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
143 ) |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
144 |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
145 # build a define that contains all LLVM targets required and is usable for |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
146 # preprocessor code generation. start with the native target. |
1520
1a93c3da09ef
Yet another fix for finding llvm's config file.
Christian Kamm <kamm incasoftware de>
parents:
1519
diff
changeset
|
147 find_path(LLVM_CONFIG_FILE_PATH config.h PATHS ${LLVM_INCLUDEDIR}/llvm/Config ${LLVM_INCLUDEDIR}/Config NO_DEFAULT_PATH) |
1522
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
148 if(LLVM_CONFIG_FILE_PATH STREQUAL "LLVM_CONFIG_FILE_PATH-NOTFOUND") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
149 message("Couldn't find your llvm Config.h file in ${LLVM_INCLUDEDIR}, no native target will be initialized.") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
150 else(LLVM_CONFIG_FILE_PATH STREQUAL "LLVM_CONFIG_FILE_PATH-NOTFOUND") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
151 file(STRINGS ${LLVM_CONFIG_FILE_PATH}/config.h LLVM_NATIVE_ARCH REGEX "^#define LLVM_NATIVE_ARCH") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
152 if(LLVM_NATIVE_ARCH) |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
153 string(REGEX REPLACE "^#define LLVM_NATIVE_ARCH (.*)Target$" "\\1" LLVM_NATIVE_ARCH ${LLVM_NATIVE_ARCH}) |
1547 | 154 message(STATUS "Found native target ${LLVM_NATIVE_ARCH}") |
1522
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
155 set(LLVM_MODULES_DEFINE "LLVM_TARGET(${LLVM_NATIVE_ARCH})") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
156 else(LLVM_NATIVE_ARCH) |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
157 message("Couldn't find the LLVM_NATIVE_ARCH define in ${LLVM_CONFIG_FILE_PATH}/config.h. Probably you have an older LLVM and can ignore this warning.") |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
158 endif(LLVM_NATIVE_ARCH) |
6766485fb584
Better error handling for CMake LLVM config file detection.
Christian Kamm <kamm incasoftware de>
parents:
1520
diff
changeset
|
159 endif(LLVM_CONFIG_FILE_PATH STREQUAL "LLVM_CONFIG_FILE_PATH-NOTFOUND") |
1518
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
160 # chain the extra target list to the define |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
161 foreach(EXTRA_TARGET ${EXTRA_LLVM_MODULES}) |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
162 set(LLVM_MODULES_DEFINE "${LLVM_MODULES_DEFINE} LLVM_TARGET(${EXTRA_TARGET})") |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
163 endforeach(EXTRA_TARGET) |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
164 set_source_files_properties( |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
165 ${PROJECT_SOURCE_DIR}/gen/main.cpp PROPERTIES |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
166 COMPILE_DEFINITIONS LDC_TARGETS=${LLVM_MODULES_DEFINE} |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
167 ) |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
168 |
26d061e61b02
Initialize LLVM target and asmprinter for the native and extra targets.
Christian Kamm <kamm incasoftware de>
parents:
1453
diff
changeset
|
169 |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
170 file(GLOB FE_SRC ${DMDFE_PATH}/*.c) |
1194
1853dcd9b944
Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1139
diff
changeset
|
171 file(GLOB FE_SRC_ROOT ${DMDFE_PATH}/root/*.c) |
1275
bedf0bfb8fdb
Implement first D-specific optimization pass: -simplify-drtcalls.
Frits van Bommel <fvbommel wxs.nl>
parents:
1256
diff
changeset
|
172 file(GLOB_RECURSE GEN_SRC gen/*.cpp) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
173 file(GLOB IR_SRC ir/*.cpp) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
174 # exclude idgen and impcnvgen and generated sources, just in case |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
175 list(REMOVE_ITEM FE_SRC |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
176 ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/idgen.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
177 ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/impcnvgen.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
178 ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/id.c |
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
179 ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/impcnvtab.c |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
180 ) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
181 set(LDC_SOURCE_FILES |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
182 ${LDC_GENERATED} |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
183 ${FE_SRC} |
1194
1853dcd9b944
Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1139
diff
changeset
|
184 ${FE_SRC_ROOT} |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
185 ${GEN_SRC} |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
186 ${IR_SRC} |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
187 ) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
188 set_source_files_properties( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
189 ${LDC_SOURCE_FILES} PROPERTIES |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
190 LANGUAGE CXX |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
191 ) |
749
db2dd9861600
Add basic CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
192 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
193 add_definitions( |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
194 -DIN_LLVM |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
195 -D_DH |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
196 -DOPAQUE_VTBLS |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
197 ) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
198 |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
199 if(UNIX) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
200 add_definitions(-DPOSIX) |
829 | 201 set(CONF_INST_DIR bin) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
202 endif(UNIX) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
203 |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
204 if(USE_BOEHM_GC) |
883
b52d5de7783f
GC defines and linkage changes.
Christian Kamm <kamm incasoftware de>
parents:
853
diff
changeset
|
205 add_definitions(-DREDIRECT_MALLOC=GC_malloc -DIGNORE_FREE) |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
206 endif(USE_BOEHM_GC) |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
207 |
821
8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
785
diff
changeset
|
208 if(GENERATE_OFFTI) |
8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
785
diff
changeset
|
209 add_definitions(-DGENERATE_OFFTI) |
8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
785
diff
changeset
|
210 endif(GENERATE_OFFTI) |
8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
785
diff
changeset
|
211 |
1558
3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1547
diff
changeset
|
212 if(USE_METADATA) |
3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1547
diff
changeset
|
213 add_definitions(-DUSE_METADATA) |
3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1547
diff
changeset
|
214 endif(USE_METADATA) |
3adcb70700cb
Added back option to disable metadata generation and users. Set USE_METADATA to OFF in ccmake.
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents:
1547
diff
changeset
|
215 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
216 if(CMAKE_MINOR_VERSION LESS 6) |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
217 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH "output dir for built executables") |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
218 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib CACHE PATH "output dir for built libraries") |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
219 add_definitions(-DDEFAULT_TARGET_TRIPLE=\\"${DEFAULT_TARGET}\\") |
1021
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
220 add_definitions(-DDEFAULT_ALT_TARGET_TRIPLE=\\"${DEFAULT_ALT_TARGET}\\") |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
221 add_definitions(-DLDC_INSTALL_PREFIX=\\"${CMAKE_INSTALL_PREFIX}\\") |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
222 else(CMAKE_MINOR_VERSION LESS 6) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
223 add_definitions(-DDEFAULT_TARGET_TRIPLE="${DEFAULT_TARGET}") |
1021
d1ec9ff0e9ba
Implemented basic -m32 and -m64 options.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
982
diff
changeset
|
224 add_definitions(-DDEFAULT_ALT_TARGET_TRIPLE="${DEFAULT_ALT_TARGET}") |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
225 add_definitions(-DLDC_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
226 endif(CMAKE_MINOR_VERSION LESS 6) |
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
227 |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
228 add_executable(${LDC_EXE} ${LDC_SOURCE_FILES}) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
229 |
853
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
230 # generate revision info |
1064
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
231 configure_file( |
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
232 ${PROJECT_SOURCE_DIR}/revisions.pl.in |
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
233 ${PROJECT_BINARY_DIR}/revisions.pl |
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
234 @ONLY |
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
235 ) |
1074
d9820e08bb84
Make sure revisions.pl always runs so revisions.h doesn't get out of date.
Frits van Bommel <fvbommel wxs.nl>
parents:
1071
diff
changeset
|
236 add_custom_target( |
d9820e08bb84
Make sure revisions.pl always runs so revisions.h doesn't get out of date.
Frits van Bommel <fvbommel wxs.nl>
parents:
1071
diff
changeset
|
237 gen_revs_h |
853
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
238 COMMAND ${PERL_EXECUTABLE} ${PROJECT_BINARY_DIR}/revisions.pl |
1074
d9820e08bb84
Make sure revisions.pl always runs so revisions.h doesn't get out of date.
Frits van Bommel <fvbommel wxs.nl>
parents:
1071
diff
changeset
|
239 DEPENDS ${PROJECT_BINARY_DIR}/revisions.pl |
1113
123812e02bc8
Split out LLVM_REV into separate header, to reduce rebuilding when only the LDC
Frits van Bommel <fvbommel wxs.nl>
parents:
1107
diff
changeset
|
240 COMMENT "Generating revisions.h and llvm-version.h" |
1064
f0b6549055ab
Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Frits van Bommel <fvbommel wxs.nl>
parents:
1051
diff
changeset
|
241 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/gen |
853
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
242 ) |
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
243 add_dependencies(${LDC_EXE} gen_revs_h) |
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
244 # |
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
245 |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
246 set(LDC_EXE_NAME ${PROGRAM_PREFIX}${LDC_EXE}${PROGRAM_SUFFIX}) |
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
247 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
248 set_target_properties( |
758
f04dde6e882c
Added initial D2 support, D2 frontend and changes to codegen to make things compile.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
753
diff
changeset
|
249 ${LDC_EXE} PROPERTIES |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
250 OUTPUT_NAME ${LDC_EXE_NAME} |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
251 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1074
diff
changeset
|
252 COMPILE_FLAGS "${LLVM_CXXFLAGS} ${LIBCONFIG_CXXFLAGS} -Wno-deprecated -Wno-write-strings" |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
253 ) |
749
db2dd9861600
Add basic CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
254 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
255 # LDFLAGS should actually be in target property LINK_FLAGS, but this works, and gets around linking problems |
1107
015b1634b33f
Unquote ${LIBCONFIG_LDFLAGS} in target_link_libraries().
Frits van Bommel <fvbommel wxs.nl>
parents:
1105
diff
changeset
|
256 target_link_libraries(${LDC_EXE} "${LLVM_LDFLAGS} ${LLVM_LIBS}" ${LIBCONFIG_LDFLAGS}) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
257 if(WIN32) |
1256
6af2359b433a
Change needed for mingw
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents:
1194
diff
changeset
|
258 target_link_libraries(${LDC_EXE} config++ imagehlp psapi) |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
259 set(CONF_INST_DIR bin) |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
260 endif(WIN32) |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
261 |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
262 if(USE_BOEHM_GC) |
883
b52d5de7783f
GC defines and linkage changes.
Christian Kamm <kamm incasoftware de>
parents:
853
diff
changeset
|
263 target_link_libraries(${LDC_EXE} ${PROJECT_SOURCE_DIR}/libgc.a) |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
264 endif(USE_BOEHM_GC) |
750
d05fc504a3a0
Improve CMake build file.
Christian Kamm <kamm incasoftware de>
parents:
749
diff
changeset
|
265 |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
266 get_target_property(LDC_LOC ${LDC_EXE} LOCATION) |
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
267 |
753
405e40f20ef9
Switch to Elrood's rewritten CMakeLists.txt.
Christian Kamm <kamm incasoftware de>
parents:
750
diff
changeset
|
268 # TODO: testrun |
785
ac39e5449ca5
Apply Elrood's CMake changes from #124. Thanks a lot!
Christian Kamm <kamm incasoftware de>
parents:
758
diff
changeset
|
269 |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
270 install(TARGETS ${LDC_EXE} DESTINATION bin) |
1453 | 271 install(FILES ${PROJECT_SOURCE_DIR}/bin/${LDMD_EXE} DESTINATION bin) |
829 | 272 install(FILES ${PROJECT_BINARY_DIR}/bin/${LDC_EXE}.conf DESTINATION ${CONF_INST_DIR}) |
1129
8403fec8c34c
Add dmd-style configuration file for rebuild usage. See #236 and thanks to ccuter for the patch!
Christian Kamm <kamm incasoftware de>
parents:
1113
diff
changeset
|
273 install(FILES ${PROJECT_BINARY_DIR}/bin/${LDC_EXE}.rebuild.conf DESTINATION ${CONF_INST_DIR}) |
829 | 274 install(DIRECTORY ${PROJECT_BINARY_DIR}/lib DESTINATION . USE_SOURCE_PERMISSIONS) |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
821
diff
changeset
|
275 |
829 | 276 add_subdirectory(runtime EXCLUDE_FROM_ALL) |