# HG changeset patch # User elrood # Date 1228069179 -3600 # Node ID 4ad1e7b1037814951f4b6782bbca39d28114baaa # Parent d92acb81a5836d60e470e913b80e527841b89913 when building the runtime pass -fPIC for shared libs and -disable-invariants for gc diff -r d92acb81a583 -r 4ad1e7b10378 bin/ldc2.conf --- a/bin/ldc2.conf Sun Nov 30 11:54:18 2008 +0100 +++ b/bin/ldc2.conf Sun Nov 30 19:19:39 2008 +0100 @@ -1,4 +1,2 @@ - [Environment] - DFLAGS=-I%@P%/../druntime/import -L-L%@P%/../druntime/lib diff -r d92acb81a583 -r 4ad1e7b10378 ldc2.conf.in --- a/ldc2.conf.in Sun Nov 30 11:54:18 2008 +0100 +++ b/ldc2.conf.in Sun Nov 30 19:19:39 2008 +0100 @@ -1,4 +1,2 @@ - [Environment] - DFLAGS=-I@RUNTIME_DIR@/import -L-L@RUNTIME_DIR@/lib diff -r d92acb81a583 -r 4ad1e7b10378 runtime/CMakeLists.txt --- a/runtime/CMakeLists.txt Sun Nov 30 11:54:18 2008 +0100 +++ b/runtime/CMakeLists.txt Sun Nov 30 19:19:39 2008 +0100 @@ -12,6 +12,11 @@ option(BUILD_SINGLE_LIB "build single runtime library" ON) set(D_FLAGS -g -w -d CACHE STRING "runtime build flags, separated by ;") +if(BUILD_SHARED_LIBS) + list(APPEND D_FLAGS -fPIC) +endif(BUILD_SHARED_LIBS) + +# build tango for D1, druntime for D2 if(D_VERSION EQUAL 1) set(RUNTIME tango) elseif(D_VERSION EQUAL 2) @@ -23,7 +28,6 @@ set(RUNTIME_DIR ${PROJECT_PARENT_DIR}/${RUNTIME} CACHE PATH "runtime source dir" FORCE) if(D_VERSION EQUAL 1) - # build tango for D1, druntime for D2 set(LDC_EXE ldc) # copy imports to runtime dir add_custom_command( @@ -53,8 +57,6 @@ set(RUNTIME_GC_DIR ${RUNTIME_DIR}/src/gc/basic) file(GLOB CORE_D ${RUNTIME_DIR}/src/common/core/*.d) file(GLOB CORE_C ${RUNTIME_DIR}/src/common/core/stdc/*.c) -else(D_VERSION EQUAL 1) - message(FATAL_ERROR "set d version to 1 or 2") endif(D_VERSION EQUAL 1) # should only be necessary if run independently from ldc cmake project @@ -85,6 +87,7 @@ COMMAND ${PATCH_EXE} -t -N -p0 -i ${PROJECT_SOURCE_DIR}/${LDC_EXE}.diff WORKING_DIRECTORY ${RUNTIME_DIR} ) + # rebuild cache to include sources added by patch add_custom_command( OUTPUT recache COMMAND ${CMAKE_COMMAND} -H${PROJECT_PARENT_DIR} -B${PROJECT_BINARY_DIR}/.. @@ -97,7 +100,7 @@ file(GLOB DCRT_C ${RUNTIME_DC_DIR}/*.c) # compile d file into outdir, include incdir, and append names of generated .o and .bc to outlist_o and _bc -macro(dc INPUT_D OUTLIST_O OUTLIST_BC OUTDIR INCDIR) +macro(dc INPUT_D OUTLIST_O OUTLIST_BC OUTDIR INCDIR MOREFLAGS) get_filename_component(BASENAME ${INPUT_D} NAME_WE) set(OUTPUT_O ${PROJECT_BINARY_DIR}/${OUTDIR}/${BASENAME}.o) set(OUTPUT_BC ${PROJECT_BINARY_DIR}/${OUTDIR}/${BASENAME}.bc) @@ -107,22 +110,22 @@ OUTPUT ${OUTPUT_O} ${OUTPUT_BC} - COMMAND ${LDC_LOC} -c -I${INCDIR} -output-bc ${INPUT_D} -of${OUTPUT_O} ${D_FLAGS} + COMMAND ${LDC_LOC} -c -I${INCDIR} -output-bc ${INPUT_D} -of${OUTPUT_O} ${D_FLAGS} ${MOREFLAGS} DEPENDS ${LDC_LOC} ) endmacro(dc) # dc_dir include for core and gc only necessary with druntime foreach(f ${CORE_D}) - dc(${f} CORE_O CORE_BC core ${RUNTIME_DC_DIR}) + dc(${f} CORE_O CORE_BC core ${RUNTIME_DC_DIR} "") endforeach(f) foreach(f ${GC_D}) - dc(${f} GC_O GC_BC gc "${RUNTIME_GC_DIR} ${RUNTIME_DC_DIR}") + dc(${f} GC_O GC_BC gc "${RUNTIME_GC_DIR} ${RUNTIME_DC_DIR}" "-disable-invariants") endforeach(f) foreach(f ${DCRT_D}) - dc(${f} DCRT_O DCRT_BC dcrt ${RUNTIME_DC_DIR}) + dc(${f} DCRT_O DCRT_BC dcrt ${RUNTIME_DC_DIR} "") endforeach(f) if(BUILD_SINGLE_LIB)