Cleaned and simplified CMakeLists file Fixed some warnings with latest GCC
authorbsegovia <devnull@localhost>
Tue, 26 Jul 2011 23:27:30 +0000 (23:27 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Aug 2012 23:14:34 +0000 (16:14 -0700)
CMake/FindDRM.cmake
CMake/FindDRMIntel.cmake
CMakeLists.txt
src/cl_api.c
src/cl_context.c

index 87639b6..f65c457 100644 (file)
@@ -8,6 +8,7 @@
 # 
 
 FIND_PATH(DRM_INCLUDE_PATH drm.h
+  ~/include/libdrm/
   /usr/include/libdrm/
   /usr/local/include/libdrm/
   /sw/include/libdrm/
@@ -16,6 +17,7 @@ FIND_PATH(DRM_INCLUDE_PATH drm.h
 FIND_LIBRARY(DRM_LIBRARY
   NAMES DRM drm
   PATHS
+  ~/lib/
   /usr/lib64
   /usr/lib
   /usr/local/lib64
index 7c5be42..0577882 100644 (file)
@@ -9,6 +9,7 @@
 FIND_LIBRARY(DRM_INTEL_LIBRARY
   NAMES DRM_INTEL drm_intel
   PATHS
+  ~/lib/
   /usr/lib64
   /usr/lib
   /usr/local/lib64
index ce1be94..325444e 100644 (file)
@@ -12,7 +12,7 @@ PROJECT(OCL)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
 
 SET(CMAKE_VERBOSE_MAKEFILE "false")
-SET(CMAKE_BUILD_TYPE "NOOPT" CACHE STRING "Build type")
+SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
 SET(USE_INTEL_COMPILER CACHE BOOL "false")
 SET(USE_FULSIM CACHE BOOL "false")
 ADD_DEFINITIONS(-D__$(USER)__)
@@ -22,18 +22,8 @@ IF (USE_FULSIM)
 ELSE (USE_FULSIM)
   ADD_DEFINITIONS(-DUSE_FULSIM=0)
 ENDIF (USE_FULSIM)
-
-SET(SSE "-mssse3")
-SET(CMAKE_CXX_FLAGS "-Wall -Wno-invalid-offsetof -mfpmath=sse ${SSE} --no-exceptions --no-rtti -Wcast-align -std=c++0x")
-SET(CMAKE_CXX_FLAGS_NOOPT "-g -DNOOPT")
-SET(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -pg -DDEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG")
-SET(CMAKE_C_FLAGS "-Wall -mfpmath=sse -msse -msse2 ${SSE4} --no-exceptions -Wcast-align")
-SET(CMAKE_C_FLAGS_NOOPT "-g -DNOOPT")
-SET(CMAKE_C_FLAGS_DEBUG "-g -O2 -pg -DDEBUG")
-SET(CMAKE_C_FLAGS_RELEASE "-O3 -g -DNDEBUG")
-SET(OCL_CMAKE_DIR "${OCL_SOURCE_DIR}/CMake")
-SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OCL_CMAKE_DIR}")
+SET(CMAKE_CXX_FLAGS "-Wall -Wno-invalid-offsetof -mfpmath=sse --no-exceptions --no-rtti -Wcast-align -std=c++0x")
+SET(CMAKE_C_FLAGS "-Wall -mfpmath=sse -msse2 -Wcast-align")
 
 # XLib
 INCLUDE(CMake/FindXLib.cmake)
index 5960a01..3e17af9 100644 (file)
@@ -127,7 +127,7 @@ clReleaseContext(cl_context context)
   CHECK_CONTEXT (context);
   cl_context_delete(context);
 error:
-  return CL_SUCCESS;
+  return err;
 }
 
 cl_int
@@ -152,7 +152,7 @@ clCreateCommandQueue(cl_context                   context,
   CHECK_CONTEXT (context);
   queue = cl_context_create_queue(context, device, properties, errcode_ret);
 error:
-  return queue;
+  return err == CL_SUCCESS ? queue : NULL;
 }
 
 cl_int
@@ -226,10 +226,12 @@ clCreateSubBuffer(cl_mem                buffer,
                   const void *          buffer_create_info,
                   cl_int *              errcode_ret)
 {
+#if 0
   cl_int err = CL_SUCCESS;
   CHECK_MEM (buffer);
   NOT_IMPLEMENTED;
 error:
+#endif
   return NULL;
 }
 
index 00c4f55..08b32fa 100644 (file)
@@ -74,7 +74,7 @@ cl_create_context(const cl_context_properties *  properties,
                   void *                         user_data,
                   cl_int *                       errcode_ret)
 {
-  cl_platform_id platform = NULL;
+  /* cl_platform_id platform = NULL; */
   cl_context ctx = NULL;
   cl_int err = CL_SUCCESS;
 
@@ -90,7 +90,7 @@ cl_create_context(const cl_context_properties *  properties,
   /* Check that we are getting the right platform */
   if (UNLIKELY((err = cl_context_properties_is_ok(properties)) != CL_SUCCESS))
     goto error;
-  platform = intel_platform;
+  /* platform = intel_platform; */
 
   /* Now check if the user is asking for the right device */
   if (UNLIKELY(cl_device_id_is_ok(*devices) == CL_FALSE)) {
@@ -121,10 +121,9 @@ LOCAL cl_context
 cl_context_new(void)
 {
   cl_context ctx = NULL;
-  int err = 0;
 
-  TRY_ALLOC (ctx, CALLOC(struct _cl_context));
-  TRY_ALLOC (ctx->intel_drv, cl_genx_driver_new());
+  TRY_ALLOC_NO_ERR (ctx, CALLOC(struct _cl_context));
+  TRY_ALLOC_NO_ERR (ctx->intel_drv, cl_genx_driver_new());
   ctx->magic = CL_MAGIC_CONTEXT_HEADER;
   ctx->ref_n = 1;
   pthread_mutex_init(&ctx->program_lock, NULL);