pcbnew/CMakeLists.txt formatting and librt fix

This commit is contained in:
Dick Hollenbeck 2013-01-12 18:34:16 -06:00
parent 3e18fa422c
commit 8d5479ca1c
1 changed files with 74 additions and 79 deletions

View File

@ -2,8 +2,8 @@ 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})
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
@ -263,31 +263,31 @@ 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} )
set(SWIG_OPTS -python -c++ -outdir ${CMAKE_CURRENT_BINARY_DIR} ${SWIG_FLAGS} )
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx
DEPENDS scripting/pcbnew.i
DEPENDS scripting/board.i
DEPENDS scripting/board_item.i
@ -310,12 +310,17 @@ endif(KICAD_SCRIPTING)
# _pcbnew DLL/DSO file creation
###
if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32 AND NOT APPLE)
set ( PCBNEW_EXTRA_LIBS "rt" )
endif()
if (KICAD_SCRIPTING_MODULES)
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
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
@ -326,16 +331,11 @@ if (KICAD_SCRIPTING_MODULES)
${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
rt
${PCBNEW_EXTRA_LIBS}
)
endif (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)
###
# Windows resource file
###
@ -438,17 +438,15 @@ else()
set(FINAL_EXE,pcbnew)
endif(WIN32)
if(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)
@ -458,16 +456,14 @@ if (KICAD_SCRIPTING_MODULES)
COMMENT "Fixing swig_import_helper in Kicad scripting modules"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST})
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py
DESTINATION ${PYTHON_DEST})
if (WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd
DESTINATION ${PYTHON_DEST})
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST})
else(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so
DESTINATION ${PYTHON_DEST})
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})