From bfd340d7440422397771359359ab2a5a9a2a6066 Mon Sep 17 00:00:00 2001 From: Steven Dwy Date: Sun, 23 Mar 2014 14:39:29 -0700 Subject: [PATCH] Add shared library support for dmd --- cmake-d/CMakeDInformation.cmake | 2 +- cmake-d/Platform/Linux-dmd.cmake | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake-d/CMakeDInformation.cmake b/cmake-d/CMakeDInformation.cmake index ad35969..80c140f 100644 --- a/cmake-d/CMakeDInformation.cmake +++ b/cmake-d/CMakeDInformation.cmake @@ -263,7 +263,7 @@ endif(NOT CMAKE_D_COMPILE_OBJECT) if(NOT CMAKE_D_LINK_EXECUTABLE) set(CMAKE_D_LINK_EXECUTABLE - " ${CMAKE_D_DASH_O} ${CMAKE_D_STDLIBS}") + " ${CMAKE_D_DASH_O} ${CMAKE_D_STDLIBS}") endif(NOT CMAKE_D_LINK_EXECUTABLE) mark_as_advanced( diff --git a/cmake-d/Platform/Linux-dmd.cmake b/cmake-d/Platform/Linux-dmd.cmake index f6628c5..c97bb61 100644 --- a/cmake-d/Platform/Linux-dmd.cmake +++ b/cmake-d/Platform/Linux-dmd.cmake @@ -27,16 +27,20 @@ SET(CMAKE_BASE_NAME dmd) SET(CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS "-lib") SET(CMAKE_SHARED_LIBRARY_D_FLAGS "") # -pic -SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared") # -shared +SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared -defaultlib=libphobos2.so") # -shared SET(CMAKE_SHARED_LIBRARY_LINK_D_FLAGS "") # +s, flag for exe link to use shared lib SET(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG "") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP "") # : or empty +SET(CMAKE_SHARED_LIBRARY_SONAME_D_FLAG "-L-soname=") +SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_D_FLAG "-L-rpath=") SET(CMAKE_INCLUDE_FLAG_D "-I") # -I SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty SET(CMAKE_LIBRARY_PATH_FLAG "-L-L") SET(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/" SET(CMAKE_LINK_LIBRARY_FLAG "-L-l") +SET(CMAKE_D_COMPILE_OPTIONS_PIC "-fPIC") + SET(CMAKE_LINK_LIBRARY_SUFFIX "") SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") @@ -48,12 +52,12 @@ SET(CMAKE_DL_LIBS "dl") SET(CMAKE_FIND_LIBRARY_PREFIXES "lib") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") -#SET(CMAKE_D_STDLIBS "-L-lphobos2 -L-lpthread -L-lm" ) +#SET(CMAKE_D_STDLIBS "-L-lphobos2 -L-lpthread -L-lm -defaultlib=libphobos2.so") #SET (CMAKE_D_FLAGS_INIT "-version=${CMAKE_BUILD_TYPE}Build ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE} -I$ENV{D_PATH}/include -I$ENV{D_PATH}/import -I${CMAKE_PROJECT_SOURCE_DIR}") SET (CMAKE_D_FLAGS_INIT "") # DMD can only produce 32-bit binaries for now -SET (CMAKE_D_LINK_FLAGS "") +SET (CMAKE_D_LINK_FLAGS "-defaultlib=libphobos2.so") SET (CMAKE_D_FLAGS_DEBUG_INIT "-g -debug -L--export-dynamic ${DDOC_FLAGS}") # SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}") SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")