Skip to content
Permalink
Browse files

Initial CMake buildsystem commit

Converted most of top level configure.ac and Makefile.am into CMakeLists.txt.
Added cmake versions of config.h.in, pocl.icd.in, pocl.pc.in.
Most of LLVM & Clang related stuff is in cmake/LLVM.cmake module.

Changes against configure.ac setup:
- remove install-paths.h references (most are unused anyway); replace
  PKG*DIR variables from install-paths.h with defines from config.h
- replace PACKAGE_VERSION with POCL_VERSION
- replace CLFLAGS with KERNEL_CL_FLAGS, and CLANGXX_FLAGS with
  KERNEL_CLANGXX_FLAGS - they seem more fitting and less confusing (with
  LLVM_{CXX,C,CL}FLAGS being values from llvm-config)
- changed TARGET-{LLC,CLANG}-FLAGS into {CELL,TCE}-{LLC,CLANG}-FLAGS
  seems more consistent wrt >1 ocl "targets"
- removed {TARGET,HOST}_SIZEOF_<type> defines, they all seem unused;
  there is some code using SIZEOF_<type> defines though.

Missing stuff:
- HOST_{LLC,CLANG,...}_FLAGS setup is incomplete, especially on !x86, and
  also sanitization of various triplets is missing
- Other platforms than linux need testing, may not work
- TCE & Cell need testing
  • Loading branch information
franz committed Jun 13, 2014
1 parent 6a95f41 commit 9160a3323652d37a101808b457dd7ff25cdded43

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,14 @@
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
HINTS
$ENV{SPHINX_DIR}
PATH_SUFFIXES bin
DOC "Sphinx documentation generator"
)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(Sphinx DEFAULT_MSG
SPHINX_EXECUTABLE
)

mark_as_advanced(SPHINX_EXECUTABLE)
@@ -0,0 +1,146 @@

/* The normal alignment of `double16', in bytes. */
#cmakedefine ALIGNOF_DOUBLE16 @ALIGNOF_DOUBLE16@

/* The normal alignment of `float16', in bytes. */
#cmakedefine ALIGNOF_FLOAT16 @ALIGNOF_FLOAT16@


#cmakedefine BUILD_SPU

#cmakedefine BUILDDIR "@BUILDDIR@"

/* "Build with ICD" */
#cmakedefine BUILD_ICD



#cmakedefine CLANG "@CLANG@"

/* clang++ executable */
#cmakedefine CLANGXX "@CLANGXX@"

/* clang++ compiler flags */
/* TODO in sources */
#cmakedefine KERNEL_CLANGXX_FLAGS "@KERNEL_CLANGXX_FLAGS@"

/* "Using a SPIR generator Clang from Khronos." */
#cmakedefine CLANG_SPIR


/* TODO in sources */
#cmakedefine KERNEL_CL_FLAGS "@KERNEL_CL_FLAGS@"


/* "Use a custom buffer allocator" */
#cmakedefine CUSTOM_BUFFER_ALLOCATOR



#cmakedefine DIRECT_LINKAGE



#cmakedefine FORCED_CLFLAGS "@FORCED_CLFLAGS@"



#cmakedefine HAVE_OCL_ICD





/* Defined if posix_memalign is available. */
#cmakedefine HAVE_POSIX_MEMALIGN


#define HOST "@HOST@"

#define HOST_AS_FLAGS "@HOST_AS_FLAGS@"

#define HOST_CLANG_FLAGS "@HOST_CLANG_FLAGS@"

#define HOST_CPU "@HOST_CPU@"

#define HOST_LD_FLAGS "@HOST_LD_FLAGS@"

#define HOST_LLC_FLAGS "@HOST_LLC_FLAGS@"



#cmakedefine LLC "@LLC@"


/* "Using LLVM 3.2" */
#cmakedefine LLVM_3_2

/* "Using LLVM 3.3" */
#cmakedefine LLVM_3_3

/* "Using LLVM 3.4" */
#cmakedefine LLVM_3_4

/* "Using upcoming LLVM 3.5" */
#cmakedefine LLVM_3_5



/* Defined to greatest expected alignment for extended types, in bytes. */
#cmakedefine MAX_EXTENDED_ALIGNMENT @MAX_EXTENDED_ALIGNMENT@



/* used in lib/CL/devices/basic */
#cmakedefine OCL_KERNEL_TARGET "@OCL_KERNEL_TARGET@"
#cmakedefine OCL_KERNEL_TARGET_CPU "@OCL_KERNEL_TARGET_CPU@"





#cmakedefine POCL_DEVICE_ADDRESS_BITS @POCL_DEVICE_ADDRESS_BITS@

#cmakedefine POCL_VERSION "@POCL_VERSION@"

#cmakedefine POCL_INSTALL_PRIVATE_HEADER_DIR "@POCL_INSTALL_PRIVATE_HEADER_DIR@"

#cmakedefine POCL_INSTALL_PRIVATE_DATADIR "@POCL_INSTALL_PRIVATE_DATADIR@"

/* these are *host* values */

/* The size of `double', as computed by sizeof. */
#cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@

/* The size of `long', as computed by sizeof. */
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@

/* The size of `void *', as computed by sizeof. */
#cmakedefine SIZEOF_VOID_P @SIZEOF_VOID_P@

/* The size of `__fp16', as computed by sizeof. */
#cmakedefine SIZEOF___FP16 @SIZEOF___FP16@



/* used in tce_common.c & pocl_llvm_api.cc */
#cmakedefine SRCDIR "@SRCDIR@"





#cmakedefine TCEMC_AVAILABLE

#cmakedefine TCE_AVAILABLE


/* "Use vecmathlib if available for the target." */
#cmakedefine USE_VECMATHLIB


/* Defined on big endian systems */
#cmakedefine WORDS_BIGENDIAN

/* Disable cl_khr_int64 when a clang bug is present */
#cmakedefine _CL_DISABLE_LONG @CL_DISABLE_LONG@
@@ -23,7 +23,6 @@
*/

#include "pocl_cl.h"
#include "install-paths.h"
#include <assert.h>
#include <string.h>
#include <unistd.h>
@@ -24,7 +24,6 @@

#include "pocl_cl.h"
#include "pocl_llvm.h"
#include "install-paths.h"
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -27,7 +27,6 @@
#include "pocl_llvm.h"
#include "pocl_util.h"
#include "utlist.h"
#include "install-paths.h"
#include <assert.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -65,7 +65,7 @@ POname(clGetPlatformInfo)(cl_platform_id platform,
POCL_RETURN_PLATFORM_INFO_STR("FULL_PROFILE");

case CL_PLATFORM_VERSION:
POCL_RETURN_PLATFORM_INFO_STR("OpenCL 1.2 pocl " PACKAGE_VERSION);
POCL_RETURN_PLATFORM_INFO_STR("OpenCL 1.2 pocl " POCL_VERSION);

case CL_PLATFORM_NAME:
POCL_RETURN_PLATFORM_INFO_STR("Portable Computing Language");
@@ -25,7 +25,6 @@
#include "basic.h"
#include "cpuinfo.h"
#include "topology/pocl_topology.h"
#include "install-paths.h"
#include "common.h"
#include "utlist.h"
#include "devices.h"
@@ -22,7 +22,7 @@
*/

#include "cellspu.h"
#include "install-paths.h"
#include "config.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -137,7 +137,7 @@ static inline void
pocl_device_common_init(struct _cl_device_id* dev)
{
POCL_INIT_OBJECT(dev);
dev->driver_version = PACKAGE_VERSION;
dev->driver_version = POCL_VERSION;
if(dev->version == NULL)
dev->version = "OpenCL 1.2 pocl";

@@ -23,7 +23,6 @@
*/

#include "pocl-pthread.h"
#include "install-paths.h"
#include <assert.h>
#include <pthread.h>
#include <string.h>
@@ -24,7 +24,6 @@
#include "pocl_util.h"

#include "config.h"
#include "install-paths.h"
#include "pocl_runtime_config.h"

#include <unistd.h>
@@ -210,9 +209,9 @@ TCEDevice::tceccCommandLine
}
else
{
deviceMainSrc = TCEString(PKGDATADIR) + "/" + mainC;
deviceMainSrc = TCEString(POCL_INSTALL_PRIVATE_HEADER_DIR) + "/" + mainC;
assert(access(deviceMainSrc.c_str(), R_OK) == 0);
poclIncludePathSwitch = " -I " PKGDATADIR "/include";
poclIncludePathSwitch = " -I " POCL_INSTALL_PRIVATE_HEADER_DIR;
}

TCEString extraFlags = extraParams;
@@ -22,7 +22,6 @@
*/

#include "ttasim.h"
#include "install-paths.h"
#include "bufalloc.h"
#include "pocl_device.h"
#include "pocl_util.h"
@@ -81,7 +81,6 @@
// causing compilation error if they are included before the LLVM headers.
#include "pocl_llvm.h"
#include "pocl_runtime_config.h"
#include "install-paths.h"
#include "LLVMUtils.h"

using namespace clang;
@@ -313,8 +312,8 @@ int pocl_llvm_build_program(cl_program program,
}
else
{
kernelh = PKGDATADIR;
kernelh += "/include/_kernel.h";
kernelh = POCL_INSTALL_PRIVATE_HEADER_DIR;
kernelh += "/_kernel.h";
}
po.Includes.push_back(kernelh);

@@ -1009,7 +1008,7 @@ kernel_library
}
else
{
kernellib = PKGDATADIR;
kernellib = POCL_INSTALL_PRIVATE_DATADIR;
kernellib += "/kernel-";
kernellib += device->llvm_target_triplet;
kernellib += ".bc";
@@ -0,0 +1 @@
@POCL_INSTALL_PUBLIC_LIBDIR@/libpocl@POCL_LIB_SUFFIX@
@@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@POCL_INSTALL_PUBLIC_BINDIR@
libdir=@POCL_INSTALL_PUBLIC_LIBDIR@
includedir=@POCL_INSTALL_PUBLIC_HEADER_DIR@

Name: Portable Computing Language
Description: Portable Computing Language
Version: @POCL_VERSION@
Libs: -L${libdir} -lpocl @LD_FLAGS_BIN@
Cflags: -I${includedir}

@@ -31,7 +31,7 @@ int main(void)
if( rv != CL_SUCCESS )
return 1;
result[rvs]=0; // spec doesn't say it is null-terminated.
if( strcmp( result, "OpenCL 1.2 " PACKAGE_STRING) != 0 ) {
if( strcmp( result, "OpenCL 1.2 pocl " POCL_VERSION) != 0 ) {
printf("Error: platform is: %s\n", result);
return 2;
}

0 comments on commit 9160a33

Please sign in to comment.
You can’t perform that action at this time.