-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (82 loc) · 2.8 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
cmake_minimum_required(VERSION "3.14")
project(FmlLib VERSION 1.0.0)
set(FML_FMOD_DIRECTORY "" CACHE FILEPATH "Path to FMOD engine library.")
option(FML_IS_UBUNTU OFF)
message(STATUS "FML_FMOD_DIRECTORY: ${FML_FMOD_DIRECTORY}")
message(STATUS "FML_IS_UBUNTU: ${FML_IS_UBUNTU}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(FML_IS_UBUNTU)
add_compile_definitions("FML_IS_UBUNTU")
endif()
set(FML_SRC_DIR "${PROJECT_SOURCE_DIR}/src")
file(GLOB SOURCE_FILES
"${FML_SRC_DIR}/fml_*.hpp"
"${FML_SRC_DIR}/fml_*.cpp"
"${FML_SRC_DIR}/internal_common.hpp"
"${FML_SRC_DIR}/internal_common.cpp"
)
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
if (FML_IS_UBUNTU)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "fml")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".so")
else()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "fml_x64")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".dll")
endif()
include_directories(
"${FML_FMOD_DIRECTORY}/api/core/inc"
"${FML_FMOD_DIRECTORY}/api/studio/inc"
)
if (FML_IS_UBUNTU)
link_libraries(
"${FML_FMOD_DIRECTORY}/api/core/lib/x86_64/libfmod.so.13"
"${FML_FMOD_DIRECTORY}/api/studio/lib/x86_64/libfmodstudio.so.13"
)
else()
# TODO link_libraries with absolute paths instead (like with linux)
link_directories(
"${FML_FMOD_DIRECTORY}/api/core/lib"
"${FML_FMOD_DIRECTORY}/api/studio/lib"
)
endif()
# Copy FMOD DLLs into the build directory just so it's easier to find them
# after building, because they'll need to be copied into the extension manually.
if (FML_IS_UBUNTU)
configure_file(
"${FML_FMOD_DIRECTORY}/api/core/lib/x86_64/libfmod.so.13"
"${CMAKE_CURRENT_BINARY_DIR}/libfmod.so.13"
COPYONLY
)
configure_file(
"${FML_FMOD_DIRECTORY}/api/studio/lib/x86_64/libfmodstudio.so.13"
"${CMAKE_CURRENT_BINARY_DIR}/libfmodstudio.so.13"
COPYONLY
)
else()
configure_file(
"${FML_FMOD_DIRECTORY}/api/core/lib/x64/fmod.dll"
"${CMAKE_CURRENT_BINARY_DIR}/fmod.dll"
COPYONLY
)
configure_file(
"${FML_FMOD_DIRECTORY}/api/studio/lib/x64/fmodstudio.dll"
"${CMAKE_CURRENT_BINARY_DIR}/fmodstudio.dll"
COPYONLY
)
endif()
if (FML_IS_UBUNTU)
target_link_libraries(
${PROJECT_NAME}
"${CMAKE_CURRENT_BINARY_DIR}/libfmod.so.13"
"${CMAKE_CURRENT_BINARY_DIR}/libfmodstudio.so.13"
)
else()
target_link_libraries(
${PROJECT_NAME}
"${FML_FMOD_DIRECTORY}/api/core/lib/x64/fmod_vc.lib"
"${FML_FMOD_DIRECTORY}/api/studio/lib/x64/fmodstudio_vc.lib"
)
endif()