-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
118 lines (97 loc) · 3.12 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
cmake_minimum_required(VERSION 2.6)
project(d3dgl)
if(WIN32)
add_definitions("-D_WIN32 -D_WIN32_WINNT=0x0600")
if(MINGW AND NOT DLLTOOL)
if(HOST)
set(DLLTOOL "${HOST}-dlltool")
else()
set(DLLTOOL "dlltool")
endif()
endif()
endif()
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
find_package(OpenGL REQUIRED)
check_cxx_compiler_flag("-std=c++11" HAVE_STD_CXX11)
if(HAVE_STD_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
check_cxx_compiler_flag("-Wall" HAVE_WALL_SWITCH)
if(HAVE_WALL_SWITCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
check_cxx_compiler_flag("-Wextra" HAVE_WEXTRA_SWITCH)
if(HAVE_WEXTRA_SWITCH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
endif()
check_c_compiler_flag("-std=c99" HAVE_STD_C99)
if(HAVE_STD_C99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
endif()
check_c_compiler_flag("-Wall" HAVE_C_WALL_SWITCH)
if(HAVE_C_WALL_SWITCH)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()
check_c_compiler_flag("-Wextra" HAVE_C_WEXTRA_SWITCH)
if(HAVE_C_WEXTRA_SWITCH)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
endif()
add_library(mojoshader STATIC mojoshader/mojoshader.c
mojoshader/mojoshader_common.c
mojoshader/mojoshader.h
mojoshader/mojoshader_internal.h
mojoshader/mojoshader_version.h
)
set(LIBNAME d3d9)
include_directories("${d3dgl_SOURCE_DIR}/include" "${d3dgl_SOURCE_DIR}" "${d3dgl_BINARY_DIR}" ${OPENGL_INCLUDE_DIR})
add_definitions("-DGLEW_STATIC")
set(EXTRA_LIBS mojoshader ${OPENGL_LIBRARIES} dxguid)
if(WIN32 AND CMAKE_COMPILER_IS_GNUCC)
set(EXTRA_LIBS ${EXTRA_LIBS} -static-libgcc -static-libstdc++ -Wl,--enable-stdcall-fixup)
endif()
set(HDRS include/query.hpp
include/swapchain.hpp
include/rendertarget.hpp
include/bufferobject.hpp
include/plainsurface.hpp
include/vertexshader.hpp
include/pixelshader.hpp
include/vertexdeclaration.hpp
include/texture.hpp
include/texture3d.hpp
include/texturecube.hpp
include/device.hpp
include/adapter.hpp
include/d3dgl.hpp
include/glformat.hpp
include/trace.hpp
include/commandqueue.hpp
include/private_iids.hpp
include/allocators.hpp
)
set(SRCS src/query.cpp
src/swapchain.cpp
src/rendertarget.cpp
src/bufferobject.cpp
src/plainsurface.cpp
src/vertexshader.cpp
src/pixelshader.cpp
src/vertexdeclaration.cpp
src/texture.cpp
src/texture3d.cpp
src/texturecube.cpp
src/device.cpp
src/adapter.cpp
src/d3dgl.cpp
src/glformat.cpp
src/commandqueue.cpp
main.cpp
glew.c
)
add_library(${LIBNAME} SHARED ${SRCS} ${HDRS} d3d9.def)
target_link_libraries(${LIBNAME} ${EXTRA_LIBS})
if(WIN32)
set_target_properties(${LIBNAME} PROPERTIES PREFIX "")
endif()
add_executable(d3dtest d3dtest.cpp)