summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llphysicsextensions/CMakeLists.txt
blob: d3fe503e8c34c616c497c76de96051276e21178d (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
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
# -*- cmake -*-

project(llphysicsextensions)

include(00-Common)
include(Variables)
include(LLCommon)
include(LLMath)

set(LLPHYSICSEXTENSIONS_LIB_NAME     llphysicsextensions)

if (WINDOWS)
   set(LLPHYSICSEXTENSIONS_LIBRARIES ${LLPHYSICSEXTENSIONS_LIB_NAME}.lib)
else (WINDOWS)
   set(LLPHYSICSEXTENSIONS_LIBRARIES ${LLPHYSICSEXTENSIONS_LIB_NAME}.a)
endif (WINDOWS)

set(LLPHYSICSEXTENSIONS_INCLUDE_DIR
    ${CMAKE_CURRENT_SOURCE_DIR})

set(LLPHYSICSEXTENSIONS_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug)
set(LLPHYSICSEXTENSIONS_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release)

#set(LLPHYSICSEXTENSIONS_LIBRARIES_LIBRARIES
#    debug     ${LLPHYSICSEXTENSIONS_DEBUG_LIB}
#    optimized ${LLPHYSICSEXTENTIONS_RELEASE_LIB}
#)

if (LINUX)
    list(INSERT LLPHYSICSEXTENSIONS_LIBRARIES 0 -Wl,--start-group)
    list(APPEND LLPHYSICSEXTENSIONS_LIBRARIES -Wl,--end-group)
endif (LINUX)

#include_directories(
#    ${CMAKE_SOURCE_DIR}/llphysicsextensions
#    ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}
#    ${LLCOMMON_INCLUDE_DIRS}
#    ${LLMATH_INCLUDE_DIRS}
#    )

set(llphysicsextensions_SOURCE_FILES
    llpathinglib.cpp
    LLPathingLibStubImpl.cpp
    llconvexdecomposition.cpp
    LLConvexDecompositionStubImpl.cpp
    llphysicsextensions.cpp
    LLPhysicsExtensionsStubImpl.cpp
    )
    
set(llphysicsextensions_HEADER_FILES

    ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llpathinglib.h
    ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llconvexdecomposition.h
    ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/llphysicsextensions.h
    LLPathingLibStubImpl.h
    LLConvexDecompositionStubImpl.h
    LLPhysicsExtensionsStubImpl.h
    )

if (WINDOWS)
   list(APPEND llphysicsextensions_HEADER_FILES 
               ${LLPHYSICSEXTENSIONS_INCLUDE_DIR}/windowsincludes.h)
endif (WINDOWS)

set_source_files_properties(${llphysicsextensions_HEADER_FILES}
                            PROPERTIES HEADER_FILE_ONLY TRUE)

# some of the include files contain compile-time switches based on these
set_source_files_properties(${llphysicsextensions_SOURCE_FILES}
                            PROPERTIES COMPILE_DEFINITIONS "LL_PATHING_LIB_STUB;LL_CONVEX_DECOMP_STUB;LL_PHYSICS_EXTENSIONS_STUB")

list(APPEND llphysicsextensionsstub_SOURCE_FILES ${llphysicsextensions_HEADER_FILES})

add_library(${PROJECT_NAME}stub ${${PROJECT_NAME}_SOURCE_FILES})
target_include_directories(${PROJECT_NAME}stub INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME}stub llmath llcommon)
list(REMOVE_ITEM ${PROJECT_NAME}_HEADER_FILES
	LLPathingLibStubImpl.h
	LLConvexDecompositionStubImpl.h
	LLPhysicsExtensionsStubImpl.h)
#install(FILES ${${PROJECT_NAME}_HEADER_FILES} DESTINATION include/${PROJECT_NAME})
if (BUILD_SHARED_LIBS)
	if (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu)
		set(_LIB lib/${ARCH}-linux-gnu)
	elseif (EXISTS /lib64 AND NOT ${LINUX_DISTRO} MATCHES arch)
		set(_LIB lib64)
	else ()
		set(_LIB lib)
	endif ()
	install(TARGETS ${PROJECT_NAME}stub DESTINATION ${_LIB})
endif ()

if (LINUX)
    IF(CMAKE_BUILD_TYPE MATCHES Release)
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/release)
    ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
    IF(CMAKE_BUILD_TYPE MATCHES Debug)
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/debug)
    ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)

endif (LINUX)