Merge pull request #2 from Yoplitein/master

Fixed shared library support for dmd
This commit is contained in:
Dragos Carp 2014-03-24 07:52:10 +01:00
commit 69acd6c475
2 changed files with 8 additions and 4 deletions

View file

@ -263,7 +263,7 @@ endif(NOT CMAKE_D_COMPILE_OBJECT)
if(NOT CMAKE_D_LINK_EXECUTABLE) if(NOT CMAKE_D_LINK_EXECUTABLE)
set(CMAKE_D_LINK_EXECUTABLE set(CMAKE_D_LINK_EXECUTABLE
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <OBJECTS> ${CMAKE_D_DASH_O}<TARGET> <LINK_LIBRARIES> ${CMAKE_D_STDLIBS}") "<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_D_DASH_O}<TARGET> <LINK_LIBRARIES> ${CMAKE_D_STDLIBS}")
endif(NOT CMAKE_D_LINK_EXECUTABLE) endif(NOT CMAKE_D_LINK_EXECUTABLE)
mark_as_advanced( mark_as_advanced(

View file

@ -27,16 +27,20 @@ SET(CMAKE_BASE_NAME dmd)
SET(CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS "-lib") SET(CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS "-lib")
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "") # -pic 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_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 "") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_D_FLAG_SEP "") # : or empty 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 "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L-L") 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_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_LINK_LIBRARY_FLAG "-L-l")
SET(CMAKE_D_COMPILE_OPTIONS_PIC "-fPIC")
SET(CMAKE_LINK_LIBRARY_SUFFIX "") SET(CMAKE_LINK_LIBRARY_SUFFIX "")
SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") 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_PREFIXES "lib")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") 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 "-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 "") SET (CMAKE_D_FLAGS_INIT "")
# DMD can only produce 32-bit binaries for now # 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_DEBUG_INIT "-g -debug -L--export-dynamic ${DDOC_FLAGS}")
# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}") # SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}") SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")