-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
98 lines (76 loc) · 3.05 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# SPDX-FileCopyrightText: 2023 <copyright holder> <email>
# SPDX-License-Identifier: Apache-2.0
# - Try to find
# Once done this will define
# _FOUND - System has
# _INCLUDE_DIRS - The include directories
# _LIBRARIES - The libraries needed to use
# _DEFINITIONS - Compiler switches required for using
set(PROJECT_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/opendx/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/opendx/lib")
#Package
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/opendx)
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "opendx")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_DESCRIPTION "Open Source reimplementation of DirectX for Linux")
set(CPACK_PACKAGE_CONTACT "Eduardo P. Gomez <eduardoprocopiogomez@gmail.com>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-4-1")
#base include
include_directories(./include)
configure_file(include/config.hpp.in ../include/config.hpp)
#production include (for use with .so files)
include_directories(./prod_include)
#Defaults
set(CMAKE_C_STANDARD 23)
set(CMAKE_CXX_STANDARD 23)
cmake_minimum_required(VERSION 3.22)
project(OpenDX)
#Packaging
include(CPack)
install(DIRECTORY ${CMAKE_BINARY_DIR}/opendx/bin DESTINATION /usr/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/opendx/lib DESTINATION /usr/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ)
find_package(PkgConfig)
pkg_check_modules(PC_ QUIET )
set(_DEFINITIONS ${PC__CFLAGS_OTHER})
find_path(_INCLUDE_DIR
HINTS ${PC__INCLUDEDIR} ${PC__INCLUDE_DIRS}
PATH_SUFFIXES )
find_library(_LIBRARY NAMES
HINTS ${PC__LIBDIR} ${PC__LIBRARY_DIRS} )
pkg_check_modules(GTK4 REQUIRED gtk4)
pkg_check_modules(LIBDRM REQUIRED libdrm)
set(_LIBRARIES ${_LIBRARY} )
set(_INCLUDE_DIRS ${_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set _FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args( DEFAULT_MSG
_LIBRARY _INCLUDE_DIR)
mark_as_advanced(_INCLUDE_DIR _LIBRARY )
find_package(PkgConfig REQUIRED)
#dependency
include_directories(${GTK4_INCLUDE_DIRS})
link_directories(${GTK4_LIBRARY_DIRS})
include_directories(${LIBDRM_INCLUDE_DIRS})
link_directories(${LIBDRM_LIBRARY_DIRS})
#libopendx.so:
set(OPENDX_CPP libs/opendx/opendx.cpp)
#file(GLOB_RECURSE OPENDX_CPP libs/opendx/fun/*.cpp)
add_library(opendx SHARED ${OPENDX_CPP})
target_link_libraries(opendx ${GTK4_LIBRARIES})
#libdsetup.so:
set(DSETUP_CPP libs/dsetup/dsetup.cpp)
file(GLOB_RECURSE DSETUP_CPP libs/dsetup/fun/*.cpp)
add_library(dsetup SHARED ${DSETUP_CPP})
#libd3d9.so:
add_library(d3d9 SHARED libs/d3d9/d3d9.cpp)
target_link_libraries(d3d9 ${LIBDRM_LIBRARIES})
#dxdiag:
add_executable(dxdiag tools/dxdiag/main.cpp)
target_link_libraries(dxdiag ${GTK4_LIBRARIES})
target_link_libraries(dxdiag dsetup)
target_link_libraries(dxdiag d3d9)
#add ./tests/CMakeLists.txt
add_subdirectory(tests)