summaryrefslogtreecommitdiffstats
path: root/Samples/CommonSrc/CMakeLists.txt
blob: 3cfa0091581a47355216bc66e8af03e6140b8b00 (plain)
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
project(CommonSrc)

set(SOURCE_FILES
    Platform/Platform.cpp
    Platform/Platform.cpp
    Render/Render_Device.cpp
    Render/Render_LoadTextureDDS.cpp
    Render/Render_LoadTextureTGA.cpp
    Render/Render_XmlSceneLoader.cpp
)

if(WIN32)
    list(APPEND SOURCE_FILES 
        Platform/Win32_Platform.cpp
        Platform/Win32_Gamepad.cpp
        Render/Render_D3D10_Device.cpp
        Render/Render_D3D11_Device.cpp
    )

	find_package(DirectX REQUIRED)
    list(APPEND CommonSrc_EXTRA_LIBS 
    	${DirectX_D3D10_LIBRARY}
    	${DirectX_D3D11_LIBRARY}
    	${DirectX_LIB_SEARCH_PATH}/d3dcompiler.lib
    	${DirectX_LIB_SEARCH_PATH}/dxgi.lib
	)
	include_directories(${DirectX_INC_SEARCH_PATH})

elseif(APPLE)

    list(APPEND SOURCE_FILES 
        Platform/OSX_Platform.mm
        Platform/OSX_Gamepad.cpp
        Platform/OSX_WavPlayer.cpp
	    Render/Render_GL_Device.cpp
    )

    find_library(OpenGL_LIBRARY OpenGL)
    find_library(COCOA_LIBRARY Cocoa)
    list(APPEND CommonSrc_EXTRA_LIBS 
        ${COCOA_LIBRARY} 
        ${OpenGL_LIBRARY}
    )

else()

    list(APPEND SOURCE_FILES 
        Platform/Linux_Platform.cpp
        Platform/Linux_Gamepad.cpp
	    Render/Render_GL_Device.cpp
    )

    list(APPEND CommonSrc_EXTRA_LIBS GL GLU glut) 

endif()

add_library (CommonSrc STATIC ${SOURCE_FILES})
target_link_libraries(CommonSrc ${CommonSrc_EXTRA_LIBS})