Mercurial > projects > ldc
annotate runtime/CMakeLists.txt @ 1168:ab186e535e72
A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
Fixes run/const_15, run/c/const_16_B.
The price is removing the lvalueness of struct literals. If it turns out too
much code depends on this behavior or we don't want to break with DMD, we
could keep struct literals as lvalues and instead convert struct literals used
as expression initializers into struct initializers.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 29 Mar 2009 11:43:45 +0200 |
parents | ee8db0b7bb62 |
children | 14a30bada44f |
rev | line source |
---|---|
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
1 project(runtime) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
2 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
3 cmake_minimum_required(VERSION 2.6) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
4 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
5 find_program(GCC_EXE gcc DOC "path to gcc binary") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
6 if(NOT GCC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
7 message(STATUS "gcc needs to be on your path to build the runtime") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
8 endif(NOT GCC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
9 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
10 option(BUILD_SHARED_LIBS "build the runtime as shared libraries (linux only)") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
11 option(BUILD_BC_LIBS "build the runtime as bytecode libraries") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
12 option(BUILD_SINGLE_LIB "build single runtime library" ON) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
13 set(D_FLAGS -g -w -d CACHE STRING "runtime build flags, separated by ;") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
14 |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
15 if(BUILD_SHARED_LIBS) |
1061
616d7c90bb6a
Update runtime CMakeList.txt for new command line syntax regarding PIC
Frits van Bommel <fvbommel wxs.nl>
parents:
984
diff
changeset
|
16 list(APPEND D_FLAGS -relocation-model=pic) |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
17 endif(BUILD_SHARED_LIBS) |
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
18 |
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
19 # build tango for D1, druntime for D2 |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
20 if(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
21 set(RUNTIME tango) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
22 elseif(D_VERSION EQUAL 2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
23 set(RUNTIME druntime) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
24 else(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
25 message(FATAL_ERROR "set d version to 1 or 2") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
26 endif(D_VERSION EQUAL 1) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
27 get_directory_property(PROJECT_PARENT_DIR DIRECTORY ${PROJECT_SOURCE_DIR} PARENT_DIRECTORY) |
983
6e68054cfc20
Fix out-ouf-source build for runtime as well.
Frits van Bommel <fvbommel wxs.nl>
parents:
874
diff
changeset
|
28 set(RUNTIME_DIR ${PROJECT_BINARY_DIR}/../${RUNTIME} CACHE PATH "runtime source dir") |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
29 |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
30 if(D_VERSION EQUAL 1) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
31 # copy imports to runtime dir |
1077
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
32 set(LDC_IMPORTS) |
1122
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
33 macro(imports_file SRCARG) |
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
34 get_filename_component(DEST ${SRCARG} NAME) |
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
35 set(SRC ${PROJECT_SOURCE_DIR}/${SRCARG}) |
1077
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
36 set(DEST ${RUNTIME_DIR}/ldc/${DEST}) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
37 |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
38 list(APPEND LDC_IMPORTS ${DEST}) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
39 add_custom_command( |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
40 OUTPUT ${DEST} |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
41 DEPENDS ${SRC} |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
42 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC} ${DEST} |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
43 ) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
44 endmacro(imports_file) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
45 imports_file(import/ldc/cstdarg.di) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
46 imports_file(import/ldc/intrinsics.di) |
1157
ee8db0b7bb62
Fix path to llvmasm.di in runtime CMakeList
Christian Kamm <kamm incasoftware de>
parents:
1156
diff
changeset
|
47 imports_file(import/ldc/llvmasm.di) |
1077
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
48 imports_file(internal/ldc/bitmanip.d) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
49 imports_file(internal/ldc/vararg.d) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
50 # library names |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
51 set(RUNTIME_CC tango-cc-tango) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
52 set(RUNTIME_GC tango-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
53 set(RUNTIME_DC ldc-runtime) |
844
1a8c6eedd7fd
Rename merged runtime to tango-base-ldc, #145.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
54 set(RUNTIME_AIO tango-base-ldc) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
55 # set paths to source files, or fill lists directly |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
56 set(RUNTIME_DC_DIR ${PROJECT_SOURCE_DIR}/internal) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
57 set(RUNTIME_GC_DIR ${RUNTIME_DIR}/lib/gc/basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
58 file(GLOB CORE_D ${RUNTIME_DIR}/lib/common/tango/core/*.d) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
59 file(GLOB CORE_C ${RUNTIME_DIR}/lib/common/tango/stdc/*.c) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
60 elseif(D_VERSION EQUAL 2) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
61 set(RUNTIME_CC druntime-core) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
62 set(RUNTIME_GC druntime-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
63 set(RUNTIME_DC druntime-rt-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
64 set(RUNTIME_AIO druntime-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
65 set(RUNTIME_DC_DIR ${RUNTIME_DIR}/src/compiler/ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
66 set(RUNTIME_GC_DIR ${RUNTIME_DIR}/src/gc/basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
67 file(GLOB CORE_D ${RUNTIME_DIR}/src/common/core/*.d) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
68 file(GLOB CORE_C ${RUNTIME_DIR}/src/common/core/stdc/*.c) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
69 endif(D_VERSION EQUAL 1) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
70 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
71 # should only be necessary if run independently from ldc cmake project |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
72 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
73 if(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
74 if(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
75 set(LDC_EXE ldc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
76 elseif(D_VERSION EQUAL 2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
77 set(LDC_EXE ldc2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
78 endif(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
79 endif(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
80 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
81 find_program(LDC_LOC ${LDC_EXE} ../bin DOC "path to ldc binary") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
82 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
83 message(SEND_ERROR "ldc not found") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
84 endif(NOT LDC_LOC) |
828
03b0c817a1a3
added install target and possibility to pre- and suffix ldc's executable name to cmake scripts
elrood
parents:
808
diff
changeset
|
85 set(LDC_EXE_NAME ${LDC_EXE}) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
86 endif(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
87 |
829 | 88 configure_file(${PROJECT_PARENT_DIR}/${LDC_EXE}.conf.in ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE}.conf) |
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:
1122
diff
changeset
|
89 configure_file(${PROJECT_PARENT_DIR}/${LDC_EXE}.rebuild.conf.in ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE}.rebuild.conf) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
90 |
874
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
91 # patch runtime source, uses LDC_EXE for ldc2 |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
92 if(D_VERSION EQUAL 2) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
93 find_program(PATCH_EXE patch DOC "path to patch tool") |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
94 if(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
95 message(STATUS "patch tool not found, can't automatically patch runtime sources for ldc") |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
96 else(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
97 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
98 OUTPUT patch-runtime |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
99 COMMAND ${PATCH_EXE} -t -N -p0 -i ${PROJECT_SOURCE_DIR}/${LDC_EXE}.diff |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
100 WORKING_DIRECTORY ${RUNTIME_DIR} |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
101 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
102 # rebuild cache to include sources added by patch |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
103 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
104 OUTPUT recache |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
105 COMMAND ${CMAKE_COMMAND} -H${PROJECT_PARENT_DIR} -B${PROJECT_BINARY_DIR}/.. |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
106 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
107 add_custom_target(patch DEPENDS patch-runtime recache ${LDC_IMPORTS}) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
108 endif(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
109 endif(D_VERSION EQUAL 2) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
110 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
111 file(GLOB GC_D ${RUNTIME_GC_DIR}/*.d) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
112 file(GLOB_RECURSE DCRT_D ${RUNTIME_DC_DIR}/*.d) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
113 file(GLOB DCRT_C ${RUNTIME_DC_DIR}/*.c) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
114 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
115 # compile d file into outdir, include incdir, and append names of generated .o and .bc to outlist_o and _bc |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
116 macro(dc INPUT_D OUTLIST_O OUTLIST_BC OUTDIR INCDIR MOREFLAGS) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
117 get_filename_component(BASENAME ${INPUT_D} NAME_WE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
118 set(OUTPUT_O ${PROJECT_BINARY_DIR}/${OUTDIR}/${BASENAME}.o) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
119 set(OUTPUT_BC ${PROJECT_BINARY_DIR}/${OUTDIR}/${BASENAME}.bc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
120 list(APPEND ${OUTLIST_O} ${OUTPUT_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
121 list(APPEND ${OUTLIST_BC} ${OUTPUT_BC}) |
1077
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
122 |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
123 # Compile |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
124 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
125 OUTPUT |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
126 ${OUTPUT_O} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
127 ${OUTPUT_BC} |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
128 COMMAND ${LDC_LOC} -c -I${INCDIR} -output-bc ${INPUT_D} -of${OUTPUT_O} ${D_FLAGS} ${MOREFLAGS} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
129 DEPENDS ${LDC_LOC} |
1077
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
130 ${INPUT_D} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
131 ${LDC_IMPORTS} |
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
132 ${PROJECT_BINARY_DIR}/../bin/${LDC_EXE}.conf |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
133 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
134 endmacro(dc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
135 |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
136 # dc_dir include for core and gc only necessary with druntime |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
137 foreach(f ${CORE_D}) |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
138 dc(${f} CORE_O CORE_BC core ${RUNTIME_DC_DIR} "") |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
139 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
140 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
141 foreach(f ${GC_D}) |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
142 dc(${f} GC_O GC_BC gc "${RUNTIME_GC_DIR} ${RUNTIME_DC_DIR}" "-disable-invariants") |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
143 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
144 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
145 foreach(f ${DCRT_D}) |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
146 dc(${f} DCRT_O DCRT_BC dcrt ${RUNTIME_DC_DIR} "") |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
147 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
148 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
149 if(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
150 add_library(${RUNTIME_AIO} ${CORE_O} ${CORE_C} ${GC_O} ${DCRT_O} ${DCRT_C}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
151 set(LIBS ${RUNTIME_AIO}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
152 else(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
153 add_library(${RUNTIME_CC} ${CORE_O} ${CORE_C}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
154 add_library(${RUNTIME_GC} ${GC_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
155 add_library(${RUNTIME_DC} ${DCRT_O} ${DCRT_C}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
156 set(LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
157 ${RUNTIME_CC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
158 ${RUNTIME_GC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
159 ${RUNTIME_DC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
160 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
161 endif(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
162 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
163 if(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
164 find_program(LLVM_AR_EXE llvm-ar ${LLVM_INSTDIR}/bin DOC "path to llvm-ar tool") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
165 if(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
166 message(SEND_ERROR "llvm-ar not found") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
167 endif(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
168 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
169 add_library(${RUNTIME_CC}-c ${CORE_C}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
170 add_library(${RUNTIME_DC}-c ${DCRT_C}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
171 list(APPEND LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
172 ${RUNTIME_CC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
173 ${RUNTIME_DC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
174 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
175 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
176 OUTPUT bclibs |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
177 COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_CC}-bc.a ${CORE_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
178 COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_GC}-bc.a ${GC_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
179 # cannot parse genobj.bc if built with -g |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
180 # COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_DC}-bc.a ${DCRT_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
181 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../lib |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
182 DEPENDS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
183 ${CORE_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
184 ${GC_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
185 ${DCRT_BC} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
186 ${LDC_IMPORTS} |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
187 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
188 set(BCLIBS bclibs) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
189 endif(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
190 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
191 set_target_properties( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
192 ${LIBS} PROPERTIES |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
193 LINKER_LANGUAGE C |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
194 ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../lib |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
195 LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../lib |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
196 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
197 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
198 # BCLIBS is empty if BUILD_BC_LIBS is not selected |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
199 add_custom_target(runtime DEPENDS ${LIBS} ${BCLIBS}) |