forked from extremecoders-re/pycdc-builds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (62 loc) · 2.18 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
project(pycdc)
cmake_minimum_required(VERSION 2.8)
# For generating the bytes tables
find_package(PythonInterp REQUIRED)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror ${CMAKE_CXX_FLAGS}")
endif()
set(PYTHON_VERSIONS
10 11 13 14 15 16 # Python 1.1 and 1.2 are marshal-identical
20 21 22 23 24 25 26 27
30 31 32 33 34 35 36
)
foreach(ver ${PYTHON_VERSIONS})
set(MAP_FILES ${MAP_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/bytes/python_${ver}.map)
set(MAP_SOURCES ${MAP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/bytes/python_${ver}.cpp)
endforeach()
add_custom_command(OUTPUT ${MAP_SOURCES}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/bytes/comp_map.py
${CMAKE_CURRENT_SOURCE_DIR}/bytes
${CMAKE_CURRENT_BINARY_DIR}/bytes
DEPENDS ${MAP_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/bytes/comp_map.py
)
set(COMMON_SOURCES
bytecode.cpp
data.cpp
pyc_code.cpp
pyc_module.cpp
pyc_numeric.cpp
pyc_object.cpp
pyc_sequence.cpp
pyc_string.cpp
${MAP_SOURCES}
)
set(pycdc_AST_SOURCES
ASTree.cpp
ASTNode.cpp
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_library(pycxx STATIC ${COMMON_SOURCES})
add_executable(pycdas pycdas.cpp)
target_link_libraries(pycdas pycxx)
install(TARGETS pycdas
RUNTIME DESTINATION bin)
add_executable(pycdc pycdc.cpp ${pycdc_AST_SOURCES})
target_link_libraries(pycdc pycxx)
install(TARGETS pycdc
RUNTIME DESTINATION bin)
# For tests
if(POLICY CMP0037)
# Don't complain about adding a target named "test"
cmake_policy(SET CMP0037 OLD)
endif()
add_custom_target(test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_test.sh"
"${CMAKE_CURRENT_SOURCE_DIR}/tests"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(test pycdc)
add_custom_target(rt_test "${CMAKE_CURRENT_SOURCE_DIR}/pycdc_rt_test.sh"
"${CMAKE_CURRENT_BINARY_DIR}/tests"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_dependencies(rt_test test)