Commit d11d9250 authored by Dick Hollenbeck's avatar Dick Hollenbeck

tugs and bugs

parent aa451fb4
...@@ -14,6 +14,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules ) ...@@ -14,6 +14,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
# reports. # reports.
# #
option( USE_KIWAY_DLLS
"Build the major modules as DLLs or DSOs, will soon be the norm." OFF )
#for those who bored with uppercase #for those who bored with uppercase
option( KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected" ) option( KICAD_KEEPCASE "turn-off automatic component name conversion to uppercase if selected" )
...@@ -146,22 +149,26 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ...@@ -146,22 +149,26 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif() endif()
else() else()
# We build DLL/DSOs from static libraries, so create position independent code # We build DLL/DSOs from static libraries, so create position independent
# for all cases, since we do not have DLL/DSO specific static libraries. # code for all cases, since we do not have DLL/DSO specific static
# Subdirectories via add_subdirectores() reference this variable, and it is either set or empty, # libraries. Subdirectories via add_subdirectores() reference this
# empty for Windows. # variable, and it is either set or empty, empty for Windows.
set( PIC_FLAG -fPIC ) set( PIC_FLAG -fPIC )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( TO_LINKER -XLinker )
else()
set( TO_LINKER -Wl )
endif()
# Thou shalt not link vaporware and tell us it's a valid DSO: # Thou shalt not link vaporware and tell us it's a valid DSO:
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) # needed by SWIG macros on linux set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
# Set default flags for Release build.
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
endif() endif()
# quiet GCC 4.8.1 while in boost # quiet GCC 4.8.1 while in boost
......
...@@ -170,6 +170,7 @@ endif() ...@@ -170,6 +170,7 @@ endif()
ExternalProject_Add( boost ExternalProject_Add( boost
PREFIX "${PREFIX}" PREFIX "${PREFIX}"
TIMEOUT 60
DOWNLOAD_DIR "${DOWNLOAD_DIR}" DOWNLOAD_DIR "${DOWNLOAD_DIR}"
INSTALL_DIR "${BOOST_ROOT}" INSTALL_DIR "${BOOST_ROOT}"
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2 URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
......
...@@ -205,6 +205,16 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a ...@@ -205,6 +205,16 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
#if USE_WORKER_THREADS #if USE_WORKER_THREADS
// Even though the PLUGIN API implementation is the place for the
// locale toggling, in order to keep LOCAL_IO::C_count at 1 or greater
// for the duration of all helper threads, we increment by one here via instantiation.
// Only done here because of the multi-threaded nature of this code.
// Without this C_count skips in and out of "equal to zero" and causes
// needless locale toggling among the threads, based on which of them
// are in a PLUGIN::FootprintLoad() function. And that is occasionally
// none of them.
LOCALE_IO top_most_nesting;
// Something which will not invoke a thread copy constructor, one of many ways obviously: // Something which will not invoke a thread copy constructor, one of many ways obviously:
typedef boost::ptr_vector< boost::thread > MYTHREADS; typedef boost::ptr_vector< boost::thread > MYTHREADS;
......
...@@ -433,18 +433,30 @@ class LOCALE_IO ...@@ -433,18 +433,30 @@ class LOCALE_IO
public: public:
LOCALE_IO() LOCALE_IO()
{ {
if( C_count++ == 0 ) wxASSERT_MSG( C_count >= 0, wxT( "LOCALE_IO::C_count mismanaged." ) );
// use thread safe, atomic operation
if( __sync_fetch_and_add( &C_count, 1 ) == 0 )
{
// printf( "setting C locale.\n" );
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
}
} }
~LOCALE_IO() ~LOCALE_IO()
{ {
if( --C_count == 0 ) // use thread safe, atomic operation
if( __sync_sub_and_fetch( &C_count, 1 ) == 0 )
{
// printf( "restoring default locale.\n" );
SetLocaleTo_Default(); SetLocaleTo_Default();
}
wxASSERT_MSG( C_count >= 0, wxT( "LOCALE_IO::C_count mismanaged." ) );
} }
private: private:
static int C_count; // allow for nesting of LOCALE_IO instantiations static int C_count; // allow for nesting of LOCALE_IO instantiations
}; };
......
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