Fix compil issues under mingw

This commit is contained in:
jean-pierre charras 2012-07-16 11:19:23 +02:00
parent 829e952e49
commit a3ea46d0e4
3 changed files with 60 additions and 44 deletions

View File

@ -55,8 +55,8 @@ option(KICAD_SCRIPTING
option(KICAD_SCRIPTING_MODULES
"set this option ON to build kicad modules that can be used from scripting languages"
)
#Set version option (stable or testing)
@ -91,14 +91,25 @@ endif(KICAD_STABLE_VERSION )
#================================================
if(CMAKE_COMPILER_IS_GNUCXX)
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
if(WIN32) # under Windows/mingw, -fPIC option is enabled by default
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG")
else(WIN32)
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
set(CMAKE_C_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g3 -ggdb3 -DDEBUG -fPIC")
endif(WIN32)
endif(CMAKE_COMPILER_IS_GNUCXX)

View File

@ -5,10 +5,10 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
SET(PYTHON_DEST "lib/python${PYTHON_VERSION}/dist-packages" )
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/scripting)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INCLUDE(${SWIG_USE_FILE})
FIND_PACKAGE(PythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
add_definitions(-DPCBNEW -DKICAD_SCRIPTING)
add_definitions(-DPCBNEW -DKICAD_SCRIPTING)
endif()
###
@ -246,7 +246,7 @@ set(PCBNEW_SCRIPTING_DIALOGS
)
set(PCBNEW_SCRIPTING_PYTHON_HELPERS
set(PCBNEW_SCRIPTING_PYTHON_HELPERS
../scripting/wx_python_helpers.cpp
../scripting/python_scripting.cpp
scripting/pcbnew_scripting_helpers.cpp
@ -268,16 +268,16 @@ endif()
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)
if (DEBUG)
set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG)
endif()
# collect CFLAGS , and pass them to swig later
# 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} )
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)
@ -287,11 +287,11 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
endif()
endif()
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
@ -304,13 +304,13 @@ if (KICAD_SCRIPTING)
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 ${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(KICAD_SCRIPTING)
@ -323,7 +323,7 @@ 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
SWIG_LINK_LIBRARIES(pcbnew
3d-viewer
pcbcommon
common
@ -334,9 +334,14 @@ if (KICAD_SCRIPTING_MODULES)
${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES})
endif (KICAD_SCRIPTING_MODULES)
if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
set ( PCBNEW_EXTRA_LIBS "rt" )
endif (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
###
# Windows resource file
###
@ -410,6 +415,7 @@ endif(APPLE)
###
# Link executable target pcbnew with correct libraries
###
target_link_libraries(pcbnew
3d-viewer
pcbcommon
@ -421,7 +427,7 @@ target_link_libraries(pcbnew
${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
rt
${PCBNEW_EXTRA_LIBS}
)
###
@ -435,9 +441,9 @@ 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}/pcbnew
COMMENT "Fixing swig_import_helper"
)
COMMENT "Fixing swig_import_helper"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py
DESTINATION ${PYTHON_DEST})
@ -447,13 +453,13 @@ if (KICAD_SCRIPTING_MODULES)
add_custom_target(FixSwigImportsModuleScripting ALL
${CMAKE_CURRENT_SOURCE_DIR}/../scripting/fixswigimports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew
COMMENT "Fixing swig_import_helper"
)
COMMENT "Fixing swig_import_helper"
)
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py
DESTINATION ${PYTHON_DEST})
install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so
DESTINATION ${PYTHON_DEST})
endif(KICAD_SCRIPTING_MODULES)
@ -463,12 +469,11 @@ endif(KICAD_SCRIPTING_MODULES)
if(NOT MSVC)
# This one gets made only when testing.
add_executable(specctra_test EXCLUDE_FROM_ALL specctra_test.cpp specctra.cpp)
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES} rt)
target_link_libraries(specctra_test common ${wxWidgets_LIBRARIES})
endif(NOT MSVC)
# This one gets made only when testing.
add_executable(layer_widget_test WIN32 EXCLUDE_FROM_ALL
layer_widget.cpp
)
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES} rt)
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES})

View File

@ -2,7 +2,7 @@
* @file dialog_scripting.cpp
*/
#include <wx-2.8/wx/generic/grid.h>
#include <wx/grid.h>
@ -20,20 +20,20 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
{
SetFocus();
int n_wizards = FOOTPRINT_WIZARDS::GetSize();
// Current wizard selection, empty or first
m_FootprintWizard = NULL;
if (n_wizards)
m_FootprintWizard = FOOTPRINT_WIZARDS::GetWizard(0);
// Choose selection mode and insert the needed rows
m_footprintWizardsGrid->SetColSize( 0, 0 ); // hide the preview for now
m_footprintWizardsGrid->SetSelectionMode(wxGrid::wxGridSelectRows);
m_footprintWizardsGrid->InsertRows(0,n_wizards,true);
// Put all wizards in the list
for (int i=0;i<n_wizards;i++)
{
@ -41,12 +41,12 @@ DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST( wxWindow* aParent )
wxString name = wizard->GetName();
wxString description = wizard->GetDescription();
wxString image = wizard->GetImage();
m_footprintWizardsGrid->SetCellValue(i,1,name);
m_footprintWizardsGrid->SetCellValue(i,2,description);
}
// Select the first row
m_footprintWizardsGrid->ClearSelection();
m_footprintWizardsGrid->SelectRow(0,false);