mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 06:11:46 +00:00
[build] make "common" a static library (part 1/2)
This commit is contained in:
parent
bee221c18d
commit
28b12c85f4
22 changed files with 60 additions and 35 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
a12-149-g878eb057d1+1
|
a12-150-gbee221c18d+1
|
|
@ -33,12 +33,12 @@ execute_process(
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
||||||
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
${CMAKE_BINARY_DIR}/include
|
${CMAKE_BINARY_DIR}/include
|
||||||
${PROJECT_SOURCE_DIR}/../common
|
${PROJECT_TOP}/vendor/kvm-guest-drivers-windows
|
||||||
${PROJECT_SOURCE_DIR}/../vendor/kvm-guest-drivers-windows
|
|
||||||
${PKGCONFIG_INCLUDE_DIRS}
|
${PKGCONFIG_INCLUDE_DIRS}
|
||||||
${GMP_INCLUDE_DIR}
|
${GMP_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -50,6 +50,7 @@ set(SOURCES
|
||||||
src/app.c
|
src/app.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common")
|
||||||
add_subdirectory(platform)
|
add_subdirectory(platform)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -58,6 +59,7 @@ else()
|
||||||
add_executable(looking-glass-host ${SOURCES})
|
add_executable(looking-glass-host ${SOURCES})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(looking-glass-host
|
target_link_libraries(looking-glass-host
|
||||||
|
lg_common
|
||||||
platform
|
platform
|
||||||
)
|
)
|
||||||
set_target_properties(looking-glass-host PROPERTIES LINK_FLAGS "-Wl,--gc-sections")
|
set_target_properties(looking-glass-host PROPERTIES LINK_FLAGS "-Wl,--gc-sections")
|
||||||
|
|
|
@ -22,6 +22,7 @@ ADD_CUSTOM_COMMAND(TARGET platform_Windows POST_BUILD
|
||||||
|
|
||||||
target_link_libraries(platform_Windows
|
target_link_libraries(platform_Windows
|
||||||
"${PROJECT_BINARY_DIR}/resource.o"
|
"${PROJECT_BINARY_DIR}/resource.o"
|
||||||
|
lg_common
|
||||||
capture
|
capture
|
||||||
setupapi
|
setupapi
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(capture LANGUAGES C)
|
project(capture LANGUAGES C)
|
||||||
|
|
||||||
include("PreCapture")
|
include(PreCapture)
|
||||||
|
|
||||||
|
option(USE_NVFBC "Enable NVFBC Support" OFF)
|
||||||
|
option(USE_DXGI "Enable DXGI Support" ON)
|
||||||
|
|
||||||
if(NOT DEFINED NVFBC_SDK)
|
if(NOT DEFINED NVFBC_SDK)
|
||||||
set(NVFBC_SDK "C:\\Program Files (x86)\\NVIDIA Corporation\\NVIDIA Capture SDK")
|
set(NVFBC_SDK "C:\\Program Files (x86)\\NVIDIA Corporation\\NVIDIA Capture SDK")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EXISTS "${NVFBC_SDK}\\inc" AND IS_DIRECTORY "${NVFBC_SDK}\\inc")
|
if(NOT EXISTS "${NVFBC_SDK}\\inc" OR NOT IS_DIRECTORY "${NVFBC_SDK}\\inc")
|
||||||
set(USE_NVFBC ON)
|
message("Disabling NVFBC support, can't find the SDK headers")
|
||||||
|
set(USE_NVFBC OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(USE_NVFBC "Enable NVFBC Support" ${USE_NVFBC})
|
|
||||||
option(USE_DXGI "Enable DXGI Support" ON)
|
|
||||||
|
|
||||||
if(USE_NVFBC)
|
if(USE_NVFBC)
|
||||||
add_capture("NVFBC")
|
add_capture("NVFBC")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -15,6 +15,7 @@ ADD_CUSTOM_COMMAND(TARGET capture_DXGI POST_BUILD
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(capture_DXGI
|
target_link_libraries(capture_DXGI
|
||||||
|
lg_common
|
||||||
${PROJECT_BINARY_DIR}/libd3d11.dll
|
${PROJECT_BINARY_DIR}/libd3d11.dll
|
||||||
dxgi
|
dxgi
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,8 +19,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
#include "interface/capture.h"
|
#include "interface/capture.h"
|
||||||
#include "interface/platform.h"
|
#include "interface/platform.h"
|
||||||
#include "debug.h"
|
#include "common/debug.h"
|
||||||
#include "windows/windebug.h"
|
#include "windows/debug.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
|
|
|
@ -19,7 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "debug.h"
|
#include "common/debug.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
|
@ -18,7 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "windows/mousehook.h"
|
#include "windows/mousehook.h"
|
||||||
#include "windows/windebug.h"
|
#include "windows/debug.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
|
@ -24,8 +24,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
|
|
||||||
#include "interface/platform.h"
|
#include "interface/platform.h"
|
||||||
#include "debug.h"
|
#include "common/debug.h"
|
||||||
#include "windows/windebug.h"
|
#include "windows/debug.h"
|
||||||
#include "ivshmem/Public.h"
|
#include "ivshmem/Public.h"
|
||||||
|
|
||||||
static HANDLE shmemHandle = INVALID_HANDLE_VALUE;
|
static HANDLE shmemHandle = INVALID_HANDLE_VALUE;
|
||||||
|
|
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "windows/windebug.h"
|
#include "windows/debug.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void DebugWinError(const char * file, const unsigned int line, const char * function, const char * desc, HRESULT status)
|
void DebugWinError(const char * file, const unsigned int line, const char * function, const char * desc, HRESULT status)
|
||||||
|
|
|
@ -20,15 +20,15 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#include "interface/platform.h"
|
#include "interface/platform.h"
|
||||||
#include "interface/capture.h"
|
#include "interface/capture.h"
|
||||||
#include "dynamic/capture.h"
|
#include "dynamic/capture.h"
|
||||||
|
#include "common/debug.h"
|
||||||
|
#include "common/locking.h"
|
||||||
|
#include "common/KVMFR.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "debug.h"
|
|
||||||
#include "locking.h"
|
|
||||||
#include "KVMFR.h"
|
|
||||||
|
|
||||||
#define ALIGN_DN(x) ((uintptr_t)(x) & ~0x7F)
|
#define ALIGN_DN(x) ((uintptr_t)(x) & ~0x7F)
|
||||||
#define ALIGN_UP(x) ALIGN_DN(x + 0x7F)
|
#define ALIGN_UP(x) ALIGN_DN(x + 0x7F)
|
||||||
|
|
20
common/CMakeLists.txt
Normal file
20
common/CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(lg_common LANGUAGES C)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${PROJECT_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(lg_common STATIC
|
||||||
|
src/debug.c
|
||||||
|
)
|
||||||
|
|
||||||
|
#target_link_libraries(lg_common
|
||||||
|
#)
|
||||||
|
|
||||||
|
target_include_directories(lg_common
|
||||||
|
INTERFACE
|
||||||
|
include
|
||||||
|
PRIVATE
|
||||||
|
src
|
||||||
|
)
|
0
common/src/debug.c
Normal file
0
common/src/debug.c
Normal file
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
#include "vendor/kvm-guest-drivers-windows/ivshmem/Public.h"
|
#include "kvm-guest-drivers-windows/ivshmem/Public.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
|
||||||
IVSHMEM * IVSHMEM::m_instance = NULL;
|
IVSHMEM * IVSHMEM::m_instance = NULL;
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>ENABLE_TRACING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ENABLE_TRACING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>ENABLE_TRACING;CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ENABLE_TRACING;CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>ENABLE_TRACING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ENABLE_TRACING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>ENABLE_TRACING;CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ENABLE_TRACING;CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -318,7 +318,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>CONFIG_CAPTURE_NVFBC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\vendor;..\common\include;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -358,7 +358,7 @@
|
||||||
<ClInclude Include="Util.h" />
|
<ClInclude Include="Util.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<MASM Include="..\common\memcpySSE.asm" />
|
<MASM Include="..\common\src\memcpySSE.asm" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FxCompile Include="Shaders\Pixel.hlsl">
|
<FxCompile Include="Shaders\Pixel.hlsl">
|
||||||
|
|
|
@ -99,11 +99,6 @@
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<MASM Include="..\common\memcpySSE.asm">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</MASM>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FxCompile Include="Shaders\Vertex.hlsl">
|
<FxCompile Include="Shaders\Vertex.hlsl">
|
||||||
<Filter>Source Files\Shaders</Filter>
|
<Filter>Source Files\Shaders</Filter>
|
||||||
|
@ -115,4 +110,9 @@
|
||||||
<Filter>Source Files\Shaders</Filter>
|
<Filter>Source Files\Shaders</Filter>
|
||||||
</FxCompile>
|
</FxCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<MASM Include="..\common\src\memcpySSE.asm">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</MASM>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -22,7 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#include <avrt.h>
|
#include <avrt.h>
|
||||||
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "vendor/getopt/getopt.h"
|
#include "getopt/getopt.h"
|
||||||
|
|
||||||
#include "CrashHandler.h"
|
#include "CrashHandler.h"
|
||||||
#include "TraceUtil.h"
|
#include "TraceUtil.h"
|
||||||
|
|
Loading…
Reference in a new issue