Mercurial > hg > Members > anatofuz > CbC_xv6
comparison src/CMakeLists.txt @ 43:b94d72292dfa
fix build arm asm file
author | anatofuz |
---|---|
date | Sat, 02 Mar 2019 19:28:23 +0900 |
parents | 997c54d8912c |
children | 5f19e9554c30 |
comparison
equal
deleted
inserted
replaced
42:997c54d8912c | 43:b94d72292dfa |
---|---|
1 cmake_minimum_required(VERSION 3.8) | 1 cmake_minimum_required(VERSION 3.8) |
2 project(xv6cbc C ASM) | |
2 | 3 |
3 set(USE_CUDA,0) | 4 set(USE_CUDA,0) |
4 # -DUSE_CUDA | 5 # -DUSE_CUDA |
5 # add_definitions("-Wall -g -O") | 6 # add_definitions("-Wall -g -O") |
6 | 7 |
7 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) | 8 set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) |
8 add_definitions("-Wall -g") | 9 add_definitions("-Wall -g -arch arm -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -Werror -I. -g -O0 |
10 -Wno-macro-redefined -Wno-gnu-designator -Wno-sometimes-uninitialized -Wno-tautological-compare | |
11 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include") | |
9 | 12 |
10 # -DCMAKE_BUILD_TYPE=Debug | 13 # -DCMAKE_BUILD_TYPE=Debug |
11 set(CMAKE_C_FLAGS_DEBUG "-O0") | 14 set(CMAKE_C_FLAGS_DEBUG "-O0") |
12 | 15 |
13 if (${USE_CUDA}) | 16 if (${USE_CUDA}) |
28 set( _OPTIONS_ARGS ) | 31 set( _OPTIONS_ARGS ) |
29 set( _ONE_VALUE_ARGS TARGET ) | 32 set( _ONE_VALUE_ARGS TARGET ) |
30 set( _MULTI_VALUE_ARGS SOURCES ) | 33 set( _MULTI_VALUE_ARGS SOURCES ) |
31 cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) | 34 cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) |
32 | 35 |
36 set (_Gears_CBC_SOURCES) | |
33 set (_Gears_CSOURCES) | 37 set (_Gears_CSOURCES) |
34 foreach(i ${_Gears_SOURCES}) | 38 foreach(i ${_Gears_SOURCES}) |
35 if (${i} MATCHES "\\.cbc") | 39 if (${i} MATCHES "\\.cbc") |
36 string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) | 40 string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) |
37 add_custom_command ( | 41 add_custom_command ( |
38 OUTPUT ${j} | 42 OUTPUT ${j} |
39 DEPENDS ${i} | 43 DEPENDS ${i} |
40 COMMAND "perl" "gearsTools/generate_stub.pl" "-o" ${j} ${i} | 44 COMMAND "perl" "gearsTools/generate_stub.pl" "-o" ${j} ${i} |
41 ) | 45 ) |
42 list(APPEND _Gears_CSOURCES ${j}) | 46 list(APPEND _Gears_CBC_SOURCES ${j}) |
43 elseif (${i} MATCHES "\\.cu") | 47 elseif (${i} MATCHES "\\.cu") |
44 string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) | 48 string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) |
45 add_custom_command ( | 49 add_custom_command ( |
46 OUTPUT ${j} | 50 OUTPUT ${j} |
47 DEPENDS ${i} | 51 DEPENDS ${i} |
48 COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} | 52 COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} |
49 ) | 53 ) |
50 list(APPEND _Gears_CSOURCES ${j}) | 54 list(APPEND _Gears_CBC_SOURCES ${j}) |
51 else() | 55 else() |
52 set(j ${i}) | 56 set(j ${i}) |
57 list(APPEND _Gears_CSOURCES ${j}) | |
53 endif() | 58 endif() |
54 endforeach(i) | 59 endforeach(i) |
55 | 60 |
56 add_custom_command ( | 61 add_custom_command ( |
57 OUTPUT c/${_Gears_TARGET}-context.c | 62 OUTPUT c/${_Gears_TARGET}-context.c |
58 DEPENDS ${_Gears_CSOURCES} | 63 DEPENDS ${_Gears_CBC_SOURCES} |
59 COMMAND "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CSOURCES} | 64 COMMAND "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CBC_SOURCES} |
60 ) | 65 ) |
61 add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c) | 66 add_executable(${_Gears_TARGET} ${_Gears_CBC_SOURCES} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c) |
62 target_link_libraries(${_Gears_TARGET} m pthread) | 67 target_link_libraries(${_Gears_TARGET} m pthread) |
63 endmacro() | 68 endmacro() |
64 | 69 |
65 | 70 |
66 GearsCommand( | 71 GearsCommand( |