Added new simplified C + D tests. Removed straggling full test skeleton files.

This commit is contained in:
Steve King 2010-08-14 00:00:09 -07:00
parent 02d13655b2
commit fa00060dda
7 changed files with 21 additions and 422 deletions

View file

@ -25,4 +25,5 @@ ADD_SUBDIRECTORY (lib_2)
ADD_SUBDIRECTORY (app_1)
ADD_SUBDIRECTORY (app_2)
ADD_SUBDIRECTORY (app_3)
ADD_SUBDIRECTORY (app_5)
ADD_SUBDIRECTORY (app_4)

View file

@ -1,115 +0,0 @@
#################################
# Preamble
##############
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# is checked
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Using Phobos OR Tango (can be specified from cmake command line)
if (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
# default to phobos
message(STATUS "This application can be built with either Phobos or Tango!")
message(STATUS "You did not specify a standard library -- defaulting to Phobos.")
message(STATUS "If you wish to use Tango add -DCMAKE_D_USE_TANGO=True to cmake command line.")
set(CMAKE_D_USE_PHOBOS True)
endif (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
# check for DDoc usage
include(UseDDoc)
#################################
# Project
##############
project(FullSkeleton C D)
#################################
# Defines
##############
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(APPLICATION_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
#################################
# Configure Includes / Settings
##############
# set default build type to release
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif (NOT CMAKE_BUILD_TYPE)
# add definitions
include(DefineProjectDefaults)
include(DefineProjectOptions)
include(DefineCompilerFlags)
include(DefineInstallationPaths)
# add macros
include(MacroAddPlugin)
include(MacroEnsureOutOfSourceBuild)
include(ConfigureChecks.cmake)
# config.d
configure_file(config.d.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.d)
#################################
# Sub-directories
##############
subdirs(libraryA libraryB programClient programServer)
#################################
# Information
##############
message(STATUS "Installation Variables:
Build Type (CMAKE_BUILD_TYPE): ${CMAKE_BUILD_TYPE}
Install Prefix (CMAKE_INSTALL_PREFIX): ${CMAKE_INSTALL_PREFIX}
Data Dir (DATA_INSTALL_DIR): ${DATA_INSTALL_DIR}
Lib Dir (LIB_INSTALL_DIR): ${LIB_INSTALL_DIR}
Plugin Dir (PLUGIN_INSTALL_DIR): ${PLUGIN_INSTALL_DIR}
Config Dir (SYSCONF_INSTALL_DIR): ${SYSCONF_INSTALL_DIR}
Build Client (BUILD_CLIENT): ${BUILD_CLIENT}
Build Server (BUILD_SERVER): ${BUILD_SERVER}
Build X11 Renderer (BUILD_RENDERER_X11): ${BUILD_RENDERER_X11}
Build Windows Renderer (BUILD_RENDERER_WIN): ${BUILD_RENDERER_WIN}
Build Documentation (CMAKE_D_BUILD_DOCS): ${CMAKE_D_BUILD_DOCS}
DDoc Files (CMAKE_D_DDOC_FILES): ${CMAKE_D_DDOC_FILES}"
)
#################################
# Packing
##############
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-linux-i686")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CPACK_GENERATOR "TGZ;TBZ2;ZIP")
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "\\\\.svn/;/debug/;/optimized/;/documentation/;[a-z]*\\\\.kdev*;[a-z]*\\\\.tag;[a-z]*\\\\.pyc")
if (WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
SET(CPACK_NSIS_MODIFY_PATH ON)
else (WIN32 AND NOT UNIX)
set(CPACK_STRIP_FILES "${PROJECT_NAME}/${PROJECT_NAME}")
set(CPACK_SOURCE_STRIP_FILES "")
endif (WIN32 AND NOT UNIX)
set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
include(CPack)

View file

@ -1,237 +0,0 @@
#
# 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_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LINK_LIBRARY_FLAG "-L+")
SET(CMAKE_LIBRARY_PATH_FLAG "-L+")
SET(CMAKE_LIBRARY_PATH_TERMINATOR "\\")
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")
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 "-lgphobos")
ELSE(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-version=Phobos")
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -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)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET>.lib <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET>.lib "
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> "
)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> "
)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
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)

View file

@ -1,70 +0,0 @@
#################################
# Project
##############
project(libraryA D)
#################################
# Dependencies
##############
# INotify
if (HAVE_INOTIFY_INIT)
set(INOTIFY_SOURCES "io/INotify.d")
set(INOTIFY_DEFINITIONS "${INOTIFY_DEFINITIONS} ${CMAKE_D_VERSION_FLAG}INotify" CACHE BOOLEAN TRUE FORCE)
endif (HAVE_INOTIFY_INIT)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
link_directories(
)
add_definitions(
${INOTIFY_DEFINITIONS}
)
#################################
# Source Files
##############
add_library(A STATIC
core/Exception.d
${INOTIFY_SOURCES}
io/Output.d
mixins/BladeParse.d
mixins/HandyMixins.d
mixins/HandyMixinHelpers.d
)
#################################
# Linking
##############
target_link_libraries(A
)
#################################
# Clean ddoc's
##############
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_D_DDOC_CLEAN_FILES}")
#################################
# Install Files
##############
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${sources}
DESTINATION
include/FullSkeleton/A
)

View file

@ -0,0 +1,7 @@
# This is a D app that links a C object.
#
# The linker preference of D is higher than C (or CXX), so after
# the objects are created, the D toolchain will drive linking.
#
ADD_EXECUTABLE ( app_5 app_5.d cfunc.c )
ADD_TEST( app_5 app_5 )

9
tests/app_5/app_5.d Normal file
View file

@ -0,0 +1,9 @@
extern(C) int cfunc( int x );
int main()
{
int x = 1;
int y;
y = cfunc(x);
assert( y == x + 1 );
return 0;
}

4
tests/app_5/cfunc.c Normal file
View file

@ -0,0 +1,4 @@
int cfunc( int x )
{
return x + 1;
}