Import Geant4 10.1.0 source tree
This commit is contained in:
+44
-1
@@ -1,4 +1,4 @@
|
||||
svn log $Id: History 77473 2013-11-25 09:32:54Z gcosmo $
|
||||
svn log $Id: History 85534 2014-10-30 16:19:42Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -16,6 +16,49 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
29th October 2014 Gabriele Cosmo (config-V10-00-11/10)
|
||||
- Moved geometry/solids/usolids module to externals.
|
||||
Adapted scripts for optional external USolids library build.
|
||||
- Withdrawn changes made to Darwin-clang.gmk in previous tag.
|
||||
|
||||
11th October 2014 Michael Kelsey (config-V10-00-09)
|
||||
- Darwin-clang.gmk: added references to core G4 library list for linking
|
||||
shared libraries, needed for applications with G4EXLIB.
|
||||
|
||||
17th September 2014 Gabriele Cosmo (config-V10-00-08)
|
||||
- Added flags in geomconf.gmk for added USolids shapes UExtrudedSolid,
|
||||
UGenericTrap and UTrap.
|
||||
|
||||
25th July 2014 Gabriele Cosmo (config-V10-00-07)
|
||||
- Added flag for C++11 also to CPPFLAGS in Linus-g++.gmk when G4USE_STD11
|
||||
is set.
|
||||
|
||||
1st July 2014 Gabriele Cosmo (config-V10-00-06)
|
||||
- Added 'particle_hp' module to binmake.gmk.
|
||||
|
||||
8th April 2014 Gabriele Cosmo (config-V10-00-05)
|
||||
- Added G4USE_STD11 flag for C++11 Standard.
|
||||
|
||||
4th April 2014 Gabriele Cosmo (config-V10-00-04)
|
||||
- Force loading of symbols for templated libraries in physics_lists modules
|
||||
only for global libraries. Granular libraries not supporting physics_lists
|
||||
factories.
|
||||
|
||||
27th March 2014 Gabriele Cosmo (config-V10-00-03)
|
||||
- Replaced old win32def tool for extracting symbols definitions for
|
||||
DLLs build on Windows with genwindef used also in CMake.
|
||||
|
||||
24th March 2014 Gabriele Cosmo (config-V10-00-02)
|
||||
- Force loading of symbols for templated libraries in physics_lists modules.
|
||||
Defined LDFLAGS for Linux and Darwin targets.
|
||||
Modified binmake.gmk accordingly.
|
||||
|
||||
17th January 2014 Gabriele Cosmo (config-V10-00-01)
|
||||
- Fixed setting of -fPIC also for Darwin targets.
|
||||
|
||||
13th January 2014 Gabriele Cosmo (config-V10-00-00)
|
||||
- Fixed setting of -fPIC in MT-mode for Linux-g++ and Linux-icc.
|
||||
|
||||
25th November 2013 Gabriele Cosmo (config-V09-06-17)
|
||||
- Corrected settings for Linux-g++ and Linux-icc in the use of -fPIC in
|
||||
multi-threaded mode.
|
||||
|
||||
+52
-7
@@ -1,4 +1,4 @@
|
||||
# $Id: architecture.gmk 76241 2013-11-08 11:07:59Z gcosmo $
|
||||
# $Id: architecture.gmk 85534 2014-10-30 16:19:42Z gcosmo $
|
||||
# ------------------------------------------------------------------------
|
||||
# GEANT 4 - Architecture configuration script for GNU Make
|
||||
#
|
||||
@@ -127,6 +127,13 @@ ifndef G4BIN
|
||||
endif
|
||||
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4BIN) ] && mkdir -p $(G4BIN) )
|
||||
|
||||
# If specified, use C++11 standard constructs and compilation options ...
|
||||
#
|
||||
ifdef G4USE_STD11
|
||||
CPPFLAGS += -DG4USE_STD11
|
||||
G4USE_STD11 := 1
|
||||
endif
|
||||
|
||||
# If G4DEBUG or G4NO_OPTIMISE are not specified,
|
||||
# the default compilation is optimised ...
|
||||
#
|
||||
@@ -172,6 +179,29 @@ ifndef CLHEP_LIB_DIR
|
||||
CLHEP_LIB_DIR := $(CLHEP_BASE_DIR)/lib
|
||||
endif
|
||||
|
||||
# USolids path, etc.
|
||||
#
|
||||
ifndef USOLIDS_BASE_DIR
|
||||
USOLIDS_BASE_DIR := $(G4BASE)/externals/usolids
|
||||
G4LIB_BUILD_USOLIDS := 1
|
||||
G4LIB_USE_USOLIDS := 1
|
||||
endif
|
||||
ifndef G4LIB_USE_USOLIDS
|
||||
ifndef USOLIDS_LIB
|
||||
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
USOLIDS_LIB := usolids.lib
|
||||
else
|
||||
USOLIDS_LIB := usolids
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifndef USOLIDS_INCLUDE_DIR
|
||||
USOLIDS_INCLUDE_DIR := $(USOLIDS_BASE_DIR)/include
|
||||
endif
|
||||
ifndef USOLIDS_LIB_DIR
|
||||
USOLIDS_LIB_DIR := $(USOLIDS_BASE_DIR)/lib
|
||||
endif
|
||||
|
||||
# Paths for G4 data
|
||||
#
|
||||
ifndef G4DATA
|
||||
@@ -217,27 +247,42 @@ endif
|
||||
# Variables for implicit rules, etc., as suggested in GNU Make manual...
|
||||
#
|
||||
CPPFLAGS += -Iinclude
|
||||
CPPFLAGS += -I$(CLHEP_INCLUDE_DIR)
|
||||
CPPFLAGS += -I$(USOLIDS_INCLUDE_DIR) -I$(CLHEP_INCLUDE_DIR)
|
||||
|
||||
# Positional qualifiers in action...
|
||||
#
|
||||
ifndef LDFLAGS
|
||||
LDFLAGS :=
|
||||
#
|
||||
# run-time loading flags
|
||||
#
|
||||
G4STATIC_MODE :=
|
||||
G4NOSTATIC_MODE :=
|
||||
endif
|
||||
ifndef LOADLIBS
|
||||
LOADLIBS :=
|
||||
endif
|
||||
ifndef G4LIB_USE_CLHEP
|
||||
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
LDFLAGS += -link $(LIB_PATH)$(CLHEP_LIB_DIR)
|
||||
LOADLIBS := $(CLHEP_LIB)
|
||||
LOADLIBS += $(CLHEP_LIB)
|
||||
else
|
||||
LDFLAGS += -L$(CLHEP_LIB_DIR)
|
||||
LOADLIBS := -l$(CLHEP_LIB)
|
||||
LOADLIBS += -l$(CLHEP_LIB)
|
||||
endif
|
||||
else
|
||||
LOADLIBS :=
|
||||
endif
|
||||
ifndef G4LIB_USE_USOLIDS
|
||||
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
LDFLAGS += -link $(LIB_PATH)$(G4INSTALL)/lib
|
||||
LDFLAGS += -link $(LIB_PATH)$(USOLIDS_LIB_DIR)
|
||||
LOADLIBS += $(USOLIDS_LIB)
|
||||
else
|
||||
LDFLAGS += -L$(USOLIDS_LIB_DIR)
|
||||
LOADLIBS += -l$(USOLIDS_LIB)
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
LDFLAGS += -link $(LIB_PATH)$(G4INSTALL)/lib
|
||||
endif
|
||||
ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
ifndef G4LIB_USE_EXPAT
|
||||
LOADLIBS += -lexpat
|
||||
|
||||
+34
-4
@@ -1,4 +1,4 @@
|
||||
# $Id: binmake.gmk 76321 2013-11-08 14:09:58Z gcosmo $
|
||||
# $Id: binmake.gmk 85534 2014-10-30 16:19:42Z gcosmo $
|
||||
# ----------------------------------------------------------
|
||||
# Script defining rules and paths for making binaries.
|
||||
# First implementation: Gabriele Cosmo, 25/06/1998.
|
||||
@@ -131,6 +131,7 @@ ifndef INCFLAGS
|
||||
-I$(G4BASE)/processes/hadronic/models/lepto_nuclear/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/management/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/neutron_hp/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/particle_hp/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/parton_string/diffraction/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/parton_string/hadronization/include \
|
||||
-I$(G4BASE)/processes/hadronic/models/parton_string/management/include \
|
||||
@@ -149,7 +150,6 @@ ifndef INCFLAGS
|
||||
-I$(G4BASE)/geometry/solids/CSG/include \
|
||||
-I$(G4BASE)/geometry/solids/specific/include \
|
||||
-I$(G4BASE)/geometry/solids/Boolean/include \
|
||||
-I$(G4BASE)/geometry/solids/usolids/include \
|
||||
-I$(G4BASE)/geometry/divisions/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
@@ -250,6 +250,10 @@ ifdef GLOBALLIBS
|
||||
-lG4intercoms \
|
||||
-lG4global
|
||||
|
||||
ifdef G4LIB_USE_USOLIDS
|
||||
LDLIBS2 += -lG4geomUSolids
|
||||
endif
|
||||
|
||||
ifdef G4LIB_USE_CLHEP
|
||||
LDLIBS2 += -lG4clhep
|
||||
endif
|
||||
@@ -266,9 +270,17 @@ ifdef GLOBALLIBS
|
||||
LDLIBS2 += -lG4zlib
|
||||
endif
|
||||
|
||||
# Bring all symbols in for libraries which requires this (templated factories).
|
||||
#
|
||||
ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
ifndef SHAREDLIBS
|
||||
LDFLAGS += $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4physicslists.a $(G4NOSTATIC_MODE)
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
# The next lines specifically should read LDLIBS2 = , not LDLIBS2 :=, so
|
||||
# that it is not expanded until the directory G4TMPDIR is created.
|
||||
# The next lines specifically should read LDLIBS2 = , not LDLIBS2 :=, so
|
||||
# that it is not expanded until the directory G4TMPDIR is created.
|
||||
ifeq ($(G4INCLUDE_EXEC),1)
|
||||
LDLIBS2 = $(shell \
|
||||
G4TMP=$(G4TMP); export G4TMP; \
|
||||
@@ -290,6 +302,24 @@ else
|
||||
# Extra libraries to resolve remaining circular dependencies...
|
||||
# LDLIBS2EXTRA =
|
||||
endif
|
||||
# Bring all symbols in for libraries which requires this (templated factories).
|
||||
#
|
||||
# ifeq (,$(findstring WIN32-VC,$(G4SYSTEM)))
|
||||
# ifndef SHAREDLIBS
|
||||
# LDFLAGS += $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_lists.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_decay.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_em.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_glnuclear.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_helastic.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_hinelastic.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_ions.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_limiters.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_stopping.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_builders.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4phys_ctor_factory.a $(G4NOSTATIC_MODE) \
|
||||
# $(G4STATIC_MODE) $(G4LIB)/$(G4SYSTEM)/libG4physlist_util.a $(G4NOSTATIC_MODE)
|
||||
# endif
|
||||
# endif
|
||||
endif
|
||||
|
||||
# LDLIBS3 contains the first set of low level libraries...
|
||||
|
||||
@@ -0,0 +1,407 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//$Id: genconf.cpp,v 1.35 2008/10/15 21:51:24 marcocle Exp $ //
|
||||
|
||||
#ifdef _WIN32
|
||||
// Disable a warning in Boost program_options headers:
|
||||
// inconsistent linkage in program_options/variables_map.hpp
|
||||
#pragma warning ( disable : 4273 )
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#define fileno _fileno
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
// Include files----------------------------------------------------------------
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
// LibSymbolinfo----------------------------------------------------------------
|
||||
#if !defined(AFX_LIBSYMBOLINFO_H__1A7003B4_BA53_11D1_AE46_1CFB51000000__INCLUDED_)
|
||||
#define AFX_LIBSYMBOLINFO_H__1A7003B4_BA53_11D1_AE46_1CFB51000000__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
|
||||
class CLibSymbolInfo
|
||||
{
|
||||
public:
|
||||
CLibSymbolInfo();
|
||||
virtual ~CLibSymbolInfo();
|
||||
BOOL DumpSymbols(LPTSTR lpszLibPathName, std::ostream& pFile);
|
||||
std::string GetLastError() const;
|
||||
|
||||
protected:
|
||||
std::string m_strResultsString;
|
||||
std::string m_strErrorMsg;
|
||||
|
||||
BOOL Dump(LPTSTR lpszLibPathName, std::ostream& pFile);
|
||||
BOOL IsRegularLibSymbol( PSTR pszSymbolName );
|
||||
BOOL IsFiltedSymbol( std::string& pszSymbolName );
|
||||
DWORD ConvertBigEndian(DWORD bigEndian);
|
||||
};
|
||||
|
||||
enum errMMF { errMMF_NoError, errMMF_FileOpen,
|
||||
errMMF_FileMapping, errMMF_MapView };
|
||||
|
||||
class MEMORY_MAPPED_FILE
|
||||
{
|
||||
public:
|
||||
MEMORY_MAPPED_FILE( PSTR pszFileName );
|
||||
~MEMORY_MAPPED_FILE(void);
|
||||
|
||||
PVOID GetBase( void ){ return m_pMemoryMappedFileBase; }
|
||||
DWORD GetFileSize( void ){ return m_cbFile; }
|
||||
BOOL IsValid( void ) { return errMMF_NoError == m_errCode; }
|
||||
errMMF GetErrorType(){ return m_errCode; }
|
||||
|
||||
private:
|
||||
|
||||
HANDLE m_hFile;
|
||||
HANDLE m_hFileMapping; // Handle of memory mapped file
|
||||
PVOID m_pMemoryMappedFileBase;
|
||||
DWORD m_cbFile;
|
||||
errMMF m_errCode;
|
||||
};
|
||||
|
||||
typedef MEMORY_MAPPED_FILE* PMEMORY_MAPPED_FILE;
|
||||
|
||||
#endif // !defined(AFX_LIBSYMBOLINFO_H__1A7003B4_BA53_11D1_AE46_1CFB51000000__INCLUDED_)
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLibSymbolInfo
|
||||
|
||||
CLibSymbolInfo::CLibSymbolInfo()
|
||||
{
|
||||
}
|
||||
|
||||
CLibSymbolInfo::~CLibSymbolInfo()
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Function: DumpSymbols
|
||||
//
|
||||
// Parameters:
|
||||
// LPTSTR lpszLibPathName - The library file path name
|
||||
// CStdioFile* pFile - Address of the file in which to dump the symbols
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// Given a library file path name, the function dumps the symbol info into the file
|
||||
// pointed to by pFile.
|
||||
//=============================================================================
|
||||
BOOL CLibSymbolInfo::DumpSymbols(LPTSTR lpszLibPathName, ostream& pFile)
|
||||
{
|
||||
if(lpszLibPathName == NULL || pFile.bad() ) {
|
||||
assert(lpszLibPathName != NULL);
|
||||
assert(pFile.good());
|
||||
m_strErrorMsg.assign("NULL <lpszLibPathName> or Invalid file handle.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Dump(lpszLibPathName, pFile)) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Function: Dump
|
||||
//
|
||||
// Parameters:
|
||||
// As mentioned above.
|
||||
//
|
||||
// Description:
|
||||
//
|
||||
// Depending on the value specified in <m_bDump>/<m_bGrep> the routine dumps/greps
|
||||
// the symbo info.
|
||||
//=============================================================================
|
||||
BOOL CLibSymbolInfo::Dump(LPTSTR lpszLibPathName, ostream& pFile)
|
||||
{
|
||||
string sBuff;
|
||||
MEMORY_MAPPED_FILE libFile(lpszLibPathName);
|
||||
|
||||
// Ensure that the file mapping worked
|
||||
if( FALSE == libFile.IsValid() ) {
|
||||
m_strErrorMsg = "Unable to access file ";
|
||||
m_strErrorMsg+= lpszLibPathName;
|
||||
return FALSE;
|
||||
}
|
||||
// All COFF libraries start with the string "!<arch>\n". Verify that this
|
||||
// string is at the beginning of the mapped file
|
||||
|
||||
PSTR pArchiveStartString = (PSTR)libFile.GetBase();
|
||||
|
||||
if ( 0 != strncmp( pArchiveStartString, IMAGE_ARCHIVE_START,
|
||||
IMAGE_ARCHIVE_START_SIZE ) ) {
|
||||
m_strErrorMsg.assign("Not a valid COFF LIB file.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Point to the first archive member. This entry contains the LIB symbols,
|
||||
// and immediately follows the archive start string ("!<arch>\n")
|
||||
PIMAGE_ARCHIVE_MEMBER_HEADER pMbrHdr;
|
||||
pMbrHdr = MakePtr( PIMAGE_ARCHIVE_MEMBER_HEADER, pArchiveStartString,
|
||||
IMAGE_ARCHIVE_START_SIZE );
|
||||
|
||||
// First DWORD after this member header is a symbol count
|
||||
PDWORD pcbSymbols = (PDWORD)(pMbrHdr + 1); // Pointer math!
|
||||
|
||||
// The symbol count is stored in big endian format, so adjust as
|
||||
// appropriate for the target architecture
|
||||
DWORD cSymbols = ConvertBigEndian( *pcbSymbols );
|
||||
|
||||
// Following the symbol count is an array of offsets to archive members
|
||||
// (essentially, embedded .OBJ files)
|
||||
PDWORD pMemberOffsets = pcbSymbols + 1; // Pointer math!
|
||||
|
||||
// Following the array of member offsets is an array of offsets to symbol
|
||||
// names.
|
||||
PSTR pszSymbolName = MakePtr( PSTR, pMemberOffsets, 4 * cSymbols );
|
||||
|
||||
//
|
||||
// Loop through every symbol in the first archive member
|
||||
//
|
||||
for ( unsigned i = 0; i < cSymbols; i++ )
|
||||
{
|
||||
DWORD offset;
|
||||
|
||||
// The offsets to the archive member that contains the symbol is stored
|
||||
// in big endian format, so convert it appropriately.
|
||||
offset = ConvertBigEndian( *pMemberOffsets );
|
||||
|
||||
// Call DisplayLibInfoForSymbol, which figures out what kind of symbol
|
||||
// it is. The "IsRegularLibSymbol" filters out symbols that are
|
||||
// internal to the linking process
|
||||
if ( IsRegularLibSymbol( pszSymbolName ) ) {
|
||||
string symbol(pszSymbolName);
|
||||
if (IsFiltedSymbol(symbol) ) {
|
||||
pFile << symbol << endl;
|
||||
}
|
||||
}
|
||||
// Advanced to the next symbol offset and name. The MemberOffsets
|
||||
// array has fixed length entries, while the symbol names are
|
||||
// sequential null-terminated strings
|
||||
pMemberOffsets++;
|
||||
pszSymbolName += strlen(pszSymbolName) + 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Filters out symbols that are internal to the linking process, and which
|
||||
// the programmer never explicitly sees.
|
||||
//=============================================================================
|
||||
BOOL CLibSymbolInfo::IsRegularLibSymbol( PSTR pszSymbolName )
|
||||
{
|
||||
if ( 0 == strncmp( pszSymbolName, "__IMPORT_DESCRIPTOR_", 20 ) )
|
||||
return FALSE;
|
||||
|
||||
if ( 0 == strncmp( pszSymbolName, "__NULL_IMPORT_DESCRIPTOR", 24 ) )
|
||||
return FALSE;
|
||||
|
||||
if ( strstr( pszSymbolName, "_NULL_THUNK_DATA" ) )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
//=============================================================================
|
||||
// Filters out symbols that are not needed....
|
||||
//=============================================================================
|
||||
BOOL CLibSymbolInfo::IsFiltedSymbol( string& symbolName )
|
||||
{
|
||||
// Filter problematic symbols for Win64
|
||||
if ( symbolName.substr(0,3) == "_CT" ) return FALSE;
|
||||
if ( symbolName.substr(0,3) == "_TI" ) return FALSE;
|
||||
// Filter other symbols
|
||||
if ( symbolName.substr(0,2) == "__" )
|
||||
return FALSE;
|
||||
if ( symbolName.substr(0,3) == "??_" && symbolName[3] != '0') // Keep 'operator/=' [??_0]
|
||||
return FALSE;
|
||||
if( symbolName[0] == '_') {
|
||||
symbolName.erase(0, 1); // C functions ...
|
||||
}
|
||||
// Filter the internal Boost symbols
|
||||
if (symbolName.find ("detail@boost") != string::npos )
|
||||
return FALSE;
|
||||
if (symbolName.find ("details@boost") != string::npos )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Converts from big endian to little endian numbers.
|
||||
//=============================================================================
|
||||
DWORD CLibSymbolInfo::ConvertBigEndian(DWORD bigEndian)
|
||||
{
|
||||
DWORD temp = 0;
|
||||
|
||||
temp |= bigEndian >> 24;
|
||||
temp |= ((bigEndian & 0x00FF0000) >> 8);
|
||||
temp |= ((bigEndian & 0x0000FF00) << 8);
|
||||
temp |= ((bigEndian & 0x000000FF) << 24);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
string CLibSymbolInfo::GetLastError() const
|
||||
{
|
||||
return m_strErrorMsg;
|
||||
}
|
||||
|
||||
|
||||
MEMORY_MAPPED_FILE::MEMORY_MAPPED_FILE( PSTR pszFileName ) {
|
||||
|
||||
//
|
||||
// Given a filename, the constructor opens a file handle, creates a file
|
||||
// mapping, and maps the entire file into memory.
|
||||
//
|
||||
m_hFile = INVALID_HANDLE_VALUE;
|
||||
m_hFileMapping = 0;
|
||||
m_pMemoryMappedFileBase = 0;
|
||||
m_cbFile = 0;
|
||||
m_errCode = errMMF_FileOpen; // Initial error code: not found
|
||||
// First get a file handle
|
||||
m_hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)0);
|
||||
|
||||
if ( m_hFile == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
m_errCode = errMMF_FileOpen;
|
||||
return;
|
||||
}
|
||||
m_cbFile = ::GetFileSize( m_hFile, 0 );
|
||||
// Now, create a file mapping
|
||||
m_hFileMapping = CreateFileMapping(m_hFile,NULL, PAGE_READONLY, 0, 0,NULL);
|
||||
if ( m_hFileMapping == 0 )
|
||||
{
|
||||
// Oops. Something went wrong. Clean up.
|
||||
CloseHandle(m_hFile);
|
||||
m_hFile = INVALID_HANDLE_VALUE;
|
||||
m_errCode = errMMF_FileMapping;
|
||||
return;
|
||||
}
|
||||
m_pMemoryMappedFileBase = (PCHAR)MapViewOfFile( m_hFileMapping,
|
||||
FILE_MAP_READ, 0, 0, 0);
|
||||
if ( m_pMemoryMappedFileBase == 0 )
|
||||
{
|
||||
// Oops. Something went wrong. Clean up.
|
||||
CloseHandle(m_hFileMapping);
|
||||
m_hFileMapping = 0;
|
||||
CloseHandle(m_hFile);
|
||||
m_hFile = INVALID_HANDLE_VALUE;
|
||||
m_errCode = errMMF_MapView;
|
||||
return;
|
||||
}
|
||||
m_errCode = errMMF_NoError;
|
||||
}
|
||||
|
||||
MEMORY_MAPPED_FILE::~MEMORY_MAPPED_FILE(void)
|
||||
{
|
||||
// Clean up everything that was created by the constructor
|
||||
if ( m_pMemoryMappedFileBase )
|
||||
UnmapViewOfFile( m_pMemoryMappedFileBase );
|
||||
|
||||
if ( m_hFileMapping )
|
||||
CloseHandle( m_hFileMapping );
|
||||
|
||||
if ( m_hFile != INVALID_HANDLE_VALUE )
|
||||
CloseHandle( m_hFile );
|
||||
|
||||
m_errCode = errMMF_FileOpen;
|
||||
}
|
||||
|
||||
namespace windef {
|
||||
void usage(){
|
||||
cerr << "Usage: genwindef [-l <dllname>] [-o <output-file> | exports.def] <obj or lib filenames>" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--- Command main program-----------------------------------------------------
|
||||
int main ( int argc, char** argv )
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
string outfile("exports.def");
|
||||
string library("UnknownLib");
|
||||
string objfiles;
|
||||
bool debug(false);
|
||||
|
||||
int arg;
|
||||
if (argc < 3) windef::usage();
|
||||
arg = 1;
|
||||
while (argv[arg][0] == '-') {
|
||||
if (strcmp(argv[arg], "--") == 0) {
|
||||
windef::usage();
|
||||
}
|
||||
else if (strcmp(argv[arg], "-l") == 0) {
|
||||
arg++;
|
||||
if (arg == argc) windef::usage();
|
||||
library = argv[arg];
|
||||
}
|
||||
else if (strcmp(argv[arg], "-o") == 0) {
|
||||
arg++;
|
||||
if (arg == argc) windef::usage();
|
||||
outfile = argv[arg];
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
if (arg == argc) windef::usage();
|
||||
for (arg; arg < argc; arg++) {
|
||||
objfiles += argv[arg];
|
||||
if( arg+1 < argc) objfiles += " ";
|
||||
}
|
||||
|
||||
CLibSymbolInfo libsymbols;
|
||||
ofstream out(outfile.c_str());
|
||||
if(out.fail()) {
|
||||
cerr << "windef: Error opening file " << outfile << endl;
|
||||
return 1;
|
||||
}
|
||||
out << "LIBRARY " << library << endl;
|
||||
out << "EXPORTS" << endl;
|
||||
|
||||
libsymbols.DumpSymbols(const_cast<char*>(objfiles.c_str()), out);
|
||||
|
||||
out.close();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
+20
-13
@@ -15,29 +15,36 @@ endif
|
||||
ifdef G4GEOM_USE_UCONS
|
||||
CPPFLAGS += -DG4GEOM_USE_UCONS
|
||||
endif
|
||||
ifdef G4GEOM_USE_UORB
|
||||
CPPFLAGS += -DG4GEOM_USE_UORB
|
||||
endif
|
||||
ifdef G4GEOM_USE_USPHERE
|
||||
CPPFLAGS += -DG4GEOM_USE_USPHERE
|
||||
endif
|
||||
ifdef G4GEOM_USE_UTRD
|
||||
CPPFLAGS += -DG4GEOM_USE_UTRD
|
||||
endif
|
||||
ifdef G4GEOM_USE_UTUBS
|
||||
CPPFLAGS += -DG4GEOM_USE_UTUBS
|
||||
ifdef G4GEOM_USE_UEXTRUDEDSOLID
|
||||
CPPFLAGS += -DG4GEOM_USE_UEXTRUDEDSOLID
|
||||
endif
|
||||
ifdef G4GEOM_USE_UGENERICPOLYCONE
|
||||
CPPFLAGS += -DG4GEOM_USE_UGENERICPOLYCONE
|
||||
endif
|
||||
ifdef G4GEOM_USE_UGENERICTRAP
|
||||
CPPFLAGS += -DG4GEOM_USE_UGENERICTRAP
|
||||
endif
|
||||
ifdef G4GEOM_USE_UORB
|
||||
CPPFLAGS += -DG4GEOM_USE_UORB
|
||||
endif
|
||||
ifdef G4GEOM_USE_UPOLYCONE
|
||||
CPPFLAGS += -DG4GEOM_USE_UPOLYCONE
|
||||
endif
|
||||
ifdef G4GEOM_USE_UPOLYHEDRA
|
||||
CPPFLAGS += -DG4GEOM_USE_UPOLYHEDRA
|
||||
endif
|
||||
ifdef G4GEOM_USE_USPHERE
|
||||
CPPFLAGS += -DG4GEOM_USE_USPHERE
|
||||
endif
|
||||
ifdef G4GEOM_USE_UTET
|
||||
CPPFLAGS += -DG4GEOM_USE_UTET
|
||||
endif
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/usolids/include
|
||||
ifdef G4GEOM_USE_UTRAP
|
||||
CPPFLAGS += -DG4GEOM_USE_UTRAP
|
||||
endif
|
||||
ifdef G4GEOM_USE_UTRD
|
||||
CPPFLAGS += -DG4GEOM_USE_UTRD
|
||||
endif
|
||||
ifdef G4GEOM_USE_UTUBS
|
||||
CPPFLAGS += -DG4GEOM_USE_UTUBS
|
||||
endif
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
# Original author: Gabriele Cosmo - CERN
|
||||
#
|
||||
ifeq ($(G4SYSTEM),Darwin-clang)
|
||||
CXX := clang
|
||||
CXX := clang++
|
||||
CXXFLAGS := -Wall -Wno-non-virtual-dtor -Wno-long-long
|
||||
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
|
||||
CXXFLAGS += -Wno-variadic-macros -Wshadow
|
||||
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual
|
||||
CXXFLAGS += -Wno-variadic-macros -Wshadow -pipe
|
||||
ifdef G4USE_STD11
|
||||
CXXFLAGS += -std=c++11
|
||||
endif
|
||||
ifdef G4MULTITHREADED
|
||||
CXXFLAGS += -ftls-model=initial-exec -pthread
|
||||
endif
|
||||
@@ -33,6 +36,13 @@ ifeq ($(G4SYSTEM),Darwin-clang)
|
||||
FCFLAGS += -O2 -g
|
||||
CCFLAGS += -O2 -g
|
||||
endif
|
||||
ifdef G4LIB_BUILD_SHARED
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
endif
|
||||
G4RUNPATHOPTION := -Wl,-rpath
|
||||
G4STATIC_MODE += -Wl,-force_load
|
||||
FC := gfortran
|
||||
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
|
||||
LDFLAGS += -bind_at_load
|
||||
@@ -151,13 +161,13 @@ ifeq ($(G4SYSTEM),Darwin-clang)
|
||||
define build-granular-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`; \
|
||||
cd $(G4TMPDIR); \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
-o $$libdir/$(@F) $(INTYLIBS) *.o
|
||||
endef
|
||||
define build-global-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`; \
|
||||
cd $(G4TMP)/$(G4SYSTEM); \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
-o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
|
||||
endef
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@ ifeq ($(G4SYSTEM),Darwin-g++)
|
||||
CXX := g++
|
||||
CXXFLAGS := -Wall -Wno-non-virtual-dtor -Wno-long-long
|
||||
# CXXFLAGS += -Wunused-parameter -Winline -Wunreachable-code
|
||||
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
|
||||
CXXFLAGS += -Wno-variadic-macros -Wshadow
|
||||
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual
|
||||
CXXFLAGS += -Wno-variadic-macros -Wshadow -pipe
|
||||
ifdef G4USE_STD11
|
||||
CXXFLAGS += -std=c++11
|
||||
endif
|
||||
# CXXFLAGS += -stdlib=libstdc++
|
||||
ifdef G4OPTIMISE
|
||||
CXXFLAGS += -O2
|
||||
@@ -35,6 +38,13 @@ ifeq ($(G4SYSTEM),Darwin-g++)
|
||||
FCFLAGS += -O2 -g
|
||||
CCFLAGS += -O2 -g
|
||||
endif
|
||||
ifdef G4LIB_BUILD_SHARED
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
endif
|
||||
G4RUNPATHOPTION := -Wl,-rpath
|
||||
G4STATIC_MODE += -Wl,-force_load
|
||||
FC := gfortran
|
||||
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
|
||||
LDFLAGS += -bind_at_load
|
||||
@@ -162,13 +172,13 @@ ifeq ($(G4SYSTEM),Darwin-g++)
|
||||
define build-granular-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`; \
|
||||
cd $(G4TMPDIR); \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
-o $$libdir/$(@F) $(INTYLIBS) *.o
|
||||
endef
|
||||
define build-global-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`; \
|
||||
cd $(G4TMP)/$(G4SYSTEM); \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
$(CXX) -dynamiclib -single_module -undefined dynamic_lookup \
|
||||
-o $$libdir/$(@F) $(INTYLIBS) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
|
||||
endef
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ ifeq ($(G4SYSTEM),Linux-g++)
|
||||
CXXFLAGS := -W -Wall -ansi -pedantic -Wno-non-virtual-dtor -Wno-long-long
|
||||
CXXFLAGS += -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -pipe
|
||||
CXXFLAGS += -Wshadow
|
||||
ifdef G4USE_STD11
|
||||
CPPFLAGS += -std=c++11
|
||||
CXXFLAGS += -std=c++11
|
||||
endif
|
||||
#
|
||||
# Uncomment the following options to activate Pentium4 chip specific
|
||||
# floating-point operations on the SSE unit. It will allow for more stable
|
||||
@@ -40,13 +44,13 @@ ifeq ($(G4SYSTEM),Linux-g++)
|
||||
CCFLAGS += -O2 -g
|
||||
endif
|
||||
ifdef G4LIB_BUILD_SHARED
|
||||
ifndef G4MULTITHREADED
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
endif
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
endif
|
||||
G4RUNPATHOPTION := -Wl,-rpath
|
||||
G4STATIC_MODE += -Wl,--whole-archive
|
||||
G4NOSTATIC_MODE += -Wl,--no-whole-archive
|
||||
CC := gcc
|
||||
FC := gfortran
|
||||
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
ifeq ($(G4SYSTEM),Linux-icc)
|
||||
CXX := icc
|
||||
CXXFLAGS := -ansi -fp-model precise -no-gcc -w1
|
||||
ifdef G4USE_STD11
|
||||
CXXFLAGS += -std=c++11
|
||||
endif
|
||||
ifdef G4MULTITHREADED
|
||||
CXXFLAGS += -ftls-model=initial-exec -pthread
|
||||
endif
|
||||
@@ -24,14 +27,14 @@ ifeq ($(G4SYSTEM),Linux-icc)
|
||||
CCFLAGS += -pg
|
||||
endif
|
||||
ifdef G4LIB_BUILD_SHARED
|
||||
ifndef G4MULTITHREADED
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
endif
|
||||
CXXFLAGS += -fPIC
|
||||
FCFLAGS += -fPIC
|
||||
CCFLAGS += -fPIC
|
||||
LDFLAGS += -i-dynamic
|
||||
endif
|
||||
G4RUNPATHOPTION := -Wl,-rpath -Wl,
|
||||
G4STATIC_MODE += -Wl,--whole-archive
|
||||
G4NOSTATIC_MODE += -Wl,--no-whole-archive
|
||||
CC := icc
|
||||
FC := ifort
|
||||
FCFLAGS += -noautomatic -assume nobscc -assume no2underscores
|
||||
|
||||
+13
-17
@@ -55,21 +55,20 @@ ifeq ($(G4SYSTEM),WIN32-VC)
|
||||
endif
|
||||
|
||||
#
|
||||
# Building DLLs (G.Barrand)
|
||||
# Building DLLs
|
||||
# -------------
|
||||
# The commands below allow to build DLLs from the archive libraries.
|
||||
# From a libG4xxx.a, it will extract the symbols with :
|
||||
# DOS> dumpbin /symbols libG4xxx.a > G4xxx.dumpbin
|
||||
# After that it will produce a G4xxx.def using the 'win32def' program.
|
||||
# From a libG4xxx.a, will extract the symbols with the genwindef tool,
|
||||
# which will produce a G4xxx.def file.
|
||||
# The G4xxx.def file will contain the list of symbols that are "exported"
|
||||
# or made public for using the DLLs.
|
||||
# The source win32def.c is in the geant4/config directory. The binary is
|
||||
# The source genwindef.cc is in the geant4/config directory. The binary is
|
||||
# built during the library installation process, and will be placed in
|
||||
# $G4LIB/G4SYSTEM.
|
||||
# If can also be built as follows :
|
||||
# DOS> cl.exe /Fowin32def.exe win32def.c
|
||||
# DOS> cl.exe /Fegenwindef.exe genwindef.cc
|
||||
# Then, to use it :
|
||||
# DOS> win32def G4xxx < G4xxx.dumpbin > G4xxx.def
|
||||
# DOS> genwindef -o G4xxx.def -l G4xxx libG4xxx.a
|
||||
# Libraries libG4xxx.lib can also be built with :
|
||||
# DOS> lib /def:G4xxx.def /out:libG4xxx.lib
|
||||
# It also produces a libG4xxx.exp used to build the DLL.
|
||||
@@ -78,19 +77,18 @@ ifeq ($(G4SYSTEM),WIN32-VC)
|
||||
# Note that a DLL must be fully linked. You should NOT have undefined
|
||||
# symbols as output of the link command.
|
||||
#
|
||||
ifdef G4LIB_USE_USOLIDS
|
||||
GLOBLIBS += libG4geomUSolids.lib
|
||||
endif
|
||||
ifdef G4LIB_USE_CLHEP
|
||||
GLOBLIBS += libG4clhep.lib
|
||||
endif
|
||||
define build-granular-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`;\
|
||||
cd $(G4TMP)/$(G4SYSTEM);\
|
||||
$(ECHO) "Building $(name).dumpbin file ...";\
|
||||
$(RM) $(name).dumpbin;\
|
||||
dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
|
||||
$(ECHO) "Building $(name).def file ...";\
|
||||
$(RM) $(name).def;\
|
||||
$(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
|
||||
$(RM) $(name).dumpbin;\
|
||||
$(G4LIB)/$(G4SYSTEM)/genwindef.exe -o $(name).def -l $(name) $(G4LIBDIR)/lib$(name).a;\
|
||||
$(ECHO) "Building lib$(name).exp and lib$(name).lib file ...";\
|
||||
$(RM) $(G4LIBDIR)/lib$(name).exp;\
|
||||
$(RM) $(G4LIBDIR)/lib$(name).lib;\
|
||||
@@ -101,19 +99,16 @@ ifeq ($(G4SYSTEM),WIN32-VC)
|
||||
link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
|
||||
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
|
||||
$(LIB_PATH)$(G4LIBDIR) $(GLOBLIBS) \
|
||||
$(LIB_PATH)$(USOLIDS_LIB_DIR) $(USOLIDS_LIB) \
|
||||
$(LIB_PATH)$(CLHEP_LIB_DIR) $(CLHEP_LIB) \
|
||||
$(INTYLIBS) $(GDMLLIBS) $(ANALYSISLIBS) $(UI32LIBS)
|
||||
endef
|
||||
define build-global-shared-lib
|
||||
@libdir=`(cd $(@D);/bin/pwd)`;\
|
||||
cd $(G4TMP)/$(G4SYSTEM);\
|
||||
$(ECHO) "Building $(name).dumpbin file ...";\
|
||||
$(RM) $(name).dumpbin;\
|
||||
dumpbin /symbols $(G4LIBDIR)/lib$(name).a > $(name).dumpbin;\
|
||||
$(ECHO) "Building $(name).def file ...";\
|
||||
$(RM) $(name).def;\
|
||||
$(G4LIB)/$(G4SYSTEM)/win32def.exe $(name) < $(name).dumpbin > $(name).def;\
|
||||
$(RM) $(name).dumpbin;\
|
||||
$(G4LIB)/$(G4SYSTEM)/genwindef.exe -o $(name).def -l $(name) $(G4LIBDIR)/lib$(name).a;\
|
||||
$(ECHO) "Building lib$(name).exp and lib$(name).lib ...";\
|
||||
$(RM) $(G4LIBDIR)/lib$(name).exp;\
|
||||
$(RM) $(G4LIBDIR)/lib$(name).lib;\
|
||||
@@ -124,6 +119,7 @@ ifeq ($(G4SYSTEM),WIN32-VC)
|
||||
link.exe /nologo /dll /out:$(G4LIBDIR)/$(name).dll \
|
||||
$(G4LIBDIR)/lib$(name).exp $(G4LIBDIR)/lib$(name).a \
|
||||
$(LIB_PATH)$(G4LIBDIR) $(GLOBLIBS) \
|
||||
$(LIB_PATH)$(USOLIDS_LIB_DIR) $(USOLIDS_LIB) \
|
||||
$(LIB_PATH)$(CLHEP_LIB_DIR) $(CLHEP_LIB) \
|
||||
$(INTYLIBS) $(GDMLLIBS) $(ANALYSISLIBS) $(UI32LIBS)
|
||||
endef
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/* $Id: win32def.c 66368 2012-12-18 09:20:17Z gcosmo $ */
|
||||
/* +---------------------- Copyright notice -------------------------------+ */
|
||||
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
|
||||
/* | Permission to use, copy, modify, and distribute this software | */
|
||||
/* | and its documentation for any purpose and without fee is hereby | */
|
||||
/* | granted, provided that the above copyright notice appear in all | */
|
||||
/* | copies and that both that copyright notice and this permission | */
|
||||
/* | notice appear in supporting documentation. This software is | */
|
||||
/* | provided "as is" without express or implied warranty. | */
|
||||
/* +---------------------- Copyright notice -------------------------------+ */
|
||||
|
||||
/*
|
||||
This program is a tool to build .def file
|
||||
used by lib.exe to build the DLL on Windows.
|
||||
It takes the output of a "dumpbin" over an
|
||||
archive library and produces the .def file for
|
||||
this library. For example :
|
||||
DOS> dumpbin /out:tmp /symbols MyLib.arc
|
||||
DOS> win32def.exe MyLib < tmp > MyLib.def
|
||||
Note that win32def is a standalone program that
|
||||
can be easily reconstructed with :
|
||||
DOS> cl /Fowin32def.exe win32def.c
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char** GetWords (char*,char*,int*);
|
||||
/*****************************************************************************/
|
||||
int main (
|
||||
int aArgn
|
||||
,char** aArgs
|
||||
)
|
||||
/*****************************************************************************/
|
||||
{
|
||||
#define MAX_STRING 2048
|
||||
char buffer[MAX_STRING+1];
|
||||
int length;
|
||||
|
||||
|
||||
/*EXETYPE WINDOWS\n\ */
|
||||
printf("\
|
||||
LIBRARY %s\n\
|
||||
EXPORTS\n",aArgs[1]);
|
||||
|
||||
while(1){
|
||||
if(fgets(buffer,MAX_STRING,stdin)==NULL) return EXIT_FAILURE;
|
||||
/*
|
||||
On some system (NT) editors when saving binary files
|
||||
put \r\n at place of \n ; we then look for \r\n.
|
||||
*/
|
||||
length = strlen(buffer);
|
||||
if( (length>=2) && (buffer[length-2]=='\r') && (buffer[length-1]=='\n') ) {
|
||||
buffer[length-2] = '\0';
|
||||
length--;
|
||||
length--;
|
||||
} else if((length>=1) && (buffer[length-1]=='\n')) {
|
||||
buffer[length-1] = '\0';
|
||||
length--;
|
||||
}
|
||||
if(strstr(buffer,"SECT")==NULL) continue;
|
||||
if(strstr(buffer,"External")==NULL) continue;
|
||||
if(strstr(buffer,"??_")!=NULL) {
|
||||
if(strstr(buffer,"operator/=")==NULL) continue;
|
||||
/* Keep operator /= */
|
||||
}
|
||||
|
||||
{
|
||||
char** words;
|
||||
int wordn;
|
||||
words = GetWords (buffer," ",&wordn);
|
||||
if(wordn>=8) {
|
||||
int iword = 7;
|
||||
int offset = 0;
|
||||
if(strcmp(words[4],"()")==0) {
|
||||
iword = 7;
|
||||
} else if(strcmp(words[4],"External")==0) {
|
||||
iword = 6;
|
||||
}
|
||||
if(words[iword][0]=='_') offset = 1;
|
||||
|
||||
if( (iword==6) && (strstr(buffer,"static class")!=NULL) ){
|
||||
/* static class objects are not DATA */
|
||||
printf(" %s\n",words[iword]+offset);
|
||||
} else if(iword==6) {
|
||||
/* DATA */
|
||||
printf(" %s\tDATA\n",words[iword]+offset);
|
||||
} else {
|
||||
/* code */
|
||||
printf(" %s\n",words[iword]+offset);
|
||||
}
|
||||
|
||||
}
|
||||
{int count;
|
||||
for(count=0;count<wordn;count++) if(words[count]) free(words[count]);
|
||||
if(words) free(words);}
|
||||
}
|
||||
/*printf("%s\n",buffer);*/
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
/*****************************************************************************/
|
||||
char** GetWords (
|
||||
char* a_string
|
||||
,char* a_limiter
|
||||
,int* a_number
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#define STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
|
||||
#define STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}}
|
||||
int count;
|
||||
char* string;
|
||||
char* token;
|
||||
int iline;
|
||||
char** list = NULL;
|
||||
int nline = 0;
|
||||
/*.........................................................................*/
|
||||
if(a_number!=NULL) *a_number = 0;
|
||||
if( (a_string==NULL) || (*a_string=='\0') ) return NULL;
|
||||
if(a_limiter==NULL) return NULL;
|
||||
|
||||
string = STRDUP(a_string);
|
||||
if(string==NULL) return NULL;
|
||||
|
||||
nline = 16;
|
||||
list = (char**)malloc(nline*sizeof(char*));
|
||||
if(list==NULL) return NULL;
|
||||
iline = 0;
|
||||
|
||||
token = string;
|
||||
while(1) {
|
||||
char* pos;
|
||||
pos = strstr (token,a_limiter);
|
||||
if(pos!=NULL) {
|
||||
*pos = '\0';
|
||||
if(*token!='\0') {
|
||||
if(iline>=nline) {
|
||||
nline +=16;
|
||||
list = (char**)realloc(list,nline*sizeof(char*));
|
||||
if(list==NULL) return NULL;
|
||||
}
|
||||
list[iline] = token;
|
||||
iline++;
|
||||
}
|
||||
token = pos + strlen(a_limiter);
|
||||
} else { /*last word*/
|
||||
if(*token!='\0') {
|
||||
if(iline>=nline) {
|
||||
nline += 16;
|
||||
list = (char**)realloc(list,nline*sizeof(char*));
|
||||
if(list==NULL) return NULL;
|
||||
}
|
||||
list[iline] = token;
|
||||
iline++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(count=0;count<iline;count++) list[count] = STRDUP(list[count]);
|
||||
STRDEL(string);
|
||||
|
||||
if(iline==0) {
|
||||
if(list) free(list);
|
||||
if(a_number!=NULL) *a_number = 0;
|
||||
return NULL;
|
||||
} else {
|
||||
if(a_number!=NULL) *a_number = iline;
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user