forked from DaveeFTW/pthread-embedded
-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
102 lines (81 loc) · 2.57 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
97
98
99
100
101
cmake_minimum_required(VERSION 3.0)
project(pthread-embedded LANGUAGES C)
set(CMAKE_C_STANDARD 99)
option(BUILD_TESTSUITE "Build testsuite" OFF)
if (VITA)
include("$ENV{VITASDK}/share/vita.cmake" REQUIRED)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -fno-strict-aliasing -fno-lto")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -Werror -D__CLEANUP_CXX -fno-lto")
include_directories(${CMAKE_SOURCE_DIR})
if(VITA)
include_directories(${CMAKE_SOURCE_DIR}/platform/vita/)
file(GLOB PLATFORM_SOURCES ${CMAKE_SOURCE_DIR}/platform/vita/vita_osal.c)
set(VITA_APP_NAME "PTHREAD TEST")
set(VITA_TITLEID "PTRD00000")
set(VITA_VERSION "01.00")
set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1")
elseif (PLATFORM_PSP)
include_directories(${CMAKE_SOURCE_DIR}/platform/psp/)
include_directories(${CMAKE_SOURCE_DIR}/platform/helper/)
link_directories(${PSPSDK}/lib ${PSPDEV}/lib)
file(GLOB PLATFORM_SOURCES ${CMAKE_SOURCE_DIR}/platform/psp/psp_osal.c)
set(PSP_APP_NAME "PTHREAD TEST")
endif()
file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/*.c)
file(GLOB TEST_SOURCES ${CMAKE_SOURCE_DIR}/tests/*.c)
file(GLOB HELPER_SOURCES ${CMAKE_SOURCE_DIR}/platform/helper/*.c)
if (VITA)
list(APPEND TEST_SOURCES ${CMAKE_SOURCE_DIR}/platform/vita/main.c)
elseif (PLATFORM_PSP)
list(APPEND PLATFORM_SOURCES ${HELPER_SOURCES})
list(APPEND TEST_SOURCES ${CMAKE_SOURCE_DIR}/platform/psp/main.c)
endif()
add_library(pthread STATIC
${SOURCES}
${PLATFORM_SOURCES}
)
if (BUILD_TESTSUITE)
add_executable(pthread-test
${TEST_SOURCES}
)
target_link_libraries(pthread-test pthread)
if(VITA)
vita_create_self(pthread-test.self pthread-test UNSAFE)
vita_create_vpk(pthread-test.vpk ${VITA_TITLEID} pthread-test.self
VERSION ${VITA_VERSION}
NAME ${VITA_APP_NAME}
FILE platform/vita/sce_sys sce_sys
)
elseif (PLATFORM_PSP)
target_link_libraries(pthread-test
${PSP_LIBRARIES}
)
create_pbp_file(
TARGET pthread-test
TITLE ${PSP_APP_NAME}
)
endif()
endif()
install(FILES
pthread_public.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
RENAME pthread.h
)
install(FILES
sched.h semaphore.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
)
if(VITA)
install(FILES
platform/vita/pte_types.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
)
elseif (PLATFORM_PSP)
install(FILES
platform/psp/pte_types.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/
)
endif()
install(TARGETS pthread ARCHIVE)