-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
113 lines (92 loc) · 2.87 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
102
103
104
105
106
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 3.1)
project(PCBPLACER)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pthread -Ofast -funsafe-math-optimizations -fpermissive -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb")
find_package(Boost REQUIRED)
find_library(SWIG_EXECUTABLE swig)
if(NOT SWIG_EXECUTABLE)
set(SWIG_EXECUTABLE "swig")
endif()
#find_package( PythonInterp 2.7 REQUIRED )
find_package( PythonInterp 3 REQUIRED )
#find_package( PythonLibs 2.7 REQUIRED )
find_package( PythonLibs 3 REQUIRED )
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARYDIR})
set(PCBPLACER_HOME ${PROJECT_SOURCE_DIR} )
set(KICADPARSER_HOME
${PROJECT_SOURCE_DIR}/module/KicadParser
)
add_subdirectory(${KICADPARSER_HOME})
set (PCBPLACER_SRC
src/GridBasedPlacer.cpp
src/globalParam.cpp
src/readFiles.cpp
src/PcbPlacer_wrapper.cpp
src/linreg.cpp
src/Module.cpp
src/Hierarchy.cpp
src/Node.cpp
#src/HPlacerUtils.cpp
)
set (PCBPLACER_HEADER
src/GridBasedPlacer.hpp
src/globalParam.h
src/util.h
src/Node.hpp
src/Hierarchy.hpp
src/Module.hpp
src/readFiles.hpp
src/Pin.hpp
src/linreg.h
src/Logger.hpp
#src/HPlacerUtils.hpp
)
set (PLACER_SWIG_FILES
src/PcbPlacer.i
)
############################################################
# include directories
############################################################
include_directories(
${KICADPARSER_HOME}/src
${PYTHON_INCLUDE_DIRS}
)
############################################################
# Create a library
############################################################
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PCBPLACER_HOME}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PCBPLACER_HOME}/lib)
add_library( PCBPLACERlib SHARED
${PCBPLACER_SRC}
)
set_target_properties( PCBPLACERlib
PROPERTIES OUTPUT_NAME "PCBPLACER"
)
############################################################
# Create an executable
############################################################
add_custom_command( OUTPUT ${PCBPLACER_HOME}/src/PcbPlacer_wrapper.cpp ${PCBPLACER_LIB_FILES}
COMMAND ${SWIG_EXECUTABLE} -python -py3 -c++ -o ${PCBPLACER_HOME}/src/PcbPlacer_wrapper.cpp ${PCBPLACER_HOME}/src/PcbPlacer.i
WORKING_DIRECTORY ${PCBPLACER_HOME}
DEPENDS ${PLACER_SWIG_FILES}
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PCBPLACER_HOME}/bin)
add_executable( PCBPLACER src/main.cpp )
add_dependencies( PCBPLACER kicadpcbparserlib )
target_link_libraries( PCBPLACER
PCBPLACERlib
kicadpcbparserlib
${Boost_LIBRARIES}
${PYTHON_LIBRARIES}
)
############################################################
# Install
############################################################
install(FILES ${PCBPLACER_HEADER} DESTINATION include)
install(TARGETS PCBPLACER DESTINATION bin)
install(TARGETS PCBPLACERlib DESTINATION lib)