Try to make gdc work

This commit is contained in:
Jens K. Mueller 2010-12-09 23:08:33 +01:00
parent 24422fdac3
commit 6079bb6957
8 changed files with 31 additions and 10 deletions

View file

@ -166,11 +166,10 @@ ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
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)
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY AND CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS)
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_D_COMPILER> -lib <OBJECTS> ${CMAKE_D_DASH_O}<TARGET>")
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
"<CMAKE_D_COMPILER> ${CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS} <OBJECTS> ${CMAKE_D_DASH_O}<TARGET>")
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY AND CMAKE_STATIC_LIBRARY_CREATE_D_FLAGS)
# Create a static archive incrementally for large object file counts.
# If CMAKE_D_CREATE_STATIC_LIBRARY is set it will override these.
@ -181,7 +180,7 @@ SET(CMAKE_D_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# compile a D file into an object file
IF(NOT CMAKE_D_COMPILE_OBJECT)
SET(CMAKE_D_COMPILE_OBJECT
"<CMAKE_D_COMPILER> <FLAGS> -od${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_D_DASH_O}<OBJECT> -c <SOURCE>")
"<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_D_DASH_O}<OBJECT> -c <SOURCE>")
ENDIF(NOT CMAKE_D_COMPILE_OBJECT)
IF(NOT CMAKE_D_LINK_EXECUTABLE)

View file

@ -25,6 +25,8 @@ SET(CMAKE_D_OUTPUT_EXTENSION .o)
SET(CMAKE_D_DASH_O "-of")
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_LINK_D_FLAGS "") # +s, flag for exe link to use shared lib

View file

@ -11,6 +11,7 @@
# Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
MESSAGE( "**** Debug Info: Enter Linux-gdc.cmake" )
SET(CMAKE_D_DASH_O "-o")
SET(CMAKE_BASE_NAME gdc)
@ -28,7 +29,8 @@ IF(CMAKE_D_BUILD_DOCS)
ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-fversion=Posix -fversion=${CMAKE_BUILD_TYPE}Build ${DSTDLIB_FLAGS}")
#SET (CMAKE_D_FLAGS_INIT "-fversion=Posix -fversion=${CMAKE_BUILD_TYPE}Build ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_INIT "")
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}")
@ -37,3 +39,6 @@ SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
MESSAGE( "**** Debug Info: Exit Linux-gdc.cmake" )

View file

@ -25,6 +25,8 @@ SET(CMAKE_D_OUTPUT_EXTENSION .obj)
SET(CMAKE_D_DASH_O "-of")
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_LINK_D_FLAGS "") # +s, flag for exe link to use shared lib

View file

@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 2.8.1)
# in the project declaration. Listing other languages
# is fine.
PROJECT (CMAKED2_TESTS C D )
SET( GLOBAL_DMD_DEFS "-w -wi" )
SET( GLOBAL_GCC_DEFS "-Wall -pedantic -m32" )
SET( GLOBAL_DMD_DEFS "-w" )
SET( GLOBAL_GCC_DEFS "-Wall -pedantic" )
# Don't use ADD_DEFINITIONS() with a mixed C + D project
# since that adds the same flags to both C and D builds.

View file

@ -3,5 +3,11 @@
# The linker preference of D is higher than C (or CXX), so after
# the objects are created, the D toolchain will drive linking.
#
# TODO
# dirty fix
# we should make the CMAKE_D_COMPILER_ID work
IF("${CMAKE_BASE_NAME}" MATCHES "dmd")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" )
ENDIF()
ADD_EXECUTABLE ( app_5 app_5.d cfunc.c )
ADD_TEST( app_5 app_5 )

View file

@ -1,4 +1,6 @@
include(UseDDeps)
include_directories(.)
add_executable_with_dependencies(app_8 app_8.d)
# TODO
# disabled causes problems with gdc
#add_executable_with_dependencies(app_8 app_8.d)

View file

@ -1,4 +1,9 @@
# This project is a C library
PROJECT( lib_2 C )
ADD_DEFINITIONS( ${GLOBAL_C_DEFS} )
# TODO
# dirty fix
# we should make the CMAKE_D_COMPILER_ID work
IF("${CMAKE_BASE_NAME}" MATCHES "dmd")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" )
ENDIF()
ADD_LIBRARY( lib_2 STATIC lib_2.c )