boo/CMakeLists.txt

249 lines
8.3 KiB
CMake
Raw Normal View History

2015-08-18 18:00:24 +00:00
cmake_minimum_required(VERSION 3.0)
2016-03-04 23:02:18 +00:00
project(boo)
2015-08-18 18:00:24 +00:00
if (NOT MSVC)
2016-06-15 01:42:18 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -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
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
2016-03-04 23:02:18 +00:00
include_directories(include ${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)
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)
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
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)
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
2016-06-30 04:54:29 +00:00
message(STATUS "Enabling Vulkan support")
list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_VULKAN=1)
list(APPEND _BOO_SYS_LIBS xcb X11-xcb dl)
list(APPEND PLAT_SRCS lib/graphicsdev/Vulkan.cpp
lib/graphicsdev/VulkanDispatchTable.cpp)
2016-02-21 06:27:54 +00:00
2016-01-31 08:37:23 +00:00
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
list(APPEND PLAT_SRCS
lib/inputdev/HIDListenerUdev.cpp
lib/inputdev/HIDDeviceUdev.cpp)
list(APPEND _BOO_SYS_LIBS udev)
else()
list(APPEND PLAT_SRCS
lib/inputdev/HIDListenerBSD.cpp
lib/inputdev/HIDDeviceBSD.cpp)
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)
2016-04-15 20:58:12 +00:00
add_subdirectory(glslang/hlsl)
2016-01-16 04:19:10 +00:00
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 HLSL soxr 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
lib/inputdev/GenericPad.cpp include/boo/inputdev/GenericPad.hpp
lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp
2015-08-18 18:00:24 +00:00
lib/inputdev/IHIDDevice.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
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
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)