forked from Areidz/nds_loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (47 loc) · 1.65 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
cmake_minimum_required(VERSION 3.3.2)
project(ndsloader CXX)
# build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(PROJECT_CXXFLAGS "${PROJECT_CXXFLAGS} -O0")
set(CMAKE_VERBOSE_MAKEFILE TRUE)
else ()
set(PROJECT_CXXFLAGS "${PROJECT_CXXFLAGS} -O3")
endif ()
message("Build type: ${CMAKE_BUILD_TYPE}")
# project files
set(PROJECT_SOURCEFILES
nds.h
nds.cpp
)
# external cmake modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake_modules
)
# ida sdk
find_package(IDASDK REQUIRED)
set(PROJECT_INCLUDEDIRECTORIES
${PROJECT_INCLUDEDIRECTORIES}
${IDASDK_INCLUDEDIRECTORIES}
)
set(PROJECT_DEFINITIONS ${PROJECT_DEFINITIONS} ${IDASDK_DEFINITIONS})
set(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${IDASDK_LIBRARIES})
# output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# static files
file(COPY ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${CMAKE_BINARY_DIR}/lib)
# project settings
set(PROJECT_OUTPUTFILENAME "nds")
set(CMAKE_CXX_FLAGS ${PROJECT_CXXFLAGS})
add_definitions(${PROJECT_DEFINITIONS})
include_directories(${PROJECT_INCLUDEDIRECTORIES})
link_directories(${PROJECT_LIBRARYFOLDERPATHLIST})
add_library(${PROJECT_OUTPUTFILENAME} SHARED ${PROJECT_SOURCEFILES})
target_link_libraries(${PROJECT_OUTPUTFILENAME} ${PROJECT_LIBRARIES})
set_target_properties(${PROJECT_OUTPUTFILENAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
set_target_properties(${PROJECT_OUTPUTFILENAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_OUTPUTFILENAME} PROPERTIES SUFFIX ".llx")