More windows fixes
This commit is contained in:
parent
a81ea73566
commit
30c8f9774d
4 changed files with 451 additions and 441 deletions
|
@ -1,225 +1,225 @@
|
|||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 CMakeCInformation.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
# This file sets the basic flags for the D language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
|
||||
GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_BASE_NAME gdc)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_BASE_NAME dmd)
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE
|
||||
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
|
||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
|
||||
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
|
||||
IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
|
||||
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D})
|
||||
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
IF(NOT CMAKE_MODULE_EXISTS)
|
||||
SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})
|
||||
SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})
|
||||
ENDIF(NOT CMAKE_MODULE_EXISTS)
|
||||
|
||||
SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING
|
||||
"Flags for D compiler.")
|
||||
|
||||
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
# default build type is none
|
||||
IF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
ENDIF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during debug builds.")
|
||||
SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release minsize builds.")
|
||||
SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
|
||||
SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during Release with Debug Info builds.")
|
||||
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
|
||||
IF(CMAKE_D_STANDARD_LIBRARIES_INIT)
|
||||
SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by defalut with all D applications.")
|
||||
MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES)
|
||||
ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT)
|
||||
|
||||
INCLUDE(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_D_CREATE_SHARED_MODULE
|
||||
# CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
# CMAKE_D_COMPILE_OBJECT
|
||||
# CMAKE_D_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# D compiler information
|
||||
# <CMAKE_D_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS>
|
||||
# <CMAKE_D_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
IF("$ENV{D_PATH}" STREQUAL "")
|
||||
STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH)
|
||||
ELSE("$ENV{D_PATH}" STREQUAL "")
|
||||
SET(D_PATH "$ENV{D_PATH}")
|
||||
ENDIF("$ENV{D_PATH}" STREQUAL "")
|
||||
MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}")
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_OUTPUT_D_FLAG "-o ")
|
||||
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
|
||||
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
|
||||
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
|
||||
SET(CMAKE_D_VERSION_FLAG "-fversion=")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_OUTPUT_D_FLAG "-of")
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-L+")
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-I")
|
||||
FIND_PROGRAM(DMD_LIBRARIAN "lib.exe")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
|
||||
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
|
||||
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
|
||||
SET(CMAKE_D_VERSION_FLAG "-version=")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-fversion=Tango")
|
||||
SET(DSTDLIB_FLAGS "-lgtango")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-version=Tango")
|
||||
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-fversion=Phobos")
|
||||
SET(DSTDLIB_FLAGS "-lphobos -version=Phobos")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-version=Phobos")
|
||||
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(CMAKE_D_USE_PHOBOS)
|
||||
|
||||
# create a D shared library
|
||||
IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES> ${DSTDLIB_FLAGS}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
|
||||
|
||||
# create a D shared module just copy the shared library rule
|
||||
IF(NOT CMAKE_D_CREATE_SHARED_MODULE)
|
||||
SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY})
|
||||
ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE)
|
||||
|
||||
# create a D static library
|
||||
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"<CMAKE_RANLIB> <TARGET> ")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"
|
||||
"<CMAKE_RANLIB> <TARGET>")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
|
||||
|
||||
# compile a D file into an object file
|
||||
IF(NOT CMAKE_D_COMPILE_OBJECT)
|
||||
SET(CMAKE_D_COMPILE_OBJECT
|
||||
"<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>")
|
||||
ENDIF(NOT CMAKE_D_COMPILE_OBJECT)
|
||||
|
||||
IF(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_D_FLAGS
|
||||
CMAKE_D_FLAGS_DEBUG
|
||||
CMAKE_D_FLAGS_MINSIZEREL
|
||||
CMAKE_D_FLAGS_RELEASE
|
||||
CMAKE_D_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
SET(CMAKE_D_INFORMATION_LOADED 1)
|
||||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 CMakeCInformation.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
# This file sets the basic flags for the D language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
|
||||
GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_BASE_NAME gdc)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_BASE_NAME dmd)
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE
|
||||
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
|
||||
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
|
||||
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
|
||||
IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
|
||||
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D})
|
||||
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
IF(NOT CMAKE_MODULE_EXISTS)
|
||||
SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})
|
||||
SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})
|
||||
ENDIF(NOT CMAKE_MODULE_EXISTS)
|
||||
|
||||
SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING
|
||||
"Flags for D compiler.")
|
||||
|
||||
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
# default build type is none
|
||||
IF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
ENDIF(NOT CMAKE_NO_BUILD_TYPE)
|
||||
SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during debug builds.")
|
||||
SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release minsize builds.")
|
||||
SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
|
||||
SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during Release with Debug Info builds.")
|
||||
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
|
||||
IF(CMAKE_D_STANDARD_LIBRARIES_INIT)
|
||||
SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by defalut with all D applications.")
|
||||
MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES)
|
||||
ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT)
|
||||
|
||||
INCLUDE(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_D_CREATE_SHARED_MODULE
|
||||
# CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
# CMAKE_D_COMPILE_OBJECT
|
||||
# CMAKE_D_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# D compiler information
|
||||
# <CMAKE_D_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS>
|
||||
# <CMAKE_D_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
IF("$ENV{D_PATH}" STREQUAL "")
|
||||
STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH)
|
||||
ELSE("$ENV{D_PATH}" STREQUAL "")
|
||||
SET(D_PATH "$ENV{D_PATH}")
|
||||
ENDIF("$ENV{D_PATH}" STREQUAL "")
|
||||
MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}")
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_OUTPUT_D_FLAG "-o ")
|
||||
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
|
||||
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
|
||||
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
|
||||
SET(CMAKE_D_VERSION_FLAG "-fversion=")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_OUTPUT_D_FLAG "-of")
|
||||
SET(CMAKE_D_VERSION_FLAG "-version=")
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-L+")
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-I")
|
||||
FIND_PROGRAM(DMD_LIBRARIAN "lib.exe")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
|
||||
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
|
||||
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
|
||||
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
|
||||
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-fversion=Tango")
|
||||
SET(DSTDLIB_FLAGS "-lgtango")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-version=Tango")
|
||||
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-fversion=Phobos")
|
||||
SET(DSTDLIB_FLAGS "-lphobos -version=Phobos")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(DSTDLIB_TYPE "-version=Phobos")
|
||||
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(CMAKE_D_USE_PHOBOS)
|
||||
|
||||
# create a D shared library
|
||||
IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES> ${DSTDLIB_FLAGS}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
|
||||
|
||||
# create a D shared module just copy the shared library rule
|
||||
IF(NOT CMAKE_D_CREATE_SHARED_MODULE)
|
||||
SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY})
|
||||
ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE)
|
||||
|
||||
# create a D static library
|
||||
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"<CMAKE_RANLIB> <TARGET> ")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"
|
||||
"<CMAKE_RANLIB> <TARGET>")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_CREATE_STATIC_LIBRARY
|
||||
"${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
|
||||
|
||||
# compile a D file into an object file
|
||||
IF(NOT CMAKE_D_COMPILE_OBJECT)
|
||||
SET(CMAKE_D_COMPILE_OBJECT
|
||||
"<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>")
|
||||
ENDIF(NOT CMAKE_D_COMPILE_OBJECT)
|
||||
|
||||
IF(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}")
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}")
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
SET(CMAKE_D_LINK_EXECUTABLE
|
||||
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>")
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
ENDIF(NOT CMAKE_D_LINK_EXECUTABLE)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_D_FLAGS
|
||||
CMAKE_D_FLAGS_DEBUG
|
||||
CMAKE_D_FLAGS_MINSIZEREL
|
||||
CMAKE_D_FLAGS_RELEASE
|
||||
CMAKE_D_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
SET(CMAKE_D_INFORMATION_LOADED 1)
|
||||
|
|
|
@ -1,144 +1,154 @@
|
|||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that that selected D compiler can actually compile
|
||||
# and link the most basic of programs. If not, a fatal error
|
||||
# is set and cmake stops processing commands and will not generate
|
||||
# any makefiles or projects.
|
||||
|
||||
IF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"int main(char[][] args)\n"
|
||||
"{return args.sizeof-1;}\n")
|
||||
STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}")
|
||||
IF(DMDTEST STREQUAL "dmd")
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ELSE(DMDTEST STREQUAL "dmd")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(DMDTEST STREQUAL "dmd")
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken")
|
||||
message(STATUS "To force a specific D compiler set the DC environment variable")
|
||||
message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"")
|
||||
message(STATUS "If the D path is not set please use the D_PATH variable")
|
||||
message(STATUS " ie - export D_PATH=\"/opt/dmd\"")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the D compiler works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" "
|
||||
"is not able to compile a simple test program.\nIt fails "
|
||||
"with the following output:\n ${OUTPUT}\n\n"
|
||||
"CMake will not be able to correctly generate this project.")
|
||||
ELSE(NOT CMAKE_D_COMPILER_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the D compiler works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||
# re-configure this file CMakeDCompiler.cmake so that it gets
|
||||
# the value for CMAKE_SIZEOF_VOID_P
|
||||
# configure variables set in this file for fast reload later on
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
|
||||
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
|
||||
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
MESSAGE(STATUS "Check for working Phobos")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"import std.stdio;\n"
|
||||
"int main(char[][] args)\n"
|
||||
"{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n")
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
|
||||
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
MESSAGE(STATUS "Check for working Phobos -- unavailable")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if Phobos works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
#MESSAGE(FATAL_ERROR "Phobos does not work")
|
||||
ELSE(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working Phobos -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if Phobos works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "")
|
||||
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_TANGO_WORKS)
|
||||
MESSAGE(STATUS "Check for working Tango")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"import tango.io.Stdout;"
|
||||
"int main(char[][] args)\n"
|
||||
"{Stdout.newline();return args.sizeof-1;}\n")
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=gtango"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a"
|
||||
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_TANGO_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_TANGO_WORKS)
|
||||
MESSAGE(STATUS "Check for working Tango -- unavailable")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if Tango works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
#MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n")
|
||||
ELSE(NOT CMAKE_D_TANGO_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working Tango -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if Tango works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "")
|
||||
ENDIF(NOT CMAKE_D_TANGO_WORKS)
|
||||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that that selected D compiler can actually compile
|
||||
# and link the most basic of programs. If not, a fatal error
|
||||
# is set and cmake stops processing commands and will not generate
|
||||
# any makefiles or projects.
|
||||
|
||||
IF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"int main(char[][] args)\n"
|
||||
"{return args.sizeof-1;}\n")
|
||||
STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}")
|
||||
IF(DMDTEST STREQUAL "dmd")
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ELSE(DMDTEST STREQUAL "dmd")
|
||||
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(DMDTEST STREQUAL "dmd")
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken")
|
||||
message(STATUS "To force a specific D compiler set the DC environment variable")
|
||||
message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"")
|
||||
message(STATUS "If the D path is not set please use the D_PATH variable")
|
||||
message(STATUS " ie - export D_PATH=\"/opt/dmd\"")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the D compiler works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" "
|
||||
"is not able to compile a simple test program.\nIt fails "
|
||||
"with the following output:\n ${OUTPUT}\n\n"
|
||||
"CMake will not be able to correctly generate this project.")
|
||||
ELSE(NOT CMAKE_D_COMPILER_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the D compiler works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||
# re-configure this file CMakeDCompiler.cmake so that it gets
|
||||
# the value for CMAKE_SIZEOF_VOID_P
|
||||
# configure variables set in this file for fast reload later on
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
|
||||
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
|
||||
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
|
||||
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
MESSAGE(STATUS "Check for working Phobos")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"import std.stdio;\n"
|
||||
"int main(char[][] args)\n"
|
||||
"{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n")
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
|
||||
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
MESSAGE(STATUS "Check for working Phobos -- unavailable")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if Phobos works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
#MESSAGE(FATAL_ERROR "Phobos does not work")
|
||||
ELSE(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working Phobos -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if Phobos works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "")
|
||||
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_TANGO_WORKS)
|
||||
MESSAGE(STATUS "Check for working Tango")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
"import tango.io.Stdout;"
|
||||
"int main(char[][] args)\n"
|
||||
"{Stdout.newline();return args.sizeof-1;}\n")
|
||||
IF(CMAKE_COMPILER_IS_GDC)
|
||||
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=gtango"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(CMAKE_COMPILER_IS_GDC)
|
||||
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a"
|
||||
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
ENDIF(CMAKE_COMPILER_IS_GDC)
|
||||
SET(C_TEST_WAS_RUN 1)
|
||||
ENDIF(NOT CMAKE_D_TANGO_WORKS)
|
||||
|
||||
IF(NOT CMAKE_D_TANGO_WORKS)
|
||||
MESSAGE(STATUS "Check for working Tango -- unavailable")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if Tango works failed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
#MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n")
|
||||
ELSE(NOT CMAKE_D_TANGO_WORKS)
|
||||
IF(C_TEST_WAS_RUN)
|
||||
MESSAGE(STATUS "Check for working Tango -- works")
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if Tango works passed with "
|
||||
"the following output:\n${OUTPUT}\n\n")
|
||||
ENDIF(C_TEST_WAS_RUN)
|
||||
SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "")
|
||||
ENDIF(NOT CMAKE_D_TANGO_WORKS)
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 gcc.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
SET(DSTDLIB_FLAGS "-version=Tango")
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
SET(DSTDLIB_FLAGS "-version=Phobos")
|
||||
ENDIF(CMAKE_D_USE_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_FLAGS_INIT "-version=Posix ${DSTDLIB_FLAGS} -I$ENV{D_PATH}/include -I$ENV{D_PATH}/import")
|
||||
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${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 ${DDOC_FLAGS}")
|
||||
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
|
||||
|
||||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 gcc.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
SET(DSTDLIB_FLAGS "-version=Tango")
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
SET(DSTDLIB_FLAGS "-version=Phobos")
|
||||
ENDIF(CMAKE_D_USE_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_FLAGS_INIT "-version=Win ${DSTDLIB_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${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 ${DDOC_FLAGS}")
|
||||
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
|
||||
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 gcc.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
SET(DSTDLIB_FLAGS "-fversion=Tango")
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
SET(DSTDLIB_FLAGS "-fversion=Phobos")
|
||||
ENDIF(CMAKE_D_USE_PHOBOS)
|
||||
IF(CMAKE_D_BUILD_DOCS)
|
||||
SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
|
||||
FOREACH(item ${CMAKE_D_DDOC_FILES})
|
||||
SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(CMAKE_D_BUILD_DOCS)
|
||||
|
||||
SET (CMAKE_D_FLAGS_INIT "-fversion=Posix ${DSTDLIB_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
|
||||
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
|
||||
|
||||
#
|
||||
# CMakeD - CMake module for D Language
|
||||
#
|
||||
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
|
||||
# Tim Burrell <tim.burrell@gmail.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# See Copyright.txt for details.
|
||||
#
|
||||
# Modified from CMake 2.6.5 gcc.cmake
|
||||
# See http://www.cmake.org/HTML/Copyright.html for details
|
||||
#
|
||||
|
||||
IF(CMAKE_D_USE_TANGO)
|
||||
SET(DSTDLIB_FLAGS "-fversion=Tango")
|
||||
ENDIF(CMAKE_D_USE_TANGO)
|
||||
IF(CMAKE_D_USE_PHOBOS)
|
||||
SET(DSTDLIB_FLAGS "-fversion=Phobos")
|
||||
ENDIF(CMAKE_D_USE_PHOBOS)
|
||||
IF(CMAKE_D_BUILD_DOCS)
|
||||
SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
|
||||
FOREACH(item ${CMAKE_D_DDOC_FILES})
|
||||
SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(CMAKE_D_BUILD_DOCS)
|
||||
|
||||
SET (CMAKE_D_FLAGS_INIT "-fversion=Win ${DSTDLIB_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")
|
||||
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
|
||||
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
|
||||
|
||||
|
|
Loading…
Reference in a new issue