mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[c-host] fixed project for cross compliation for Win on Linux
Thanks @fatalis for your guidance on this
This commit is contained in:
parent
86f4256b5a
commit
108c7d3aaa
@ -36,6 +36,8 @@ Don't ask if you can't figure it out, this code is the very definition of experi
|
||||
|
||||
Hint:
|
||||
|
||||
### For Windows on Windows
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
@ -43,6 +45,24 @@ cmake -G "MSYS Makefiles" ..
|
||||
make
|
||||
```
|
||||
|
||||
### For Linux on Linux
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
### For Windows cross compiling on Linux
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw64.cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
## Where is the log?
|
||||
|
||||
It is in your user's temp directory:
|
||||
|
@ -13,7 +13,7 @@ add_library(platform_Windows STATIC
|
||||
|
||||
add_subdirectory("capture")
|
||||
|
||||
FIND_PROGRAM(WINDRES_EXECUTABLE NAMES "windres.exe" DOC "windres executable")
|
||||
FIND_PROGRAM(WINDRES_EXECUTABLE NAMES "x86_64-w64-mingw32-windres" "windres.exe" DOC "windres executable")
|
||||
ADD_CUSTOM_COMMAND(TARGET platform_Windows POST_BUILD
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
COMMAND ${WINDRES_EXECUTABLE} -i resource.rc -o "${PROJECT_BINARY_DIR}/resource.o"
|
||||
|
@ -7,10 +7,12 @@ option(USE_NVFBC "Enable NVFBC Support" OFF)
|
||||
option(USE_DXGI "Enable DXGI Support" ON)
|
||||
|
||||
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()
|
||||
|
||||
if(NOT EXISTS "${NVFBC_SDK}\\inc" OR NOT IS_DIRECTORY "${NVFBC_SDK}\\inc")
|
||||
|
||||
file(TO_CMAKE_PATH "${NVFBC_SDK}" nvfbc_sdk)
|
||||
|
||||
if(NOT EXISTS "${nvfbc_sdk}/inc" OR NOT IS_DIRECTORY "${nvfbc_sdk}/inc")
|
||||
message("Disabling NVFBC support, can't find the SDK headers")
|
||||
set(USE_NVFBC OFF)
|
||||
endif()
|
||||
|
@ -7,7 +7,7 @@ add_library(capture_DXGI STATIC
|
||||
|
||||
add_definitions("-DCOBJMACROS -DINITGUID")
|
||||
|
||||
FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "dlltool.exe" DOC "dlltool executable")
|
||||
FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "x86_64-w64-mingw32-dlltool" "dlltool" "dlltool.exe" DOC "dlltool executable")
|
||||
ADD_CUSTOM_COMMAND(TARGET capture_DXGI POST_BUILD
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/dll"
|
||||
COMMAND ${DLLTOOL_EXECUTABLE} --def libd3d11.def --output-lib "${PROJECT_BINARY_DIR}/libd3d11.dll"
|
||||
|
@ -26,8 +26,10 @@ HRESULT __stdcall CreateDXGIFactory1(REFIID riid, void **factory);
|
||||
#define D3D_FEATURE_LEVEL_12_0 0xc000
|
||||
#define D3D_FEATURE_LEVEL_12_1 0xc100
|
||||
|
||||
#ifndef __dxgicommon_h__
|
||||
#define DXGI_ERROR_ACCESS_LOST _HRESULT_TYPEDEF_(0x887A0026L)
|
||||
#define DXGI_ERROR_WAIT_TIMEOUT _HRESULT_TYPEDEF_(0x887A0027L)
|
||||
#endif
|
||||
|
||||
enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE {
|
||||
DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME = 1,
|
||||
@ -188,6 +190,7 @@ typedef struct DXGI_MODE_DESC1
|
||||
}
|
||||
DXGI_MODE_DESC1;
|
||||
|
||||
#ifndef __dxgicommon_h__
|
||||
typedef enum DXGI_COLOR_SPACE_TYPE {
|
||||
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
|
||||
DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
|
||||
@ -216,6 +219,7 @@ typedef enum DXGI_COLOR_SPACE_TYPE {
|
||||
DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24,
|
||||
DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
|
||||
} DXGI_COLOR_SPACE_TYPE;
|
||||
#endif
|
||||
|
||||
DEFINE_GUID(IID_IDXGIOutput1, 0x00cddea8, 0x939b, 0x4b83, 0xa3,0x40,0xa6,0x85,0x22,0x66,0x66,0xcc);
|
||||
|
||||
|
@ -2,11 +2,12 @@ cmake_minimum_required(VERSION 3.0)
|
||||
project(capture_NVFBC LANGUAGES C CXX)
|
||||
|
||||
add_library(capture_NVFBC STATIC
|
||||
src/nvFBC.c
|
||||
src/nvfbc.c
|
||||
src/wrapper.cpp
|
||||
)
|
||||
|
||||
include_directories("${NVFBC_SDK}\\inc")
|
||||
file(TO_CMAKE_PATH "${NVFBC_SDK}" nvfbc_sdk)
|
||||
include_directories(file, "${nvfbc_sdk}/inc")
|
||||
|
||||
target_include_directories(capture_NVFBC
|
||||
PRIVATE
|
||||
|
17
c-host/toolchain-mingw64.cmake
Normal file
17
c-host/toolchain-mingw64.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# programs in the host environment
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
Loading…
Reference in New Issue
Block a user