boo/CMakeLists.txt

157 lines
4.6 KiB
CMake
Raw Normal View History

2015-08-18 18:00:24 +00:00
cmake_minimum_required(VERSION 3.0)
project(libBoo)
if (NOT MSVC)
2015-10-20 02:23:55 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
2015-10-30 06:26:02 +00:00
if (NOT TARGET LogVisor)
add_subdirectory(LogVisor)
endif()
2015-11-14 07:28:18 +00:00
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "libBoo include path" FORCE)
2015-10-30 06:26:02 +00:00
include_directories(include ${LOG_VISOR_INCLUDE_DIR})
2015-11-02 09:31:06 +00:00
if(NOT GEKKO AND NOT CAFE)
list(APPEND PLAT_SRCS
lib/graphicsdev/GL.cpp
lib/graphicsdev/glew.c)
list(APPEND PLAT_HDRS
include/boo/graphicsdev/GL.hpp)
endif()
2015-08-18 18:00:24 +00:00
if(WIN32)
list(APPEND PLAT_SRCS
2015-08-18 19:40:26 +00:00
lib/win/ApplicationWin32.cpp
lib/win/WindowWin32.cpp
2015-11-03 04:19:41 +00:00
lib/win/Win32Common.hpp
2015-08-18 18:00:24 +00:00
lib/inputdev/HIDListenerWinUSB.cpp
lib/inputdev/HIDDeviceWinUSB.cpp
lib/graphicsdev/D3D11.cpp
2015-11-02 09:31:06 +00:00
lib/graphicsdev/D3D12.cpp)
list(APPEND PLAT_HDRS
2015-11-06 03:20:58 +00:00
include/boo/graphicsdev/D3D.hpp)
2015-11-02 09:31:06 +00:00
2015-11-05 00:00:29 +00:00
list(APPEND _BOO_SYS_DEFINES -DUNICODE -D_UNICODE)
2015-11-03 04:19:41 +00:00
2015-12-25 01:08:46 +00:00
list(APPEND _BOO_SYS_LIBS Winusb opengl32 Setupapi Imm32)
2015-08-18 18:00:24 +00:00
elseif(APPLE)
list(APPEND PLAT_SRCS
2015-08-18 19:40:26 +00:00
lib/mac/ApplicationCocoa.mm
lib/mac/WindowCocoa.mm
2015-11-09 02:24:45 +00:00
lib/mac/CocoaCommon.hpp
2015-08-18 18:00:24 +00:00
lib/inputdev/HIDListenerIOKit.cpp
lib/inputdev/HIDDeviceIOKit.cpp
lib/graphicsdev/Metal.mm)
2015-11-02 09:31:06 +00:00
list(APPEND PLAT_HDRS
include/boo/graphicsdev/Metal.hpp)
2015-09-02 19:09:13 +00:00
find_library(APPKIT_LIBRARY AppKit)
find_library(IOKIT_LIBRARY IOKit)
find_library(OPENGL_LIBRARY OpenGL)
2015-11-18 23:55:25 +00:00
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.10)
2015-11-16 22:03:46 +00:00
find_library(METAL_LIBRARY Metal)
endif()
2015-11-09 02:24:45 +00:00
find_library(QUARTZCORE_LIBRARY QuartzCore)
2015-11-01 00:06:56 +00:00
find_library(COREVIDEO_LIBRARY CoreVideo)
2015-11-09 02:24:45 +00:00
list(APPEND _BOO_SYS_LIBS ${APPKIT_LIBRARY} ${IOKIT_LIBRARY} ${OPENGL_LIBRARY} ${METAL_LIBRARY}
${QUARTZCORE_LIBRARY} ${COREVIDEO_LIBRARY})
2015-11-02 09:31:06 +00:00
else(NOT GEKKO)
2015-08-18 18:00:24 +00:00
list(APPEND PLAT_SRCS
2015-11-30 00:20:20 +00:00
lib/x11/XlibCommon.hpp
2015-08-18 19:40:26 +00:00
lib/x11/ApplicationUnix.cpp
lib/x11/ApplicationXlib.hpp
2015-08-18 19:40:26 +00:00
lib/x11/ApplicationWayland.hpp
lib/x11/WindowXlib.cpp
2015-08-18 19:40:26 +00:00
lib/x11/WindowWayland.cpp
2015-08-18 18:00:24 +00:00
lib/inputdev/HIDListenerUdev.cpp
lib/inputdev/HIDDeviceUdev.cpp
lib/graphicsdev/GL.cpp
lib/graphicsdev/GLX.cpp
lib/graphicsdev/glew.c)
2015-08-18 19:40:26 +00:00
2015-11-02 09:31:06 +00:00
# list(APPEND PLAT_HDRS )
2015-08-18 19:40:26 +00:00
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(dbus_pkg QUIET libdbus dbus-1)
endif()
find_path(DBUS_INCLUDE_DIR
NAMES
dbus/dbus.h
HINTS
${dbus_pkg_INCLUDE_DIRS}
PATH_SUFFIXES
include/
include/dbus-1.0/
dbus-1.0/)
find_path(DBUS_ARCH_INCLUDE_DIR
NAMES
dbus/dbus-arch-deps.h
HINTS
${dbus_pkg_INCLUDE_DIRS}
PATHS
# TODO use CMAKE_SYSTEM_PROCESSOR or similar?
/usr/lib/dbus-1.0/include
PATH_SUFFIXES
dbus-1.0/include/)
find_library(DBUS_LIBRARY
NAMES
dbus dbus-1
HINTS
${dbus_pkg_LIBRARY_DIRS}
PATH_SUFFIXES
lib
lib32
lib64)
if(DBUS_INCLUDE_DIR-NOTFOUND)
message(FATAL_ERROR "Unix build of libBoo requires dbus")
endif()
include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
list(APPEND _BOO_SYS_LIBS X11 Xi GL ${DBUS_LIBRARY} udev pthread)
2015-08-18 19:40:26 +00:00
2015-08-18 18:00:24 +00:00
endif()
# For some reason, clang takes forever if glew.c is not built with -Os
2015-11-11 07:02:46 +00:00
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set_source_files_properties(lib/graphicsdev/glew.c PROPERTIES COMPILE_FLAGS -Os)
endif()
2015-08-25 07:04:37 +00:00
set(BOO_SYS_LIBS ${_BOO_SYS_LIBS} CACHE PATH "Boo System Libraries" FORCE)
2015-11-03 04:19:41 +00:00
set(BOO_SYS_DEFINES ${_BOO_SYS_DEFINES} CACHE PATH "Boo System Defines" FORCE)
2015-08-18 22:43:30 +00:00
2015-11-03 04:19:41 +00:00
add_definitions(${_BOO_SYS_DEFINES})
2015-08-18 18:00:24 +00:00
include_directories(include)
add_library(Boo
2015-08-18 22:43:30 +00:00
lib/inputdev/CafeProPad.cpp include/boo/inputdev/CafeProPad.hpp
lib/inputdev/RevolutionPad.cpp include/boo/inputdev/RevolutionPad.hpp
lib/inputdev/DolphinSmashAdapter.cpp include/boo/inputdev/DolphinSmashAdapter.hpp
lib/inputdev/DualshockPad.cpp include/boo/inputdev/DualshockPad.hpp
lib/inputdev/GenericPad.cpp include/boo/inputdev/GenericPad.hpp
lib/inputdev/DeviceBase.cpp include/boo/inputdev/DeviceBase.hpp
lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp
include/boo/inputdev/IHIDListener.hpp
2015-08-18 18:00:24 +00:00
lib/inputdev/IHIDDevice.hpp
2015-08-18 22:43:30 +00:00
include/boo/IGraphicsContext.hpp
include/boo/graphicsdev/IGraphicsDataFactory.hpp
include/boo/graphicsdev/IGraphicsCommandQueue.hpp
2015-08-18 22:43:30 +00:00
include/boo/IWindow.hpp
include/boo/IApplication.hpp
2015-08-31 03:40:58 +00:00
include/boo/System.hpp
2015-08-18 22:43:30 +00:00
include/boo/boo.hpp
InputDeviceClasses.cpp
2015-11-02 09:31:06 +00:00
${PLAT_SRCS}
${PLAT_HDRS})
2015-08-18 19:40:26 +00:00
add_subdirectory(test)