Mercurial > projects > ldc
annotate runtime/CMakeLists.txt @ 1638:0de4525a9ed6
Apply workaround for #395 by klickverbot.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 08 Mar 2010 20:06:08 +0100 |
parents | 71ad691baeb2 |
children | 18bbb1436153 |
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 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
|
6 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
|
7 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
|
8 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
|
9 |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
10 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
|
11 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
|
12 endif(BUILD_SHARED_LIBS) |
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
13 |
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
14 # 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
|
15 if(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
16 set(RUNTIME tango) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
17 elseif(D_VERSION EQUAL 2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
18 set(RUNTIME druntime) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
19 else(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
20 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
|
21 endif(D_VERSION EQUAL 1) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
22 get_directory_property(PROJECT_PARENT_DIR DIRECTORY ${PROJECT_SOURCE_DIR} PARENT_DIRECTORY) |
1498
899a928ac905
Set the default RUNTIME_DIR to be side-by-side of the ldc source dir.
Christian Kamm <kamm incasoftware de>
parents:
1421
diff
changeset
|
23 set(RUNTIME_DIR ${PROJECT_PARENT_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
|
24 |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
25 if(D_VERSION EQUAL 1) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
26 # 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
|
27 set(LDC_IMPORTS) |
1122
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
28 macro(imports_file SRCARG) |
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
29 get_filename_component(DEST ${SRCARG} NAME) |
c614ef596a20
Fix imports copying for out-of-source build.
Christian Kamm <kamm incasoftware de>
parents:
1077
diff
changeset
|
30 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
|
31 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
|
32 |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
33 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
|
34 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
|
35 OUTPUT ${DEST} |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
36 DEPENDS ${SRC} |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
37 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
|
38 ) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
39 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 imports_file(internal/ldc/vararg.d) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
45 # library names |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
46 set(RUNTIME_CC tango-cc-tango) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
47 set(RUNTIME_GC tango-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
48 set(RUNTIME_DC ldc-runtime) |
844
1a8c6eedd7fd
Rename merged runtime to tango-base-ldc, #145.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
49 set(RUNTIME_AIO tango-base-ldc) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
50 # 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 elseif(D_VERSION EQUAL 2) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
56 set(RUNTIME_CC druntime-core) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
57 set(RUNTIME_GC druntime-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
58 set(RUNTIME_DC druntime-rt-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
59 set(RUNTIME_AIO druntime-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 endif(D_VERSION EQUAL 1) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
65 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
66 # 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
|
67 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
68 if(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
69 if(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
70 set(LDC_EXE ldc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
71 elseif(D_VERSION EQUAL 2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
72 set(LDC_EXE ldc2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
73 endif(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
74 endif(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
75 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
76 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
|
77 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
78 message(SEND_ERROR "ldc not found") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
79 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
|
80 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
|
81 endif(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
82 |
829 | 83 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
|
84 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
|
85 |
874
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
86 # 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
|
87 if(D_VERSION EQUAL 2) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
88 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
|
89 if(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
90 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
|
91 else(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
92 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
93 OUTPUT patch-runtime |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
94 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
|
95 WORKING_DIRECTORY ${RUNTIME_DIR} |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
96 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
97 # 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
|
98 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
99 OUTPUT recache |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
100 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
|
101 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
102 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
|
103 endif(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
104 endif(D_VERSION EQUAL 2) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
105 |
1421
7a693c367190
just a simple change to cmake for mingw
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents:
1201
diff
changeset
|
106 file(GLOB_RECURSE GC_D ${RUNTIME_GC_DIR}/*.d) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
107 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
|
108 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
|
109 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
110 # 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 list(APPEND ${OUTLIST_O} ${OUTPUT_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
116 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
|
117 |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
118 # Compile |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
119 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
120 OUTPUT |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
121 ${OUTPUT_O} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
122 ${OUTPUT_BC} |
1588
71ad691baeb2
Hack to make compiling the tango 0.99.8 runtime work.
Christian Kamm <kamm incasoftware de>
parents:
1498
diff
changeset
|
123 COMMAND ${LDC_LOC} -c -I${INCDIR} -I${RUNTIME_GC_DIR} -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
|
124 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
|
125 ${INPUT_D} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
126 ${LDC_IMPORTS} |
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
127 ${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
|
128 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
129 endmacro(dc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
130 |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
131 # 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
|
132 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
|
133 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
|
134 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
135 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
136 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
|
137 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
|
138 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
139 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
140 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
|
141 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
|
142 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
143 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
144 if(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
145 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
|
146 set(LIBS ${RUNTIME_AIO}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
147 else(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
148 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
|
149 add_library(${RUNTIME_GC} ${GC_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
150 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
|
151 set(LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
152 ${RUNTIME_CC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
153 ${RUNTIME_GC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
154 ${RUNTIME_DC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
155 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
156 endif(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
157 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
158 if(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
159 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
|
160 if(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
161 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
|
162 endif(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
163 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
164 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
|
165 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
|
166 list(APPEND LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
167 ${RUNTIME_CC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
168 ${RUNTIME_DC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
169 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
170 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
171 OUTPUT bclibs |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
172 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
|
173 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
|
174 # 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
|
175 # 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
|
176 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../lib |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
177 DEPENDS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
178 ${CORE_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
179 ${GC_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
180 ${DCRT_BC} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
181 ${LDC_IMPORTS} |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
182 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
183 set(BCLIBS bclibs) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
184 endif(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
185 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
186 set_target_properties( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
187 ${LIBS} PROPERTIES |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
188 LINKER_LANGUAGE C |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
189 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
|
190 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
|
191 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
192 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
193 # 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
|
194 add_custom_target(runtime DEPENDS ${LIBS} ${BCLIBS}) |