boo/CMakeLists.txt

273 lines
9.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # because of CMAKE_CXX_STANDARD
2016-03-04 23:02:18 +00:00
project(boo)
2015-08-18 18:00:24 +00:00
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
endif()
2016-03-04 23:02:18 +00:00
if (NOT TARGET logvisor)
add_subdirectory(logvisor)
2015-10-30 06:26:02 +00:00
endif()
2015-11-14 07:28:18 +00:00
add_subdirectory(xxhash)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(IPP)
if (IPP_FOUND)
add_definitions(-DINTEL_IPP=1)
include_directories(${IPP_INCLUDE_DIRS})
list(APPEND _BOO_SYS_LIBS ${IPP_LIBRARIES})
endif ()
2016-03-23 05:33:14 +00:00
set(WITH_LSR_BINDINGS OFF)
set(BUILD_TESTS OFF)
set(BUILD_SHARED_LIBS OFF)
set(SOXR_SILENT ON)
2016-03-23 05:33:14 +00:00
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/soxr/cmake/Modules")
add_subdirectory(soxr)
2016-03-04 23:02:18 +00:00
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE PATH "boo include path" FORCE)
2015-11-14 07:28:18 +00:00
include_directories(include xxhash ${LOGVISOR_INCLUDE_DIR})
2015-10-30 06:26:02 +00:00
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
2016-02-24 03:11:58 +00:00
include/boo/graphicsdev/GLSLMacros.hpp
include/boo/graphicsdev/GL.hpp
2016-06-30 04:54:29 +00:00
include/boo/graphicsdev/Vulkan.hpp
include/boo/graphicsdev/VulkanDispatchTable.hpp)
2017-02-24 08:26:27 +00:00
add_library(glew lib/graphicsdev/glew.c)
2015-11-02 09:31:06 +00:00
endif()
2015-08-18 18:00:24 +00:00
if(WIN32)
2016-07-17 21:15:57 +00:00
unset(VULKAN_SDK_DIRS CACHE)
get_filename_component(VULKAN_SDK_DIRS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\LunarG\\VulkanSDK;VK_SDK_PATHs]" ABSOLUTE CACHE)
if (NOT ${VULKAN_SDK_DIRS} STREQUAL "/registry")
message(STATUS "Enabling Vulkan support")
list(GET VULKAN_SDK_DIRS 0 VULKAN_SDK_DIR)
include_directories("${VULKAN_SDK_DIR}/Include")
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1)
list(APPEND _BOO_SYS_INCLUDES "${VULKAN_SDK_DIR}/Include")
list(APPEND PLAT_SRCS lib/graphicsdev/Vulkan.cpp
lib/graphicsdev/VulkanDispatchTable.cpp)
endif()
2016-01-15 03:17:00 +00:00
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
2016-01-28 23:53:51 +00:00
lib/graphicsdev/D3D12.cpp
lib/audiodev/WASAPI.cpp)
2015-11-02 09:31:06 +00:00
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
list(APPEND _BOO_SYS_LIBS Winusb opengl32 Setupapi Imm32 Winmm Shlwapi Hid Xinput)
2015-08-18 18:00:24 +00:00
elseif(APPLE)
2016-01-15 03:17:00 +00:00
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
2016-01-28 23:53:51 +00:00
lib/graphicsdev/Metal.mm
lib/audiodev/AQS.cpp)
set_source_files_properties(lib/mac/ApplicationCocoa.mm
lib/mac/WindowCocoa.mm
lib/graphicsdev/Metal.mm
PROPERTIES COMPILE_FLAGS -fobjc-arc)
2015-11-02 09:31:06 +00:00
list(APPEND PLAT_HDRS
2017-05-07 21:24:00 +00:00
include/boo/graphicsdev/Metal.hpp
lib/inputdev/CFPointer.hpp
lib/inputdev/IOKitPointer.hpp)
2015-11-02 09:31:06 +00:00
2015-09-02 19:09:13 +00:00
find_library(APPKIT_LIBRARY AppKit)
find_library(IOKIT_LIBRARY IOKit)
find_library(OPENGL_LIBRARY OpenGL)
unset(BOO_HAS_METAL CACHE)
2015-11-18 23:55:25 +00:00
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.10)
set(BOO_HAS_METAL ON CACHE BOOL "Metal is available in this OS X version" FORCE)
2015-11-16 22:03:46 +00:00
find_library(METAL_LIBRARY Metal)
2016-07-31 20:25:02 +00:00
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_METAL=1)
2016-07-05 21:47:04 +00:00
else()
set(METAL_LIBRARY "")
2015-11-16 22:03:46 +00:00
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)
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
2016-05-22 23:09:32 +00:00
find_library(COREAUDIO_LIBRARY CoreAudio)
find_library(COREMIDI_LIBRARY CoreMIDI)
2015-11-09 02:24:45 +00:00
list(APPEND _BOO_SYS_LIBS ${APPKIT_LIBRARY} ${IOKIT_LIBRARY} ${OPENGL_LIBRARY} ${METAL_LIBRARY}
2016-05-22 23:09:32 +00:00
${QUARTZCORE_LIBRARY} ${COREVIDEO_LIBRARY} ${AUDIOTOOLBOX_LIBRARY}
${COREAUDIO_LIBRARY} ${COREMIDI_LIBRARY})
2015-11-02 09:31:06 +00:00
else(NOT GEKKO)
2016-01-15 03:17:00 +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
lib/graphicsdev/GL.cpp
lib/graphicsdev/GLX.cpp
2016-01-28 23:53:51 +00:00
lib/graphicsdev/glew.c
lib/audiodev/ALSA.cpp)
2015-11-02 09:31:06 +00:00
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
2016-01-31 08:37:23 +00:00
/usr/local/lib/dbus-1.0/include
2016-06-18 05:00:57 +00:00
/usr/lib/x86_64-linux-gnu/dbus-1.0/include/
2015-08-18 19:40:26 +00:00
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)
2016-03-04 23:02:18 +00:00
message(FATAL_ERROR "Unix build of boo requires dbus")
2015-08-18 19:40:26 +00:00
endif()
include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
list(APPEND _BOO_SYS_LIBS X11 Xi GL asound ${DBUS_LIBRARY} pthread)
2016-01-31 08:37:23 +00:00
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
2016-10-27 23:44:01 +00:00
message(STATUS "Enabling Vulkan support")
2016-01-31 08:37:23 +00:00
list(APPEND PLAT_SRCS
lib/inputdev/HIDListenerUdev.cpp
2016-10-27 23:44:01 +00:00
lib/inputdev/HIDDeviceUdev.cpp
lib/graphicsdev/Vulkan.cpp
lib/graphicsdev/VulkanDispatchTable.cpp)
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1)
2016-10-29 22:50:22 +00:00
list(APPEND _BOO_SYS_LIBS xcb X11-xcb dl udev)
2016-01-31 08:37:23 +00:00
else()
list(APPEND PLAT_SRCS
lib/inputdev/HIDListenerBSD.cpp
lib/inputdev/HIDDeviceBSD.cpp)
2016-10-27 23:44:01 +00:00
list(APPEND _BOO_SYS_LIBS execinfo)
2016-01-31 08:37:23 +00:00
endif()
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()
2016-06-24 03:03:06 +00:00
# Empty link args for boo's use
function(glslang_set_link_args TARGET)
endfunction(glslang_set_link_args)
2016-01-16 04:19:10 +00:00
add_subdirectory(glslang/glslang)
add_subdirectory(glslang/OGLCompilersDLL)
add_subdirectory(glslang/SPIRV)
2016-06-24 03:03:06 +00:00
add_subdirectory(glslang/StandAlone)
target_include_directories(glslang-default-resource-limits
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/glslang
)
list(APPEND _BOO_SYS_LIBS glslang soxr xxhash OSDependent OGLCompiler SPIRV glslang-default-resource-limits)
2016-01-14 21:10:48 +00:00
2016-03-04 23:02:18 +00:00
set(BOO_SYS_LIBS ${_BOO_SYS_LIBS} CACHE PATH "boo system libraries" FORCE)
set(BOO_SYS_DEFINES ${_BOO_SYS_DEFINES} CACHE PATH "boo system defines" FORCE)
2016-07-17 21:15:57 +00:00
set(BOO_SYS_INCLUDES ${_BOO_SYS_INCLUDES} CACHE PATH "boo system includes" FORCE)
2015-08-18 22:43:30 +00:00
2015-11-03 04:19:41 +00:00
add_definitions(${_BOO_SYS_DEFINES})
2016-03-23 07:01:25 +00:00
include_directories(include glslang soxr/src)
2015-08-18 18:00:24 +00:00
2016-03-04 23:02:18 +00:00
add_library(boo
2016-05-21 01:16:28 +00:00
lib/inputdev/DeviceBase.cpp include/boo/inputdev/DeviceBase.hpp
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
include/boo/inputdev/XInputPad.hpp
2015-08-18 22:43:30 +00:00
lib/inputdev/GenericPad.cpp include/boo/inputdev/GenericPad.hpp
lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp
2016-08-17 20:04:19 +00:00
lib/inputdev/DeviceFinder.cpp include/boo/inputdev/DeviceFinder.hpp
2017-09-15 17:20:52 +00:00
lib/inputdev/HIDParser.cpp include/boo/inputdev/HIDParser.hpp
2015-08-18 18:00:24 +00:00
lib/inputdev/IHIDDevice.hpp
lib/audiodev/Common.hpp
lib/audiodev/WAVOut.cpp
lib/audiodev/AudioMatrix.hpp
2016-05-22 08:37:16 +00:00
#lib/audiodev/AudioMatrix.cpp
lib/audiodev/AudioMatrixSSE.cpp
lib/audiodev/AudioVoiceEngine.hpp
lib/audiodev/AudioVoiceEngine.cpp
2016-03-23 07:01:25 +00:00
lib/audiodev/AudioVoice.hpp
lib/audiodev/AudioVoice.cpp
2016-05-07 04:28:32 +00:00
lib/audiodev/AudioSubmix.hpp
lib/audiodev/AudioSubmix.cpp
lib/audiodev/LtRtProcessing.hpp
lib/audiodev/LtRtProcessing.cpp
2016-05-20 06:16:07 +00:00
lib/audiodev/MIDIEncoder.cpp
lib/audiodev/MIDIDecoder.cpp
lib/audiodev/MIDICommon.hpp
2016-05-20 22:57:34 +00:00
lib/audiodev/MIDICommon.cpp
include/boo/inputdev/IHIDListener.hpp
2015-08-18 22:43:30 +00:00
include/boo/IGraphicsContext.hpp
include/boo/graphicsdev/IGraphicsDataFactory.hpp
include/boo/graphicsdev/IGraphicsCommandQueue.hpp
lib/graphicsdev/Common.hpp
2016-05-07 04:28:32 +00:00
include/boo/audiodev/IAudioSubmix.hpp
2016-01-28 23:53:51 +00:00
include/boo/audiodev/IAudioVoice.hpp
include/boo/audiodev/IMIDIPort.hpp
2016-05-20 06:16:07 +00:00
include/boo/audiodev/IMIDIReader.hpp
include/boo/audiodev/MIDIEncoder.hpp
include/boo/audiodev/MIDIDecoder.hpp
include/boo/audiodev/IAudioVoiceEngine.hpp
2015-08-18 22:43:30 +00:00
include/boo/IWindow.hpp
include/boo/IApplication.hpp
2016-04-01 04:24:05 +00:00
include/boo/ThreadLocalPtr.hpp
2016-05-11 04:50:26 +00:00
include/boo/DeferredWindowEvents.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)