annotate src/CMakeLists.txt @ 47:233a68a261fe

ifdef cbcxv6
author mir3636
date Thu, 07 Mar 2019 19:42:27 +0900
parents 5f19e9554c30
children 214d21c891c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
997c54d8912c fix include dir
kono
parents:
diff changeset
1 cmake_minimum_required(VERSION 3.8)
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
2 project(xv6cbc C ASM)
42
997c54d8912c fix include dir
kono
parents:
diff changeset
3
997c54d8912c fix include dir
kono
parents:
diff changeset
4 set(USE_CUDA,0)
997c54d8912c fix include dir
kono
parents:
diff changeset
5 # -DUSE_CUDA
997c54d8912c fix include dir
kono
parents:
diff changeset
6 # add_definitions("-Wall -g -O")
997c54d8912c fix include dir
kono
parents:
diff changeset
7
47
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
8 if (APPLE)
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
9 set(CMAKE_C_COMPILER $ENV{CBC_LANG_COMPILER})
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
10 add_definitions("-Wall -g -arch arm -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
11 -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
12 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
13 -Wno-nullability-completeness -Wno-expansion-to-defined")
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
14 else (APPLE)
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
15 set(CMAKE_C_COMPILER /mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-gcc)
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
16 add_definitions("-B/mnt/dalmore-home/one/src/armgcc/cross/bin/arm-none-eabi-
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
17 -DCBCXV6=1 -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -I. -g -O0")
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
18 endif (APPLE)
42
997c54d8912c fix include dir
kono
parents:
diff changeset
19
997c54d8912c fix include dir
kono
parents:
diff changeset
20 # -DCMAKE_BUILD_TYPE=Debug
997c54d8912c fix include dir
kono
parents:
diff changeset
21 set(CMAKE_C_FLAGS_DEBUG "-O0")
45
5f19e9554c30 supless warning
k.fukuda
parents: 43
diff changeset
22 set(CMAKE_EXE_LINKER_FLAGS "-L. -arch armv7 -T kernel.ld -o kernel.elf ")
42
997c54d8912c fix include dir
kono
parents:
diff changeset
23
997c54d8912c fix include dir
kono
parents:
diff changeset
24 if (${USE_CUDA})
997c54d8912c fix include dir
kono
parents:
diff changeset
25 include_directories("/usr/local/cuda/include")
997c54d8912c fix include dir
kono
parents:
diff changeset
26 set(NVCCFLAG "-std=c++11" "-g" "-O0" )
997c54d8912c fix include dir
kono
parents:
diff changeset
27 if (UNIX AND NOT APPLE) # LINUX
997c54d8912c fix include dir
kono
parents:
diff changeset
28 set(CUDA_LINK_FLAGS "-L/usr/local/cuda/lib64 -lcuda -lcudart")
997c54d8912c fix include dir
kono
parents:
diff changeset
29 elseif (APPLE)
997c54d8912c fix include dir
kono
parents:
diff changeset
30 set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /usr/local/cuda/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib")
997c54d8912c fix include dir
kono
parents:
diff changeset
31 endif()
997c54d8912c fix include dir
kono
parents:
diff changeset
32 find_package(CUDA REQUIRED)
997c54d8912c fix include dir
kono
parents:
diff changeset
33 SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" )
997c54d8912c fix include dir
kono
parents:
diff changeset
34 endif()
997c54d8912c fix include dir
kono
parents:
diff changeset
35
997c54d8912c fix include dir
kono
parents:
diff changeset
36 include_directories(".")
997c54d8912c fix include dir
kono
parents:
diff changeset
37
997c54d8912c fix include dir
kono
parents:
diff changeset
38 macro( GearsCommand )
997c54d8912c fix include dir
kono
parents:
diff changeset
39 set( _OPTIONS_ARGS )
997c54d8912c fix include dir
kono
parents:
diff changeset
40 set( _ONE_VALUE_ARGS TARGET )
997c54d8912c fix include dir
kono
parents:
diff changeset
41 set( _MULTI_VALUE_ARGS SOURCES )
997c54d8912c fix include dir
kono
parents:
diff changeset
42 cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
997c54d8912c fix include dir
kono
parents:
diff changeset
43
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
44 set (_Gears_CBC_SOURCES)
42
997c54d8912c fix include dir
kono
parents:
diff changeset
45 set (_Gears_CSOURCES)
997c54d8912c fix include dir
kono
parents:
diff changeset
46 foreach(i ${_Gears_SOURCES})
997c54d8912c fix include dir
kono
parents:
diff changeset
47 if (${i} MATCHES "\\.cbc")
997c54d8912c fix include dir
kono
parents:
diff changeset
48 string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i})
997c54d8912c fix include dir
kono
parents:
diff changeset
49 add_custom_command (
997c54d8912c fix include dir
kono
parents:
diff changeset
50 OUTPUT ${j}
997c54d8912c fix include dir
kono
parents:
diff changeset
51 DEPENDS ${i}
997c54d8912c fix include dir
kono
parents:
diff changeset
52 COMMAND "perl" "gearsTools/generate_stub.pl" "-o" ${j} ${i}
997c54d8912c fix include dir
kono
parents:
diff changeset
53 )
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
54 list(APPEND _Gears_CBC_SOURCES ${j})
42
997c54d8912c fix include dir
kono
parents:
diff changeset
55 elseif (${i} MATCHES "\\.cu")
997c54d8912c fix include dir
kono
parents:
diff changeset
56 string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i})
997c54d8912c fix include dir
kono
parents:
diff changeset
57 add_custom_command (
997c54d8912c fix include dir
kono
parents:
diff changeset
58 OUTPUT ${j}
997c54d8912c fix include dir
kono
parents:
diff changeset
59 DEPENDS ${i}
997c54d8912c fix include dir
kono
parents:
diff changeset
60 COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i}
997c54d8912c fix include dir
kono
parents:
diff changeset
61 )
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
62 list(APPEND _Gears_CBC_SOURCES ${j})
42
997c54d8912c fix include dir
kono
parents:
diff changeset
63 else()
997c54d8912c fix include dir
kono
parents:
diff changeset
64 set(j ${i})
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
65 list(APPEND _Gears_CSOURCES ${j})
42
997c54d8912c fix include dir
kono
parents:
diff changeset
66 endif()
997c54d8912c fix include dir
kono
parents:
diff changeset
67 endforeach(i)
997c54d8912c fix include dir
kono
parents:
diff changeset
68
997c54d8912c fix include dir
kono
parents:
diff changeset
69 add_custom_command (
997c54d8912c fix include dir
kono
parents:
diff changeset
70 OUTPUT c/${_Gears_TARGET}-context.c
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
71 DEPENDS ${_Gears_CBC_SOURCES}
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
72 COMMAND "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CBC_SOURCES}
42
997c54d8912c fix include dir
kono
parents:
diff changeset
73 )
43
b94d72292dfa fix build arm asm file
anatofuz
parents: 42
diff changeset
74 add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c)
42
997c54d8912c fix include dir
kono
parents:
diff changeset
75 target_link_libraries(${_Gears_TARGET} m pthread)
997c54d8912c fix include dir
kono
parents:
diff changeset
76 endmacro()
997c54d8912c fix include dir
kono
parents:
diff changeset
77
997c54d8912c fix include dir
kono
parents:
diff changeset
78
997c54d8912c fix include dir
kono
parents:
diff changeset
79 GearsCommand(
997c54d8912c fix include dir
kono
parents:
diff changeset
80 TARGET
997c54d8912c fix include dir
kono
parents:
diff changeset
81 kernel
997c54d8912c fix include dir
kono
parents:
diff changeset
82 SOURCES
47
233a68a261fe ifdef cbcxv6
mir3636
parents: 45
diff changeset
83 lib/string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.c fs.c log.c main.c memide.c pipe.c proc.c spinlock.c
42
997c54d8912c fix include dir
kono
parents:
diff changeset
84 start.c swtch.S syscall.c sysfile.c sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c
997c54d8912c fix include dir
kono
parents:
diff changeset
85 entry-osx.S
997c54d8912c fix include dir
kono
parents:
diff changeset
86 )
997c54d8912c fix include dir
kono
parents:
diff changeset
87
997c54d8912c fix include dir
kono
parents:
diff changeset
88
997c54d8912c fix include dir
kono
parents:
diff changeset
89