Permalink
Browse files

CMake Cleanup

Removed unneeded printf
  • Loading branch information...
1 parent efe8d9a commit 8e9a35d710a68ce0fe2571fcfd033213b5198082 @qdot committed Oct 23, 2010
Showing with 29 additions and 19 deletions.
  1. +26 −13 CMakeLists.txt
  2. +3 −5 src/CMakeLists.txt
  3. +0 −1 src/omron_libusb.c
View
@@ -6,13 +6,17 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
#See if we've got our cmake modules checked out. If not, advise to do so.
+
+# Does it exist next to the repo? This is usually where it is for development.
IF(EXISTS "${CMAKE_SOURCE_DIR}/../compily_buildd/cmake")
SET(BUILDSYS_CMAKE_DIR "${CMAKE_SOURCE_DIR}/../compily_buildd/cmake")
MESSAGE(STATUS "Using outside compily_buildd directory ${BUILDSYS_CMAKE_DIR}")
+# Does it exist as a submodule or local directory?
ELSEIF(EXISTS "${CMAKE_SOURCE_DIR}/compily_buildd/cmake")
SET(BUILDSYS_CMAKE_DIR "${CMAKE_SOURCE_DIR}/compily_buildd/cmake")
MESSAGE(STATUS "Using compily_buildd git submodule ${BUILDSYS_CMAKE_DIR}")
-ELSE(EXISTS "${CMAKE_SOURCE_DIR}/compily_buildd/cmake")
+# Ah well.
+ELSE()
MESSAGE(FATAL_ERROR
"Cannot find compily_buildd directory for np labs project compilation functions.\n"
"Make sure you've either put the compily_buildd directory in the same root as your repository directory, or that you've used the compily_buildd submodule (git submodule update --init).\n"
@@ -25,7 +29,6 @@ LIST(APPEND CMAKE_MODULE_PATH ${BUILDSYS_CMAKE_DIR})
INCLUDE( ${BUILDSYS_CMAKE_DIR}/BuildSysCMakeLib.cmake )
#setting link directory policy
-
IF(COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)
@@ -37,44 +40,54 @@ ENDIF(COMMAND cmake_policy)
#Project declaration
PROJECT(LIBOMRON)
+
+# Project initialization
INITIALIZE_BUILD()
#Common Options
-#OPTION_LIBRARY_BUILD_STATIC(OFF)
+OPTION_LIBRARY_BUILD_STATIC(ON)
OPTION_LIBRARY_BUILD_SHARED(ON)
+OPTION_LIBRARY_BUILD_FRAMEWORK(OFF)
+OPTION_BUILD_RPATH(ON)
######################################################################################
# Project specific globals
######################################################################################
#library definitions
-SET(LIBOMRON_MAJOR_VERSION 0)
-SET(LIBOMRON_MINOR_VERSION 5)
+SET(LIBOMRON_MAJOR_VERSION 1)
+SET(LIBOMRON_MINOR_VERSION 0)
SET(LIBOMRON_BUILD_VERSION 0)
SET(LIBOMRON_VERSION ${LIBOMRON_MAJOR_VERSION}.${LIBOMRON_MINOR_VERSION}.${LIBOMRON_BUILD_VERSION})
-#library name definitions
+CREATE_LIBRARY_LINK_NAME("omron")
-SET(LIBOMRON_LIBRARY "${LIBRARY_OUTPUT_PATH}/libomron.a")
+# Just set our include and linking directories globally
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
+
+#library name definitions
SET(LIBOMRON_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include")
+SET(LIBOMRON_REQUIRED_LIBS)
IF(WIN32)
SET(WDK_PATH CACHE PATH "Path to WDK Installation")
INCLUDE_DIRECTORIES(${WDK_PATH}/inc/api ${WDK_PATH}/inc/crt ${WDK_PATH}/inc)
LINK_DIRECTORIES(${WDK_PATH}/lib/wxp/i386)
- LIST(APPEND LIBS hid setupapi)
+ LIST(APPEND LIBOMRON_REQUIRED_LIBS hid setupapi)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/win)
ELSEIF(UNIX)
-# ELSEIF(UNIX)
-# LIST(APPEND ${LIBS} m)
+ FIND_PACKAGE(libusb-1.0 REQUIRED)
+ IF(LIBUSB_1_FOUND)
+ INCLUDE_DIRECTORIES(${LIBUSB_1_INCLUDE_DIRS})
+ LIST(APPEND LIBOMRON_REQUIRED_LIBS ${LIBUSB_1_LIBRARIES})
+ ENDIF(LIBUSB_1_FOUND)
ENDIF(WIN32)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
-
+ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(swig)
View
@@ -7,11 +7,9 @@ SET(LIBRARY_SRCS
)
IF(WIN32)
- LIST(APPEND LIBRARY_SRCS omron_win32.c)
+ LIST(APPEND LIBRARY_SRCS omron_win32.c ${LIBOMRON_INCLUDE_FILES})
ELSEIF(UNIX)
- LIST(APPEND LIBRARY_SRCS omron_libusb.c)
-# ELSEIF(UNIX)
-# LIST(APPEND LIBRARY_SRCS omron_usbfs.c)
+ LIST(APPEND LIBRARY_SRCS omron_libusb.c ${LIBOMRON_INCLUDE_FILES})
ENDIF(WIN32)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
@@ -20,7 +18,7 @@ BUILDSYS_BUILD_LIB(
NAME omron
SOURCES "${LIBRARY_SRCS}"
CXX_FLAGS FALSE
- LINK_LIBS "${LIBS}"
+ LINK_LIBS "${LIBOMRON_REQUIRED_LIBS}"
LINK_FLAGS FALSE
DEPENDS FALSE
SHOULD_INSTALL TRUE
View
@@ -166,7 +166,6 @@ int omron_read_data(omron_device* dev, uint8_t* input_report)
{
int trans;
int ret = libusb_bulk_transfer(dev->device._device, OMRON_IN_ENDPT, input_report, 8, &trans, 1000);
- printf("%d\n", ret);
return ret;
}

0 comments on commit 8e9a35d

Please sign in to comment.