Skip to content

Commit

Permalink
Add usched option to CMakeLists.txt
Browse files Browse the repository at this point in the history
To support gdev_usched_monitor compilation with CMake.
  • Loading branch information
Constellation committed Sep 13, 2014
1 parent 0d04f40 commit 89938ca
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 13 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SET(soserial "1")
OPTION(driver "select GPU driver. must set driver name in the user-space mode" nouveau)
OPTION(user "user mode(default off)" OFF)
OPTION(runtime "enable CUDA runtime API(default on)" ON)
OPTION(usched "enable user mode scheduler(default off)" OFF)

MACRO(INCLUDE_DIRECTORY_IF_EXISTS DIR)
IF(EXISTS "${DIR}/")
Expand Down
36 changes: 23 additions & 13 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
SET(CMAKE_C_FLAGS_RELEASE "-Wall -O2")
SET(CMAKE_C_FLAGS_DEBUG "-g")
SET(CMAKE_BUILD_TYPE Release)
SET(CMAKE_C_FLAGS "-DGDEV_SCHED_DISABLED")
IF(NOT(user AND usched))
SET(CMAKE_C_FLAGS "-DGDEV_SCHED_DISABLED")
ENDIF(NOT(user AND usched))

SET(serial "1.0.0")
SET(soserial "1")
Expand All @@ -28,18 +30,19 @@ file(GLOB nvrm_src "user/nvrm/*.c")
file(GLOB user_src "user/gdev/*.c")
file(GLOB nouveau_src "user/nouveau/*.c")
file(GLOB kernel_src "kernel/*.c")
file(GLOB usched_src "user/usched/*.c")


## include dir
SET(gdev_inc /usr/local/gdev/include)

## select source
## select source
IF(user)
MESSAGE(Selected\ User-space!)
SET(gdev_src ${gdev_src} ${user_src} ${common_src} ${util_src})
SET(gdev_inc ${gdev_inc}
/usr/include/libdrm
${PROJECT_SOURCE_DIR}/common/
SET(gdev_inc ${gdev_inc}
/usr/include/libdrm
${PROJECT_SOURCE_DIR}/common/
${PROJECT_SOURCE_DIR}/lib/user/gdev/
)

Expand All @@ -61,20 +64,20 @@ IF(user)
ENDIF(driver STREQUAL pscnv)
ENDIF(driver STREQUAL nvrm)
ENDIF(driver STREQUAL nouveau)
SET(gdev_install_headers
${PROJECT_SOURCE_DIR}/common/gdev_api.h
${PROJECT_SOURCE_DIR}/common/gdev_nvidia_def.h
${PROJECT_SOURCE_DIR}/common/gdev_list.h
SET(gdev_install_headers
${PROJECT_SOURCE_DIR}/common/gdev_api.h
${PROJECT_SOURCE_DIR}/common/gdev_nvidia_def.h
${PROJECT_SOURCE_DIR}/common/gdev_list.h
${PROJECT_SOURCE_DIR}/common/gdev_time.h
${PROJECT_BINARY_DIR}/gdev_autogen.h)
ELSE(user)
MESSAGE(Selected\ Kernel-space!)
SET(gdev_src ${gdev_src} ${kernel_src})
SET(gdev_inc ${gdev_inc} ${PROJECT_SOURCE_DIR}/lib/kernel ${PROJECT_SOURCE_DIR}/common)
SET(gdev_install_headers
${PROJECT_SOURCE_DIR}/common/gdev_api.h
${PROJECT_SOURCE_DIR}/common/gdev_nvidia_def.h
${PROJECT_SOURCE_DIR}/common/gdev_list.h
SET(gdev_install_headers
${PROJECT_SOURCE_DIR}/common/gdev_api.h
${PROJECT_SOURCE_DIR}/common/gdev_nvidia_def.h
${PROJECT_SOURCE_DIR}/common/gdev_list.h
${PROJECT_SOURCE_DIR}/common/gdev_time.h
${PROJECT_BINARY_DIR}/gdev_autogen.h)
ENDIF(user)
Expand All @@ -86,3 +89,10 @@ TARGET_LINK_LIBRARIES(gdev ${link_lib})
INSTALL(TARGETS gdev LIBRARY DESTINATION gdev/lib64)
INSTALL(FILES ${gdev_install_headers} DESTINATION gdev/include)

IF(user AND usched)
FIND_PACKAGE(Threads)
ADD_EXECUTABLE(gdev_usched_monitor ${usched_src})
TARGET_LINK_LIBRARIES(gdev_usched_monitor ${link_lib} ${CMAKE_THREAD_LIBS_INIT})
INSTALL(TARGETS gdev_usched_monitor RUNTIME DESTINATION gdev/bin)
ENDIF(user AND usched)

1 change: 1 addition & 0 deletions lib/user/gdev/gdev_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "gdev_device.h"
#include "gdev_lib.h"
#include "gdev_sched.h"
#include "gdev_util.h"

#ifdef GDEV_SCHED_DISABLED

Expand Down
1 change: 1 addition & 0 deletions lib/user/nouveau/nouveau_gdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "gdev_api.h"
#include "gdev_device.h"
#include "gdev_io_memcpy.h"
#include "gdev_util.h"
#include "gdev_nvidia.h"
#include "gdev_nvidia_fifo.h"
#include "gdev_nvidia_nve4.h"
Expand Down
1 change: 1 addition & 0 deletions lib/user/nvrm/nvrm_gdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "gdev_api.h"
#include "gdev_device.h"
#include "gdev_io_memcpy.h"
#include "gdev_util.h"
#include "gdev_nvidia.h"
#include "gdev_nvidia_fifo.h"
#include "nvrm.h"
Expand Down
39 changes: 39 additions & 0 deletions util/gdev_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) Yusuke Suzuki <yusuke.suzuki@sslab.ics.keio.ac.jp>
*
* Keio University
*
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

#ifndef __GDEV_UTIL_H__
#define __GDEV_UTIL_H__

#if !defined(ADDR_ADD)
#define ADDR_ADD(x,y) ((long long)(x)+(long long)(y))
#endif

#if !defined(ADDR_SUB)
#define ADDR_SUB(x,y) ((long long)(x)-(long long)(y))
#endif

#endif /* __GDEV_UTIL_H__ */

0 comments on commit 89938ca

Please sign in to comment.