Commit 1954b48d authored by Hans-Nikolai Viessmann's avatar Hans-Nikolai Viessmann
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !47
parents 617f2f31 4031e894
......@@ -47,6 +47,10 @@ stages:
- mkdir build && cd build
- cmake ../cmake/cpack
- make -j2 2>&1 | tee build.log
- if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "!!! ERROR detected in build !!!";
exit 1;
fi
- if [ $(grep -i 'warning' build.log | wc -l) -gt 0 ]; then
echo "+++ ${WARN_NUM} warnings detected +++";
grep -i 'warning' build.log;
......@@ -107,6 +111,10 @@ stages:
- mkdir stdlib-build && cd stdlib-build
- cmake -DSAC2C_EXEC=${SAC2CP_EXEC} ../stdlib
- make -j2 2>&1 | tee build.log
- if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "!!! ERROR detected in build !!!";
exit 1;
fi
- if [ $(grep -i 'warning' build.log | wc -l) -gt 0 ]; then
echo "+++ ${WARN_NUM} warnings detected +++";
grep -i 'warning' build.log;
......@@ -145,6 +153,21 @@ stages:
- schedules
- tags
.tag-release-template: &tag-release-template
stage: release
script:
# skip if we don't want to ship the release
- if [ ! -d ${HOME}/.ssh ]; then mkdir ${HOME}/.ssh; fi
- chmod 700 ${HOME}/.ssh
- echo "${SSH_RELEASE_KEY}" > $HOME/.ssh/release
- chmod 600 ${HOME}/.ssh/release
- if [ ! -d build ] || [ ! -d stdlib-build ]; then echo "Unable to find artifacts"; exit 1; fi
- scp -p -i ${HOME}/.ssh/release -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
build/${RELEASE_FILE} stdlib-build/${RELEASE_FILE} ${RELEASE_URL}:${RELEASE_TOPDIR}/${INNER_PATH}
- echo "Tag release has been sent, have a look at the sac-home.org download page :)"
only:
- tags
.weekly-release-template: &weekly-release-template
stage: release
script:
......@@ -156,10 +179,9 @@ stages:
- if [ ! -d build ] || [ ! -d stdlib-build ]; then echo "Unable to find artifacts"; exit 1; fi
- scp -p -i ${HOME}/.ssh/release -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
build/${RELEASE_FILE} stdlib-build/${RELEASE_FILE} ${RELEASE_URL}:${RELEASE_TOPDIR}/${INNER_PATH}
- echo "Release has been sent, have a look at the sac-home.org download page :)"
- echo "Weekly release has been sent, have a look at the sac-home.org download page :)"
only:
- schedules
- tags
# Here we define the actual jobs - we must specify each build OS separately as GitLab-CI
# does not support launch a job on all OSs as such.
......@@ -199,9 +221,20 @@ package-archlinux:
dependencies:
- stdlib-archlinux
release-tag-archlinux:
variables:
INNER_PATH: "release/Linux"
RELEASE_FILE: "*.tar.gz"
GIT_STRATEGY: none
<<: *tag-release-template
tags:
- archlinux
dependencies:
- package-archlinux
release-weekly-archlinux:
variables:
INNER_PATH: "TGZ-weekly/Linux"
INNER_PATH: "weekly/Linux"
RELEASE_FILE: "*.tar.gz"
GIT_STRATEGY: none
<<: *weekly-release-template
......@@ -241,9 +274,20 @@ package-centos7:
dependencies:
- stdlib-centos7
release-tag-centos7:
variables:
INNER_PATH: "release/RHEL7"
RELEASE_FILE: "*.rpm"
GIT_STRATEGY: none
<<: *tag-release-template
tags:
- centos7
dependencies:
- package-centos7
release-weekly-centos7:
variables:
INNER_PATH: "RPM-weekly/RHEL7"
INNER_PATH: "weekly/RHEL7"
RELEASE_FILE: "*.rpm"
GIT_STRATEGY: none
<<: *weekly-release-template
......@@ -283,9 +327,20 @@ package-centos6:
dependencies:
- stdlib-centos6
release-tag-centos6:
variables:
INNER_PATH: "release/RHEL6"
RELEASE_FILE: "*.rpm"
GIT_STRATEGY: none
<<: *weekly-release-template
tags:
- centos6
dependencies:
- package-centos6
release-weekly-centos6:
variables:
INNER_PATH: "RPM-weekly/RHEL6"
INNER_PATH: "release/RHEL6"
RELEASE_FILE: "*.rpm"
GIT_STRATEGY: none
<<: *weekly-release-template
......@@ -325,9 +380,20 @@ package-ubuntu16:
dependencies:
- stdlib-ubuntu16
release-tag-ubuntu16:
variables:
INNER_PATH: "release/Ubl16"
RELEASE_FILE: "*.deb"
GIT_STRATEGY: none
<<: *tag-release-template
tags:
- ubuntu16
dependencies:
- package-ubuntu16
release-weekly-ubuntu16:
variables:
INNER_PATH: "DEB-weekly/Ubl16"
INNER_PATH: "weekly/Ubl16"
RELEASE_FILE: "*.deb"
GIT_STRATEGY: none
<<: *weekly-release-template
......@@ -367,9 +433,20 @@ package-ubuntu14:
dependencies:
- stdlib-ubuntu14
release-tag-ubuntu14:
variables:
INNER_PATH: "release/Ubl14"
RELEASE_FILE: "*.deb"
GIT_STRATEGY: none
<<: *tag-release-template
tags:
- ubuntu14
dependencies:
- package-ubuntu14
release-weekly-ubuntu14:
variables:
INNER_PATH: "DEB-weekly/Ubl14"
INNER_PATH: "weekly/Ubl14"
RELEASE_FILE: "*.deb"
GIT_STRATEGY: none
<<: *weekly-release-template
......
......@@ -139,7 +139,7 @@ UNSET (BINARY_DIR) # make sure we don't cause a conflict
UNSET (STAMP_DIR) # make sure we don't cause a conflict
# Create a target which links to the clean step
ExternalProject_Add_StepTargets(runtime_libraries clean)
# Add the target as a dependency to the `fullclean' target
# Add the target as a dependency to the `fullclean' target
ADD_DEPENDENCIES (fullclean runtime_libraries-clean)
# this target is meant to copy over the sac2crc prelude file to the users
......@@ -161,7 +161,7 @@ MACRO (ADD_INSTALL_TARGET)
SET (deps ${ARGN})
LIST (REMOVE_AT deps 0)
ADD_CUSTOM_TARGET (${name}-install
DEPENDS ${deps}
DEPENDS ${deps}
COMMAND
"${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=${name} -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
UNSET (name)
......@@ -175,6 +175,7 @@ ADD_INSTALL_TARGET ("headers" sac_h)
ADD_INSTALL_TARGET ("libraries" sac2cShared runtime_libraries)
ADD_INSTALL_TARGET ("rtapplications" runtime_libraries)
ADD_INSTALL_TARGET ("sources")
ADD_INSTALL_TARGET ("symlinks")
# Installing the sac2c project files.
XINSTALL (TARGETS sac2c RUNTIME DESTINATION "${TREEPATH_INSTALL}" COMPONENT applications)
......@@ -246,7 +247,7 @@ XINSTALL (FILES
EXCLUDE_FROM_ALL)
# we install readme and install script
CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/cmake/cpack/dists/archive/installer.sh.in ${PROJECT_BINARY_DIR}/archive/installer-${BUILD_TYPE_NAME}.sh @ONLY)
CONFIGURE_FILE (${PROJECT_SOURCE_DIR}/cmake/cpack/dists/archive/installer.sh.in ${PROJECT_BINARY_DIR}/archive/installer-${BUILD_TYPE_NAME}.sh @ONLY)
XINSTALL (FILES
${PROJECT_BINARY_DIR}/archive/installer-${BUILD_TYPE_NAME}.sh
DESTINATION "${INSTALLER_INSTALL}"
......@@ -260,29 +261,54 @@ XINSTALL (FILES
COMPONENT sources
EXCLUDE_FROM_ALL)
# we create symlinks for the bins (this is to make using the MacOS package nicer)
# this can also ease users in there initial setup of SaC
IF (UNIX)
ADD_CUSTOM_TARGET (bin-symlinks ALL
COMMAND ${CMAKE_COMMAND} -E make_directory bin
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/sac2c${BUILD_TYPE_POSTFIX}" "bin/sac2c${BUILD_TYPE_POSTFIX}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/sac4c${BUILD_TYPE_POSTFIX}" "bin/sac4c${BUILD_TYPE_POSTFIX}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/sac2tex${BUILD_TYPE_POSTFIX}" "bin/sac2tex${BUILD_TYPE_POSTFIX}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/saccc${BUILD_TYPE_POSTFIX}" "bin/saccc${BUILD_TYPE_POSTFIX}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/csimt${BUILD_TYPE_POSTFIX}" "bin/csimt${BUILD_TYPE_POSTFIX}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${TREEPATH_CONF}/csima${BUILD_TYPE_POSTFIX}" "bin/csima${BUILD_TYPE_POSTFIX}"
DEPENDS check_repo_version
COMMENT "Creating Symlinks"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
ADD_INSTALL_TARGET ("symlinks" bin-symlinks)
XINSTALL (DIRECTORY ${PROJECT_BINARY_DIR}/bin
DESTINATION "${TOP_INSTALL}"
COMPONENT symlinks
EXCLUDE_FROM_ALL)
# (hans) NOTE: We need to create the `_top_install` and `_bin_install` variables
# for when we install symlinks using `INSTALL (CODE ...)`. These two variables
# are based upon the `TOP_INSTALL` and `BIN_INSTALL` variables found in
# sac2c/config.cmake - these variables are automatically generated and are
# prepended with a ``package prefix'' when using CPack directly. The `*_INSTALL`
# variables are relative paths on where to install the generated SAC binaries
# and libraries during the install stage of the build system. The `_*_install`
# variables are only needed for the symlinks because we are using the `INSTALL
# (CODE ...)` function instead of the `INSTALL(... DESTINATION ...)` function.
# In the latter's case, internally any relative path given as a parameter to
# DESTINATION is prepended with CMAKE_INSTALL_PREFIX (and also `ENV(DESTDIR)`).
# This is so that the install stage can correctly place the resulting
# files/dirs. `DESTDIR` is set via `make DESTDIR=... install`, typically only
# called by CPack packagers that don't support directly changing
# CMAKE_INSTALL_PREFIX, or defining their own pakaging prefix via
# `PACKAGE_PREFIX...` (see sac2c/config.cmake). In our case, because we are
# using a CODE block to run the sac2c-version-manager script, this internal
# facility is not given. The generation of the two variables mimics the internal
# action and allows for the script to be prepended with CMAKE_INSTALL_PREFIX.
IF (NOT IS_ABSOLUTE "${BIN_INSTALL}")
# We escape ${CMAKE_INSTALL_PREFIX} because the install stage resolves this
# variable independently of the configure stage - this allows CPack and other
# tools to affect where files/dirs are installed too.
SET (_bin_install "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL}")
ELSE ()
SET (_bin_install "${BIN_INSTALL}")
ENDIF ()
IF (NOT IS_ABSOLUTE "${TOP_INSTALL}")
# We escape ${CMAKE_INSTALL_PREFIX} because the install stage resolves this
# variable independently of the configure stage - this allows CPack and other
# tools to affect where files/dirs are installed too.
SET (_top_install "\\\${CMAKE_INSTALL_PREFIX}/${TOP_INSTALL}")
ELSE ()
SET (_top_install "${TOP_INSTALL}")
ENDIF ()
# We use the sac2c-version-manager script instead of the CMAKE's facility to
# create symlinks because the scripts does additional checks to make sure
# that the links are sanely done and don't accidentally overwrite anything
# that should t be overwritten.
XINSTALL (
CODE "EXECUTE_PROCESS(COMMAND
${PROJECT_BINARY_DIR}/scripts/sac2c-version-manager install
\"${SAC2C_VERSION}\" \"${CMAKE_BUILD_TYPE}\"
\"${_top_install}\" \"${_bin_install}\")"
COMPONENT symlinks)
# now lets setup packaging (using CPack)
SET(SAC2C_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
INCLUDE ("${PROJECT_SOURCE_DIR}/cmake/cpack/config.cmake")
......
###############################################################################
#
# Calling conventions:
#
# Start rules:
# default compile executables as developer code and libraries as product
# code
# devel compile everything as developer code
# prod compile everything as product code
#
# clean cleanup all derived files
# cleandevel cleanup only developer compiled files
# cleanprod cleanup only product compiled files
#
# tidy cleanup all derived files excluding make tools
# tidydevel cleanup only developer compiled files excluding make tools
# tidyprod cleanup only product compiled files excluding make tools
#
# refactor refactor source code (requires parameters below)
#
# config rebuild autoconf-gnerated scripts, e.g. configure,
# src/include/config.h.in, etc.
#
# install install sac2c under the $PREFIX directory. Please note
# that $PREFIX can be set when you run ./configure via
# ./configure --prefix=/path/to/some/location
# Also, make sure that your $PREFIX/bin is on the PATH.
#
# uninstall Remove the files created by the install target. Please
# note that it does not remove a directory structure, only
# the files.
#
# Parameters:
# DEPS="no" de-activate dependency checking meachanism
# HIDE="" show important commands issued by make (debugging)
#
# Refactor parameters:
# PATTERN="" pattern to look for in all source files
# OUTPUT="" text to replace matched pattern
#
###############################################################################
# This Makefile is a wrapper around cmake that allows to quickly
# make default build and install of product and development versions
# of the compiler.
BUILD_DIR_DEBUG := build_d
BUILD_DIR_RELEASE := build_r
MAKE_NUMTHREADS ?= 4
###############################################################################
#
# general setup:
#
define BUILD =
if [ -d $(1) ]; then \
cd $(1); make -j$(MAKE_NUMTHREADS); cd -; \
else \
mkdir -p $(1); \
cd $(1); \
cmake -DCMAKE_BUILD_TYPE=$(2) ..; \
$(MAKE) -j$(MAKE_NUMTHREADS); \
cd -; \
fi
endef
PROJECT_ROOT := .
HIDE := @
DEPS := yes
CLEAN_MAKE_TOOLS := "yes"
all: release debug
MAKEFILE_DIR := $(PROJECT_ROOT)/src/makefiles
release:
$(call BUILD,$(BUILD_DIR_RELEASE),RELEASE)
-include $(MAKEFILE_DIR)/config.mkf # config.mkf may not yet exist
include $(MAKEFILE_DIR)/settings.mkf
debug:
$(call BUILD,$(BUILD_DIR_DEBUG),DEBUG)
# A function that outputs an argument surrounded by the box of stars.
# Like this:
# ********
# * arg
# ********
# The first and second line are expansions of $(frame_stars) variable.
frame_stars := "************************************************************"
framed_text = @$(ECHO) -e "$(frame_stars)\n* $(1)\n$(frame_stars)"
clean: clean-release clean-debug
clean-release:
$(RM) -rf $(BUILD_DIR_RELEASE)
###############################################################################
#
# Dummy rules
#
clean-debug:
$(RM) -rf $(BUILD_DIR_DEBUG)
.PHONY: default devel prod clean cleandevel cleanprod config \
tidy tidydevel tidyprod
install: install-debug install-release
install-release: release
cd $(BUILD_DIR_RELEASE); make install; cd -
@echo "Please run $(BUILD_DIR_RELEASE)/scripts/sac2c-version-manager " \
"now to set symlinks correctly."
###############################################################################
#
# Start rules
#
# The definition of these rules deliberately enforces a sequence in compilation
# rather than expressing the dependencies properly by makefile rules.
#
# The rationale is that commonlib and maketools rather seldomly require
# recompilation. With proper dependencies, however, they would require a
# dependency from every compilation rule. This would lead to extensive
# rechecking at compile time that is absolutely superfluous.
#
# The runtime system may require the compiler and, likewise, the tools may
# need the runtime system or parts thereof. Expressing all this by dependencies
# would lead to a system in which the tools form the main target. This seems
# unnatural.
#
# Furthermore, the current solution allows us to rebuild locally without
# enforcing dependency checks.
#
install-debug: debug
cd $(BUILD_DIR_DEBUG); make install; cd -
@echo "Please run $(BUILD_DIR_DEBUG)/scripts/sac2c-version-manager " \
"now to set symlinks correctly."
default devel prod: checks
$(call framed_text,Building $(PROJECT_NAME))
$(HIDE) $(MAKE) -C src/maketools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/maketools/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/libsac2c DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/libsac2c/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/runtime DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/runtime/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/tools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/tools/" PREFIX_ROOT="" $@
$(HIDE) for t in $(BUILD_TARGETS); do \
$(MAKE) -f $(MAKEFILE_DIR)/rtlibs.mkf HIDE="$(HIDE)" TARGET=$$t all || exit 1; \
done
$(call framed_text,Building $(PROJECT_NAME) completed)
###############################################################################
#
# Cleaning rules
#
clean cleandevel cleanprod: checks
$(call framed_text,Cleaning $(PROJECT_NAME))
$(HIDE) if [ "$(CLEAN_MAKE_TOOLS)" = "yes" ]; then \
$(MAKE) -C src/maketools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/maketools/" PREFIX_ROOT="" $@ ; \
fi
$(HIDE) $(MAKE) -C src/libsac2c DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/libsac2c/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/runtime DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/runtime/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/tools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/tools/" PREFIX_ROOT="" $@
$(HIDE) for t in $(BUILD_TARGETS); do \
$(MAKE) -f $(MAKEFILE_DIR)/rtlibs.mkf HIDE="$(HIDE)" TARGET=$$t clean || exit 1; \
done
$(HIDE) $(RM) -rf lib/* bin/*
$(call framed_text,Cleaning $(PROJECT_NAME) completed)
tidy:
$(MAKE) CLEAN_MAKE_TOOLS="no" clean
tidydevel:
$(MAKE) CLEAN_MAKE_TOOLS="no" cleandevel
tidyprod:
$(MAKE) CLEAN_MAKE_TOOLS="no" cleanprod
###############################################################################
#
# Refactoring rules
#
refactor: checks
$(call framed_text,Refactoring $(PROJECT_NAME))
$(HIDE) $(MAKE) -C src/maketools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/maketools/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/libsac2c DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/libsac2c/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/runtime DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/runtime/" PREFIX_ROOT="" $@
$(HIDE) $(MAKE) -C src/tools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/tools/" PREFIX_ROOT="" $@
$(call framed_text,Refactoring $(PROJECT_NAME) completed)
###############################################################################
#
# Rules for making selected subprojects in default mode
#
maketools: checks
$(HIDE) $(MAKE) -C src/maketools DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/maketools/" PREFIX_ROOT="" default
libsac2c: checks
$(HIDE) $(MAKE) -C src/libsac2c DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/libsac2c/" PREFIX_ROOT="" default
runtime: checks
$(HIDE) $(MAKE) -C src/runtime DEPS="$(DEPS)" HIDE="$(HIDE)" \
PREFIX_LOCAL="src/runtime/" PREFIX_ROOT="" default
tools: checks
$(HIDE) $(MAKE) -C src/tools DEPS="$(DEPS)" HIDE="$(HIDE)" \
LIBS="$(LIBS)" POLYLIBINCLUDE="$(POLYLIBINCLUDE)" \
PREFIX_LOCAL="src/tools/" PREFIX_ROOT="" default
rtlibs: checks
$(HIDE) for t in $(BUILD_TARGETS); do \
$(MAKE) -f $(MAKEFILE_DIR)/rtlibs.mkf HIDE="$(HIDE)" TARGET=$$t || exit 1; \
done
###############################################################################
#
# Rules to create configure the script. Put it here as a first target.
#
config:
autoreconf -v -f -i -I setup/config
###############################################################################
#
# Includes for consistency checking mechanism
#
include $(MAKEFILE_DIR)/check.mkf
install: checks-install
$(INSTALL) -d "$(INCPATH_CONF)"
$(INSTALL) -d "$(SAC2CRC_DIR)"
$(INSTALL) -d "$(bindir)"
$(INSTALL) -d $(DLL_DIR)
$(RM) .uninstall
for i in include/*.h; do \
dst="$(INCPATH_CONF)"/`basename $$i`; \
$(ECHO) "$$dst" >>.uninstall; \
$(INSTALL_DATA) $$i "$$dst"; \
done
$(ECHO) "$(SAC2CRC_CONF)" >>.uninstall
$(INSTALL_DATA) setup/sac2crc "$(SAC2CRC_CONF)"
for i in bin/*; do \
dst1="$(DLL_DIR)"/`basename $$i`; \
$(ECHO) "$$dst1" >>.uninstall; \
$(INSTALL_PROGRAM) $$i "$$dst1"; \
dst2="$(bindir)"/`basename $$i`; \
$(ECHO) "$$dst2" >>.uninstall; \
$(RM) "$$dst2"; $(LN) "$$dst1" "$$dst2"; \
done
for i in lib/*.*; do \
dst="$(DLL_DIR)"/`basename $$i`; \
$(ECHO) "$$dst" >>.uninstall; \
$(INSTALL_PROGRAM) $$i "$$dst"; \
done
for t in $(BUILD_TARGETS); do \
$(MAKE) -f $(MAKEFILE_DIR)/rtlibs.mkf HIDE="$(HIDE)" TARGET=$$t install; \
done
uninstall:
if test -r .uninstall; then \
cat .uninstall | while read f; do $(RM) "$$f"; done; \
fi
......@@ -56,7 +56,7 @@ ADD_CUSTOM_TARGET(fulltest COMMENT "Testing all build dirs...")
# Is only parameter is the build type, which is one supported by the
# CMAKE_BUILD_TYPE variable.
# This macro also creates a target to do a clean of the build directory
# of the externalproject, which is attached to the target `fullclean'.
# of the externalproject, which is attached to the target `fullclean'.
MACRO (ADD_SAC2C_BUILD _build_type)
STRING (TOLOWER "${_build_type}" _build_type_name)
# Notice that we manually do the install, this is to ensure that the
......@@ -95,7 +95,7 @@ MACRO (ADD_SAC2C_BUILD _build_type)
ALWAYS 1)
# Create a target which links to the clean step
ExternalProject_Add_StepTargets(sac2c-${_build_type_name} clean)
# Add the target as a dependency to the `fullclean' target
# Add the target as a dependency to the `fullclean' target
ADD_DEPENDENCIES (fullclean sac2c-${_build_type_name}-clean)
# Create step target to expose `test' and attach it to out `fulltest' target
ExternalProject_Add_StepTargets(sac2c-${_build_type_name} test)
......@@ -112,37 +112,6 @@ FOREACH (type ${BUILDTYPELIST})
ADD_SAC2C_BUILD (${type})
ENDFOREACH ()
# TODO (hans): this is buggy when building dirty as we can't stop this from running.
ADD_CUSTOM_TARGET (generic-symlinks ALL
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROJECT_BINARY_DIR}/toplevel/symlinks/${CMAKE_INSTALL_PREFIX}/bin"
COMMAND ${CMAKE_COMMAND} -E create_symlink "sac2c_p" "sac2c"
COMMAND ${CMAKE_COMMAND} -E create_symlink "sac4c_p" "sac4c"
COMMAND ${CMAKE_COMMAND} -E create_symlink "sac2tex_p" "sac2tex"
COMMAND ${CMAKE_COMMAND} -E create_symlink "saccc_p" "saccc"
COMMAND ${CMAKE_COMMAND} -E create_symlink "csimt_p" "csimt"
COMMAND ${CMAKE_COMMAND} -E create_symlink "csima_p" "csima"
DEPENDS ${SAC_TARGETS}
COMMENT "Creating generic symlinks"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/toplevel/symlinks/${CMAKE_INSTALL_PREFIX}/bin)
# create symbolic links to binaries
# XXX(hans) we should not do this for distributable packages
# INSTALL (CODE
# "FILE (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/toplevel/${CMAKE_INSTALL_PREFIX}/bin)
# FILE (GLOB bin_files LIST_DIRECTORIES FALSE
# RELATIVE ${PROJECT_BINARY_DIR}/toplevel/${CMAKE_INSTALL_PREFIX}/libexec/sac2c/${SAC2C_VERSION}/
# ${PROJECT_BINARY_DIR}/toplevel/${CMAKE_INSTALL_PREFIX}/libexec/sac2c/${SAC2C_VERSION}/*_?
# )
# FOREACH (bin \${bin_files})
# EXECUTE_PROCESS (COMMAND
# ${CMAKE_COMMAND} -E create_symlink
# \"${CMAKE_INSTALL_PREFIX}/libexec/sac2c/${SAC2C_VERSION}/\${bin}\"
# \"${PROJECT_BINARY_DIR}/toplevel/${CMAKE_INSTALL_PREFIX}/bin/\${bin}\"
# )
# ENDFOREACH ()"
# COMPONENT symlinks
# )
# install the thing to root
# XXX (hans) if we specify the destination as an absolute path, e.g. /usr/local
# CPack generators RPM and DEB get confused, which leads to badly
......@@ -176,6 +145,11 @@ XINSTALL (DIRECTORY "${PROJECT_BINARY_DIR}/toplevel/headers/${CMAKE_INSTALL_PREF
DESTINATION "." USE_SOURCE_PERMISSIONS
COMPONENT headers)
# XXX (hans) NOTE: that for DEB/RPM/distributable packages (except TGZ), any
# CMAKE_INSTALL_PREFIX value given is explicily ignored/overridden by the CPACK*
# generator - as such, symlinks generated with a non-default CMAKE_INSTALL_PREFIX
# value *will be wrong*. Given though that we are only concerned with generating
# real packages for default situtations, this it OK for the moment.
XINSTALL (DIRECTORY "${PROJECT_BINARY_DIR}/toplevel/symlinks/${CMAKE_INSTALL_PREFIX}/"
DESTINATION "." USE_SOURCE_PERMISSIONS
COMPONENT symlinks)
......
......@@ -406,10 +406,43 @@ SET (CUDA_ARCH)
IF (CUDA)
FIND_PACKAGE (CUDA)
IF (CUDA_FOUND)
SET (ENABLE_CUDA ON)
SET (CUDA_ARCH "-arch=sm_20") # TODO: update sac2c to make better use of newer architectures...
SET (CUDA_ROOT "${CUDA_TOOLKIT_ROOT_DIR}") # FIXME: switch to package var?
SET (NVCC_PATH "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc")
MESSAGE (STATUS "Testing CUDA Device...")
# the TRY_RUN uses the system CC to compile a program that
# probes the system for a CUDA device and determines the
# CUDA Compatibility of that devices - this is stored within
# the sac2crc as CUDA_ARCH. We use CC, rather than NVCC, as