Commit 8d5479ca authored by Dick Hollenbeck's avatar Dick Hollenbeck

pcbnew/CMakeLists.txt formatting and librt fix

parent 3e18fa42
add_definitions(-DPCBNEW)
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
......@@ -236,7 +236,7 @@ set(PCBNEW_COMMON_SRCS
set(PCBNEW_SCRIPTING_DIALOGS
dialogs/dialog_scripting_base.cpp
dialogs/dialog_scripting.cpp
)
)
set(PCBNEW_SCRIPTING_PYTHON_HELPERS
......@@ -244,11 +244,11 @@ set(PCBNEW_SCRIPTING_PYTHON_HELPERS
../scripting/python_scripting.cpp
scripting/pcbnew_scripting_helpers.cpp
scripting/pcbnew_footprint_wizards.cpp
)
)
if (KICAD_SCRIPTING)
set(PCBNEW_SCRIPTING_SRCS
${PCBNEW_SCRIPTING_DIALOGS}
${PCBNEW_SCRIPTING_DIALOGS}
pcbnew_wrap.cxx
${PCBNEW_SCRIPTING_PYTHON_HELPERS}
)
......@@ -263,45 +263,45 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting )
if (DEBUG)
set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG)
endif(DEBUG)
endif()
# collect CFLAGS , and pass them to swig later
get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
SET(SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
set(SWIG_FLAGS ${SWIG_FLAGS} -D${d} )
endforeach()
# check if we have IO_MGR and KICAD_PLUGIN available
if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN)
set(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN)
endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE)
if ( USE_PCBNEW_NANOMETRES )
SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES)
set(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES)
endif( USE_PCBNEW_NANOMETRES )
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
if (KICAD_SCRIPTING)
SET(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
DEPENDS scripting/pcbnew.i
DEPENDS scripting/board.i
DEPENDS scripting/board_item.i
DEPENDS scripting/module.i
DEPENDS scripting/plugins.i
DEPENDS scripting/units.i
DEPENDS ../scripting/dlist.i
DEPENDS ../scripting/kicad.i
DEPENDS ../scripting/wx.i
DEPENDS ../scripting/kicadplugins.i
COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
set(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
DEPENDS scripting/pcbnew.i
DEPENDS scripting/board.i
DEPENDS scripting/board_item.i
DEPENDS scripting/module.i
DEPENDS scripting/plugins.i
DEPENDS scripting/units.i
DEPENDS ../scripting/dlist.i
DEPENDS ../scripting/kicad.i
DEPENDS ../scripting/wx.i
DEPENDS ../scripting/kicadplugins.i
COMMAND ${SWIG_EXECUTABLE} ${SWIG_OPTS} -o ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx scripting/pcbnew.i
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(KICAD_SCRIPTING)
......@@ -310,31 +310,31 @@ endif(KICAD_SCRIPTING)
# _pcbnew DLL/DSO file creation
###
if (KICAD_SCRIPTING_MODULES)
if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32 AND NOT APPLE)
set ( PCBNEW_EXTRA_LIBS "rt" )
endif()
SET(CMAKE_SWIG_FLAGS ${SWIG_FLAGS})
SET_SOURCE_FILES_PROPERTIES(scripting/pcbnew.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(pcbnew python scripting/pcbnew.i ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS})
SWIG_LINK_LIBRARIES(pcbnew
3d-viewer
pcbcommon
common
pcad2kicadpcb
polygon
bitmaps
${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
rt
)
endif (KICAD_SCRIPTING_MODULES)
if (KICAD_SCRIPTING_MODULES)
if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32 AND NOT APPLE)
set ( PCBNEW_EXTRA_LIBS "rt" )
endif ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32 AND NOT APPLE)
set(CMAKE_SWIG_FLAGS ${SWIG_FLAGS})
set_source_files_properties(scripting/pcbnew.i PROPERTIES CPLUSPLUS ON)
swig_add_module(pcbnew python scripting/pcbnew.i ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SRCS} ${PCBNEW_COMMON_SRCS})
swig_link_libraries(pcbnew
3d-viewer
pcbcommon
common
pcad2kicadpcb
polygon
bitmaps
${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
${PCBNEW_EXTRA_LIBS}
)
endif (KICAD_SCRIPTING_MODULES)
###
# Windows resource file
......@@ -382,11 +382,11 @@ set_source_files_properties( dialogs/dialog_freeroute_exchange.cpp
# auto-generate specctra_lexer.h and specctra_keywords.cpp
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/specctra.keywords
${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp
DSN
)
${CMAKE_CURRENT_SOURCE_DIR}/specctra.keywords
${CMAKE_CURRENT_SOURCE_DIR}/specctra_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/specctra_keywords.cpp
DSN
)
###
......@@ -431,43 +431,39 @@ install(TARGETS pcbnew
DESTINATION ${KICAD_BIN}
COMPONENT binary)
if(WIN32)
set(FINAL_EXE,pcbnew.exe)
set(FINAL_EXE,pcbnew.exe)
elseif(APPLE)
set(FINAL_EXE,pcbnew.app/Contents/MacOS/pcbnew)
set(FINAL_EXE,pcbnew.app/Contents/MacOS/pcbnew)
else()
set(FINAL_EXE,pcbnew)
set(FINAL_EXE,pcbnew)
endif(WIN32)
if(KICAD_SCRIPTING)
add_custom_target(FixSwigImportsScripting ALL
${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FINAL_EXE}
COMMENT "Fixing swig_import_helper in Kicad scripting"
)
if(KICAD_SCRIPTING)
add_custom_target(FixSwigImportsScripting ALL
${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FINAL_EXE}
COMMENT "Fixing swig_import_helper in Kicad scripting"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py
DESTINATION ${PYTHON_DEST})
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST})
endif(KICAD_SCRIPTING)
if (KICAD_SCRIPTING_MODULES)
add_custom_target(FixSwigImportsModuleScripting ALL
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py
DESTINATION ${PYTHON_DEST})
if (WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd
DESTINATION ${PYTHON_DEST})
else(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so
DESTINATION ${PYTHON_DEST})
endif(WIN32)
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST})
if (WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST})
else(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST})
endif(WIN32)
endif(KICAD_SCRIPTING_MODULES)
......@@ -483,4 +479,3 @@ add_executable(layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp
)
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment