-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
84 lines (72 loc) · 2.91 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
cmake_minimum_required(VERSION 3.16)
project(vmdtofbx)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /execution-charset:SHIFT_JIS /source-charset:UTF-8")
set(FBX_SDK_DIR "D:/ProgramFiles/Autodesk/FBX/2020.2.1")
# 64bit
set(CMAKE_C_FLAGS -m64)
set(CMAKE_CXX_FLAGS_DEBUG "/MDd")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}/lib>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}/lib>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_BINARY_DIR}/bin>)
# add script
# use fbx sdk sample
file(GLOB sources
./src/*.cpp
./src/*.h
${FBX_SDK_DIR}/samples/Common/*.cxx
${FBX_SDK_DIR}/samples/Common/*.h
${FBX_SDK_DIR}/samples/MyOwnWriterReader/*.cxx
${FBX_SDK_DIR}/samples/MyOwnWriterReader/*.h
)
add_executable(vmdtofbx ${sources})
# include
include_directories("${FBX_SDK_DIR}/include")
if (WIN32)
#################
## Windows
#################
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
link_directories("${FBX_SDK_DIR}/lib/vs2019/x64/debug")
file(GLOB libs ${FBX_SDK_DIR}/lib/vs2019/x64/debug/*-md.lib)
target_link_libraries(${PROJECT_NAME} ${libs} wininet.lib)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${FBX_SDK_DIR}/lib/vs2019/x64/debug/libfbxsdk.dll
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libfbxsdk.dll)
else ()
link_directories("${FBX_SDK_DIR}/lib/vs2019/x64/release")
file(GLOB libs ${FBX_SDK_DIR}/lib/vs2019/x64/release/*-md.lib)
target_link_libraries(${PROJECT_NAME} ${libs} wininet.lib)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${FBX_SDK_DIR}/lib/vs2019/x64/release/libfbxsdk.dll
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libfbxsdk.dll)
endif ()
else ()
#################
## Linux
## Don't func
#################
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
link_directories("${FBX_SDK_DIR}/lib/gcc/x64/debug")
file(GLOB libs ${FBX_SDK_DIR}/lib/gcc/x64/debug/*.a)
target_link_libraries(${PROJECT_NAME} ${libs})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${FBX_SDK_DIR}/lib/gcc/x64/debug/libfbxsdk.so
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libfbxsdk.so)
else ()
link_directories("${FBX_SDK_DIR}/lib/gcc/x64/release")
file(GLOB libs ${FBX_SDK_DIR}/lib/gcc/x64/release/*.a)
target_link_libraries(${PROJECT_NAME} ${libs})
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${FBX_SDK_DIR}/lib/gcc/x64/release/libfbxsdk.so
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libfbxsdk.so)
endif ()
endif ()