Changeset 808:4ad1e7b10378
- Timestamp:
- 11/30/08 13:19:39
(1 month ago)
- Author:
- elrood
- branch:
- default
- Message:
when building the runtime pass -fPIC for shared libs and -disable-invariants for gc
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r759 |
r808 |
|
| 1 | | |
|---|
| 2 | 1 | [Environment] |
|---|
| 3 | | |
|---|
| 4 | 2 | DFLAGS=-I%@P%/../druntime/import -L-L%@P%/../druntime/lib |
|---|
| r785 |
r808 |
|
| 1 | | |
|---|
| 2 | 1 | [Environment] |
|---|
| 3 | | |
|---|
| 4 | 2 | DFLAGS=-I@RUNTIME_DIR@/import -L-L@RUNTIME_DIR@/lib |
|---|
| r791 |
r808 |
|
| 13 | 13 | set(D_FLAGS -g -w -d CACHE STRING "runtime build flags, separated by ;") |
|---|
| 14 | 14 | |
|---|
| | 15 | if(BUILD_SHARED_LIBS) |
|---|
| | 16 | list(APPEND D_FLAGS -fPIC) |
|---|
| | 17 | endif(BUILD_SHARED_LIBS) |
|---|
| | 18 | |
|---|
| | 19 | # build tango for D1, druntime for D2 |
|---|
| 15 | 20 | if(D_VERSION EQUAL 1) |
|---|
| 16 | 21 | set(RUNTIME tango) |
|---|
| … | … | |
| 24 | 29 | |
|---|
| 25 | 30 | if(D_VERSION EQUAL 1) |
|---|
| 26 | | # build tango for D1, druntime for D2 |
|---|
| 27 | 31 | set(LDC_EXE ldc) |
|---|
| 28 | 32 | # copy imports to runtime dir |
|---|
| … | … | |
| 54 | 58 | file(GLOB CORE_D ${RUNTIME_DIR}/src/common/core/*.d) |
|---|
| 55 | 59 | file(GLOB CORE_C ${RUNTIME_DIR}/src/common/core/stdc/*.c) |
|---|
| 56 | | else(D_VERSION EQUAL 1) |
|---|
| 57 | | message(FATAL_ERROR "set d version to 1 or 2") |
|---|
| 58 | 60 | endif(D_VERSION EQUAL 1) |
|---|
| 59 | 61 | |
|---|
| … | … | |
| 86 | 88 | WORKING_DIRECTORY ${RUNTIME_DIR} |
|---|
| 87 | 89 | ) |
|---|
| | 90 | # rebuild cache to include sources added by patch |
|---|
| 88 | 91 | add_custom_command( |
|---|
| 89 | 92 | OUTPUT recache |
|---|
| … | … | |
| 98 | 101 | |
|---|
| 99 | 102 | # compile d file into outdir, include incdir, and append names of generated .o and .bc to outlist_o and _bc |
|---|
| 100 | | macro(dc INPUT_D OUTLIST_O OUTLIST_BC OUTDIR INCDIR) |
|---|
| | 103 | macro(dc INPUT_D OUTLIST_O OUTLIST_BC OUTDIR INCDIR MOREFLAGS) |
|---|
| 101 | 104 | get_filename_component(BASENAME ${INPUT_D} NAME_WE) |
|---|
| 102 | 105 | set(OUTPUT_O ${PROJECT_BINARY_DIR}/${OUTDIR}/${BASENAME}.o) |
|---|
| … | … | |
| 108 | 111 | ${OUTPUT_O} |
|---|
| 109 | 112 | ${OUTPUT_BC} |
|---|
| 110 | | COMMAND ${LDC_LOC} -c -I${INCDIR} -output-bc ${INPUT_D} -of${OUTPUT_O} ${D_FLAGS} |
|---|
| | 113 | COMMAND ${LDC_LOC} -c -I${INCDIR} -output-bc ${INPUT_D} -of${OUTPUT_O} ${D_FLAGS} ${MOREFLAGS} |
|---|
| 111 | 114 | DEPENDS ${LDC_LOC} |
|---|
| 112 | 115 | ) |
|---|
| … | … | |
| 115 | 118 | # dc_dir include for core and gc only necessary with druntime |
|---|
| 116 | 119 | foreach(f ${CORE_D}) |
|---|
| 117 | | dc(${f} CORE_O CORE_BC core ${RUNTIME_DC_DIR}) |
|---|
| | 120 | dc(${f} CORE_O CORE_BC core ${RUNTIME_DC_DIR} "") |
|---|
| 118 | 121 | endforeach(f) |
|---|
| 119 | 122 | |
|---|
| 120 | 123 | foreach(f ${GC_D}) |
|---|
| 121 | | dc(${f} GC_O GC_BC gc "${RUNTIME_GC_DIR} ${RUNTIME_DC_DIR}") |
|---|
| | 124 | dc(${f} GC_O GC_BC gc "${RUNTIME_GC_DIR} ${RUNTIME_DC_DIR}" "-disable-invariants") |
|---|
| 122 | 125 | endforeach(f) |
|---|
| 123 | 126 | |
|---|
| 124 | 127 | foreach(f ${DCRT_D}) |
|---|
| 125 | | dc(${f} DCRT_O DCRT_BC dcrt ${RUNTIME_DC_DIR}) |
|---|
| | 128 | dc(${f} DCRT_O DCRT_BC dcrt ${RUNTIME_DC_DIR} "") |
|---|
| 126 | 129 | endforeach(f) |
|---|
| 127 | 130 | |
|---|