From 69d709929b14cda002661c088ac8c95f32fe2648 Mon Sep 17 00:00:00 2001 From: Dragos Carp Date: Thu, 24 Oct 2013 01:26:04 +0200 Subject: [PATCH] Added support for LDC on Linux --- cmake-d/CMakeLists.txt | 1 + cmake-d/Platform/Linux-ldc2.cmake | 63 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 cmake-d/Platform/Linux-ldc2.cmake diff --git a/cmake-d/CMakeLists.txt b/cmake-d/CMakeLists.txt index 2fb0552..7ae7f2a 100644 --- a/cmake-d/CMakeLists.txt +++ b/cmake-d/CMakeLists.txt @@ -30,6 +30,7 @@ SET (MOD_SRCS SET (PLAT_SRCS Platform/Linux-dmd.cmake Platform/Linux-gdc.cmake + Platform/Linux-ldc.cmake Platform/Windows-dmd.cmake Platform/Windows-gdc.cmake ) diff --git a/cmake-d/Platform/Linux-ldc2.cmake b/cmake-d/Platform/Linux-ldc2.cmake new file mode 100644 index 0000000..91f09b7 --- /dev/null +++ b/cmake-d/Platform/Linux-ldc2.cmake @@ -0,0 +1,63 @@ +# +# CMakeD - CMake module for D Language +# +# Copyright (c) 2007, Selman Ulug +# Tim Burrell +# +# All rights reserved. +# +# See LICENSE for details. +# +# Modified from CMake 2.6.5 gcc.cmake +# See http://www.cmake.org/HTML/Copyright.html for details +# + +#SET(DSTDLIB_FLAGS "-version=Phobos") +IF(CMAKE_D_BUILD_DOCS) + SET(DDOC_FLAGS "-D -Dddocumentation") + #FOREACH(item ${CMAKE_D_DDOC_FILES}) + # SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}") + #ENDFOREACH(item) +ENDIF(CMAKE_D_BUILD_DOCS) + +SET(CMAKE_D_OUTPUT_EXTENSION .o) +SET(CMAKE_D_DASH_O "-of") +SET(CMAKE_BASE_NAME ldc2) + +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_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_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_LINK_LIBRARY_SUFFIX "") +SET(CMAKE_STATIC_LIBRARY_PREFIX "lib") +SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a") +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +SET(CMAKE_EXECUTABLE_SUFFIX "") # .exe +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_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_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}") +SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g -L--export-dynamic ${DDOC_FLAGS}") +# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE " -E > ") +SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE " -S -of") +# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")