forked from PSP-Archive/AMGLib-Plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (52 loc) · 1.7 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
cmake_minimum_required(VERSION 3.10)
project(AMGLib-Plus C CXX ASM)
include(GNUInstallDirs)
set(CMAKE_BUILD_TYPE Release)
option(BUILD_EXAMPLES "Build examples" ON)
add_library(lodepng STATIC)
target_include_directories(lodepng PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external/lodepng>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include>
)
target_sources(lodepng PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/lodepng/lodepng.cpp)
# Set the output library
set(TARGET_LIB AMG)
add_library(${TARGET_LIB} STATIC)
# Include directories
include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${PSPDEV}/psp/sdk/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/AMG>
)
# Define the source files
set(SOURCE_DIR src)
file(GLOB_RECURSE LIB_SOURCES ${SOURCE_DIR}/*.cpp)
# Add sources to the target
target_sources(${TARGET_LIB} PRIVATE ${LIB_SOURCES})
# Define preprocessor defines
target_compile_definitions(${TARGET_LIB} PRIVATE _DEBUG PSP)
# Linker flags
target_link_libraries(${TARGET_LIB}
-llodepng
-lpspaudio
-lpspmp3
-lbulletpsp
-lpsputility
-lpspctrl
-lpsppower
-lpsprtc
-lpspgu
-lm
-lstdc++
-lpspsdk
${OSL_LIBRARIES}
)
set(OSL_LIBS "-losl -lpng -lz -lpsphprm -lpspmpeg -lpspjpeg -lpspmpegbase -lpspaudiocodec")
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Installation instructions
install(TARGETS lodepng DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS ${TARGET_LIB} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/external/lodepng/lodepng.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(DIRECTORY include/AMG DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h")