Mercurial > projects > ldc
annotate runtime/CMakeLists.txt @ 1129:8403fec8c34c
Add dmd-style configuration file for rebuild usage. See #236 and thanks to ccuter for the patch!
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 21 Mar 2009 09:47:48 +0100 |
parents | c614ef596a20 |
children | 19d4ded7204a |
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) |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
47 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
|
48 imports_file(internal/ldc/vararg.d) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
49 # library names |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
50 set(RUNTIME_CC tango-cc-tango) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
51 set(RUNTIME_GC tango-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
52 set(RUNTIME_DC ldc-runtime) |
844
1a8c6eedd7fd
Rename merged runtime to tango-base-ldc, #145.
Christian Kamm <kamm incasoftware de>
parents:
829
diff
changeset
|
53 set(RUNTIME_AIO tango-base-ldc) |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
54 # 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 elseif(D_VERSION EQUAL 2) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
60 set(RUNTIME_CC druntime-core) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
61 set(RUNTIME_GC druntime-gc-basic) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
62 set(RUNTIME_DC druntime-rt-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
63 set(RUNTIME_AIO druntime-ldc) |
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
64 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
|
65 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
|
66 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
|
67 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
|
68 endif(D_VERSION EQUAL 1) |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
69 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
70 # 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
|
71 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
72 if(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
73 if(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
74 set(LDC_EXE ldc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
75 elseif(D_VERSION EQUAL 2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
76 set(LDC_EXE ldc2) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
77 endif(D_VERSION EQUAL 1) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
78 endif(NOT LDC_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
79 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
80 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
|
81 if(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
82 message(SEND_ERROR "ldc not found") |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
83 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
|
84 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
|
85 endif(NOT LDC_LOC) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
86 |
829 | 87 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
|
88 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
|
89 |
874
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
90 # 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
|
91 if(D_VERSION EQUAL 2) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
92 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
|
93 if(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
94 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
|
95 else(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
96 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
97 OUTPUT patch-runtime |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
98 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
|
99 WORKING_DIRECTORY ${RUNTIME_DIR} |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
100 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
101 # 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
|
102 add_custom_command( |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
103 OUTPUT recache |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
104 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
|
105 ) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
106 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
|
107 endif(NOT PATCH_EXE) |
2ddee23bd70e
Get rid of ex-Tango patch. (merged into Tango)
Christian Kamm <kamm incasoftware de>
parents:
862
diff
changeset
|
108 endif(D_VERSION EQUAL 2) |
786
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 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
|
111 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
|
112 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
|
113 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
114 # 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 list(APPEND ${OUTLIST_O} ${OUTPUT_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
120 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
|
121 |
bb57632d27ea
Change the way imports are copied to the (Tango) runtime dir.
Frits van Bommel <fvbommel wxs.nl>
parents:
1061
diff
changeset
|
122 # Compile |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
123 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
124 OUTPUT |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
125 ${OUTPUT_O} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
126 ${OUTPUT_BC} |
808
4ad1e7b10378
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
elrood
parents:
791
diff
changeset
|
127 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
|
128 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
|
129 ${INPUT_D} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
130 ${LDC_IMPORTS} |
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
131 ${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
|
132 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
133 endmacro(dc) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
134 |
791
3e0b643090f1
Apply Elrood's CMake patch from #132.
Christian Kamm <kamm incasoftware de>
parents:
786
diff
changeset
|
135 # 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
|
136 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
|
137 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
|
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 ${GC_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} 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
|
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 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
|
145 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
|
146 endforeach(f) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
147 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
148 if(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
149 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
|
150 set(LIBS ${RUNTIME_AIO}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
151 else(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
152 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
|
153 add_library(${RUNTIME_GC} ${GC_O}) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
154 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
|
155 set(LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
156 ${RUNTIME_CC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
157 ${RUNTIME_GC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
158 ${RUNTIME_DC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
159 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
160 endif(BUILD_SINGLE_LIB) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
161 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
162 if(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
163 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
|
164 if(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
165 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
|
166 endif(NOT LLVM_AR_EXE) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
167 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
168 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
|
169 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
|
170 list(APPEND LIBS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
171 ${RUNTIME_CC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
172 ${RUNTIME_DC}-c |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
173 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
174 add_custom_command( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
175 OUTPUT bclibs |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
176 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
|
177 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
|
178 # 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
|
179 # 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
|
180 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/../lib |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
181 DEPENDS |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
182 ${CORE_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
183 ${GC_BC} |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
184 ${DCRT_BC} |
984
4c0df37d0421
Removing ldc.conf. (IMPORTANT: run 'cmake .' after pull)
Frits van Bommel <fvbommel wxs.nl>
parents:
983
diff
changeset
|
185 ${LDC_IMPORTS} |
786
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
186 ) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
187 set(BCLIBS bclibs) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
188 endif(BUILD_BC_LIBS) |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
189 |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
190 set_target_properties( |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
191 ${LIBS} PROPERTIES |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
192 LINKER_LANGUAGE C |
45d9c218fd32
Add missing CMakeList, apply conf changes to dmd2 frontend.
Christian Kamm <kamm incasoftware de>
parents:
diff
changeset
|
193 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
|
194 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
|
195 ) |
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 # 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
|
198 add_custom_target(runtime DEPENDS ${LIBS} ${BCLIBS}) |