Skip to content

Commit 3611c30

Browse files
committed
Fix some smaller details.
Fix computation of detector diameter from GADRAS DRFs (doh!) Fix getting usernames from OS for native clients. Fix rendering Shielding/Source fit window when restoring a app state at startup. Fix some incorrect character renderings (on some platforms) by explicitly constructing WStrings from UTF-8. Fix trying to have incompatible nuclides share ages in Shielding/Source fit. Fix serializing generic shielding materials to/from XML when restoring Activity/Shielding fit window. Made it so when you load a foreground that has an unambiguous background, and you arent currently displaying. a background that could be for the new foreground, then display the unambiguous background. Removed some unneeded deployment dependancies for electron target. Cleanup in CMake finding some libraries, especially for Linux. Fix a few small linux compile issues.
1 parent 792deb5 commit 3611c30

File tree

16 files changed

+392
-85
lines changed

16 files changed

+392
-85
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
data/sandia.decay.xml
22
target/ios/InterSpec/InterSpec.xcodeproj
3+
target/electron/app/node_modules
4+
*OUO*

CMakeLists.txt

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ IF( BUILD_AS_OSX_APP )
249249
set( USE_OSX_NATIVE_MENU ON )
250250
set( USE_SPECRUM_FILE_QUERY_WIDGET ON )
251251
set( USE_TERMINAL_WIDGET OFF )
252-
set( SpecUtils_ENABLE_D3_CHART OFF )
252+
set( SpecUtils_ENABLE_D3_CHART ON )
253253
set( USE_SPECTRUM_CHART_D3 OFF )
254254
ENDIF( BUILD_AS_OSX_APP )
255255

@@ -589,9 +589,9 @@ if( USE_SIMPLE_NUCLIDE_ASSIST )
589589
endif( USE_SIMPLE_NUCLIDE_ASSIST )
590590

591591

592-
IF( USE_SPECRUM_FILE_QUERY_WIDGET AND ("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT ANDROID) )
592+
IF( BUILD_FOR_WEB_DEPLOYMENT )
593593
message ( FATAL_ERROR "The spectrum file query widget can not be enabled for web deployed linux version." )
594-
ENDIF( USE_SPECRUM_FILE_QUERY_WIDGET AND ("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT ANDROID) )
594+
ENDIF( BUILD_FOR_WEB_DEPLOYMENT )
595595

596596

597597
IF( USE_SPECRUM_FILE_QUERY_WIDGET )
@@ -868,29 +868,32 @@ if( TRY_TO_STATIC_LINK )
868868
if(USE_OSX_NATIVE_MENU)
869869
list( APPEND LIBRARIES_TO_LINK_TO /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit )
870870
endif(USE_OSX_NATIVE_MENU)
871+
endif(APPLE AND NOT IOS)
871872

872-
#If Wt is compilled with SSL support you might also have to link to:
873-
# /opt/local/lib/libssl.dylib
874-
# /opt/local/lib/libcrypto.dylib
873+
list( APPEND LIBRARIES_TO_LINK_TO ${CMAKE_DL_LIBS} )
875874

876-
if( USE_MYSQL_DB )
877-
list( APPEND LIBRARIES_TO_LINK_TO /opt/local/lib/libmysqlclient.a )
878-
endif( USE_MYSQL_DB )
879-
endif(APPLE AND NOT IOS)
875+
if( USE_MYSQL_DB )
876+
include( cmake/WtFindMysql.txt )
877+
list( APPEND LIBRARIES_TO_LINK_TO ${MYSQL_LIBRARIES} )
878+
endif( USE_MYSQL_DB )
880879

881-
if("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT ANDROID)
882-
list( APPEND LIBRARIES_TO_LINK_TO
883-
/usr/lib64/libmysqlclient.so
884-
/usr/lib64/libfcgi.a
885-
/usr/lib64/libfcgi++.a
886-
/usr/lib64/libz.so
887-
/usr/lib64/libssl.so
888-
/usr/lib64/libcrypto.so
889-
/usr/lib64/libdl.so
890-
-lrt -ldl
891-
)
880+
if( Wt_FCGI_LIBRARY )
881+
include( cmake/WtFindFcgi.txt )
882+
list( APPEND LIBRARIES_TO_LINK_TO ${FCGI_LIBRARIES} )
883+
endif( Wt_FCGI_LIBRARY )
884+
885+
include( cmake/WtFindSsl.txt )
886+
if( SSL_FOUND )
887+
list( APPEND LIBRARIES_TO_LINK_TO ${SSL_LIBRARIES} )
888+
endif( SSL_FOUND )
892889

893-
#as of GCC 4.5 we can statically link to the c++ runtime, so lets do it
890+
#link to zlib since Wt might
891+
if("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT SUPPORT_ZIPPED_SPECTRUM_FILES)
892+
list( APPEND LIBRARIES_TO_LINK_TO ${ZLIB_LIBRARIES} )
893+
endif("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT SUPPORT_ZIPPED_SPECTRUM_FILES)
894+
895+
if("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT ANDROID)
896+
list( APPEND LIBRARIES_TO_LINK_TO -lrt )
894897
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++" )
895898
endif("${CMAKE_SYSTEM}" MATCHES "Linux" AND NOT ANDROID)
896899
endif( TRY_TO_STATIC_LINK )

InterSpec/PeakFit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ namespace ExperimentalAutomatedPeakSearch
330330

331331

332332
#define WRITE_CANDIDATE_PEAK_INFO_TO_FILE 0
333-
#define WRITE_CANDIDATE_PEAK_TERMINAL_DEBUG_LEVEL 1
333+
#define WRITE_CANDIDATE_PEAK_TERMINAL_DEBUG_LEVEL 0
334334

335335
namespace ExperimentalPeakSearch
336336
{

cmake/WtFindFcgi.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This file sets:
2+
# - FCGI_INCLUDE_DIRS
3+
# - FCGI_LIBRARIES
4+
# - FCGI_FOUND
5+
#
6+
# Taking into account:
7+
# - FCGI_PREFIX
8+
9+
FIND_PATH(FCGI_INCLUDE_DIR
10+
fcgio.h
11+
PATHS
12+
${FCGI_PREFIX}/include
13+
/usr/include
14+
/usr/local/include
15+
/usr/include/fastcgi
16+
)
17+
18+
FIND_LIBRARY(FCGI_LIB fcgi
19+
${FCGI_PREFIX}/lib
20+
/usr/lib
21+
/usr/lib64
22+
/usr/local/lib
23+
)
24+
25+
FIND_LIBRARY(FCGIPP_LIB fcgi++
26+
${FCGI_PREFIX}/lib
27+
/usr/lib
28+
/usr/lib64
29+
/usr/local/lib
30+
)
31+
32+
SET(FCGI_FOUND FALSE)
33+
34+
IF(FCGI_INCLUDE_DIR
35+
AND FCGI_LIB
36+
AND FCGIPP_LIB)
37+
SET(FCGI_FOUND TRUE)
38+
SET(FCGI_LIBRARIES ${FCGI_LIB} ${FCGIPP_LIB})
39+
SET(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
40+
ENDIF(FCGI_INCLUDE_DIR
41+
AND FCGI_LIB
42+
AND FCGIPP_LIB)

cmake/WtFindMysql.txt

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# This file defines:
2+
# - MYSQL_LIBRARIES
3+
# - MYSQL_INCLUDE_DIRS
4+
# - MYSQL_FOUND
5+
# - MYSQL_DEFINITIONS
6+
# Taking into account:
7+
# - MYSQL_PREFIX
8+
9+
FIND_PATH(MYSQL_INCLUDE mysql.h
10+
${MYSQL_PREFIX}/mariadbclient/include
11+
${MYSQL_PREFIX}/include/mariadb
12+
${MYSQL_PREFIX}/include
13+
${MYSQL_PREFIX}/include/mysql
14+
/usr/include
15+
/usr/local/include
16+
/usr/include/mysql
17+
/opt/local/include/mysql5/mysql
18+
/usr/local/include/mysql
19+
)
20+
21+
SET(MYSQL_LIBRARY mariadb libmariadb mariadbclient mysqlclient libmysql CACHE STRING "Library that provides MySQL/MariaDB API (set to mysqlclient for mysql on unix; libmysql on windows)")
22+
FOREACH(l ${MYSQL_LIBRARY})
23+
LIST(APPEND MYSQL_DEBUG_LIBRARY "${l}d")
24+
ENDFOREACH()
25+
26+
FIND_LIBRARY(MYSQL_LIB
27+
NAMES
28+
${MYSQL_LIBRARY}
29+
PATHS
30+
${MYSQL_PREFIX}/lib
31+
${MYSQL_PREFIX}/lib/opt
32+
${MYSQL_PREFIX}/lib/mysql
33+
${MYSQL_PREFIX}/lib64/mysql
34+
/usr/lib
35+
/usr/local/lib
36+
/opt/local/lib
37+
${MYSQL_PREFIX}/lib/mariadb
38+
)
39+
40+
FIND_LIBRARY(MYSQL_DEBUG_LIB
41+
NAMES
42+
${MYSQL_DEBUG_LIBRARY}
43+
PATHS
44+
${MYSQL_PREFIX}/lib
45+
${MYSQL_PREFIX}/lib/opt
46+
/usr/lib
47+
/usr/local/lib
48+
/opt/local/lib
49+
)
50+
51+
SET(MYSQL_FOUND OFF)
52+
53+
IF(WIN32)
54+
IF (MYSQL_INCLUDE AND MYSQL_LIB)
55+
SET(MYSQL_FOUND ON)
56+
SET(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE})
57+
IF (MYSQL_DEBUG_LIB)
58+
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIB} debug ${MYSQL_DEBUG_LIB})
59+
ELSE (MYSQL_DEBUG_LIB)
60+
SET(MYSQL_LIBRARIES ${MYSQL_LIB})
61+
ENDIF (MYSQL_DEBUG_LIB)
62+
ENDIF (MYSQL_INCLUDE AND MYSQL_LIB)
63+
ELSE(WIN32)
64+
IF (MYSQL_INCLUDE AND MYSQL_LIB)
65+
SET(MYSQL_FOUND ON)
66+
SET(MYSQL_LIBRARIES ${MYSQL_LIB})
67+
SET(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE})
68+
ELSE (MYSQL_INCLUDE AND MYSQL_LIB)
69+
SET(MYSQL_FOUND OFF)
70+
SET(MYSQL_LIBRARIES)
71+
ENDIF (MYSQL_INCLUDE AND MYSQL_LIB)
72+
ENDIF(WIN32)
73+
74+
75+
INCLUDE (CheckSymbolExists)
76+
# mariadb 1.0.0 does not have mysql_library_init
77+
IF(MYSQL_FOUND)
78+
SET(CMAKE_REQUIRED_FLAGS "")
79+
SET(CMAKE_REQUIRED_DEFINITIONS "")
80+
SET(CMAKE_REQUIRED_LIBRARIES "")
81+
SET(CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE})
82+
CHECK_SYMBOL_EXISTS(mysql_library_init mysql.h MYSQL_HAVE_LIBRARY_INIT)
83+
IF(NOT MYSQL_HAVE_LIBRARY_INIT)
84+
SET(MYSQL_DEFINITIONS "-DMYSQL_NO_LIBRARY_INIT")
85+
ENDIF(NOT MYSQL_HAVE_LIBRARY_INIT)
86+
ENDIF(MYSQL_FOUND)

cmake/WtFindSsl.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# We define:
2+
# - SSL_INCLUDE_DIRS
3+
# - SSL_LIBRARIES
4+
# - SSL_FOUND
5+
# Taking into account:
6+
# - SSL_PREFIX
7+
#
8+
# Remark for Win32 users: This file searches for both debug and release
9+
# versions of the OpenSSL library. We assume that debug libs are compiled
10+
# with /MDd, and release with /MD. Apparently that is what CMake uses for
11+
# these modes; it is currently unclear to me if cmake ever uses /MT variants.
12+
13+
# default OSX SSL library is not OK, does not work with asio
14+
IF(APPLE)
15+
FIND_PATH(SSL_INCLUDE_DIRS
16+
openssl/ssl.h
17+
PATHS
18+
${SSL_PREFIX}/include/
19+
/usr/include/
20+
/usr/local/include/
21+
c:/openssl/include/
22+
NO_DEFAULT_PATH
23+
)
24+
ELSE(APPLE)
25+
FIND_PATH(SSL_INCLUDE_DIRS
26+
openssl/ssl.h
27+
PATHS
28+
${SSL_PREFIX}/include/
29+
/usr/include/
30+
/usr/local/include/
31+
c:/openssl/include/
32+
)
33+
ENDIF(APPLE)
34+
35+
IF(WIN32)
36+
IF(NOT SSL_LIB_NAMES)
37+
SET(SSL_LIB_NAMES ssleay32MD ssleay32)
38+
ENDIF(NOT SSL_LIB_NAMES)
39+
IF(NOT SSL_LIB_TOO_NAMES)
40+
SET(SSL_LIB_TOO_NAMES libeay32MD libeay32)
41+
ENDIF(NOT SSL_LIB_TOO_NAMES)
42+
MESSAGE("Looking for ssl: ${SSL_LIB_NAMES}, ${SSL_LIB_TOO_NAMES}")
43+
FOREACH(l ${SSL_LIB_NAMES})
44+
LIST(APPEND SSL_LIB_DEBUG_NAMES "${l}d")
45+
ENDFOREACH()
46+
FOREACH(l ${SSL_LIB_TOO_NAMES})
47+
LIST(APPEND SSL_LIB_TOO_DEBUG_NAMES "${l}d")
48+
ENDFOREACH()
49+
50+
FIND_LIBRARY(SSL_LIB_RELEASE
51+
NAMES
52+
${SSL_LIB_NAMES}
53+
PATHS
54+
/usr/lib
55+
/usr/local/lib
56+
${SSL_PREFIX}/lib
57+
${SSL_PREFIX}/lib/VC
58+
c:/openssl/lib/VC
59+
)
60+
61+
FIND_LIBRARY(SSL_LIB_DEBUG
62+
NAMES
63+
${SSL_LIB_DEBUG_NAMES}
64+
PATHS
65+
/usr/lib
66+
/usr/local/lib
67+
${SSL_PREFIX}/lib
68+
${SSL_PREFIX}/lib/VC
69+
c:/openssl/lib/VC
70+
)
71+
72+
FIND_LIBRARY(SSL_TOO_LIB_RELEASE
73+
NAMES
74+
${SSL_LIB_TOO_NAMES}
75+
PATHS
76+
${SSL_PREFIX}/lib
77+
${SSL_PREFIX}/lib/VC
78+
c:/openssl/lib/VC
79+
)
80+
81+
FIND_LIBRARY(SSL_TOO_LIB_DEBUG
82+
NAMES
83+
${SSL_LIB_TOO_DEBUG_NAMES}
84+
PATHS
85+
${SSL_PREFIX}/lib
86+
${SSL_PREFIX}/lib/VC
87+
c:/openssl/lib/VC
88+
)
89+
90+
# We require both release and debug versions of the SSL libs. People who
91+
# really know what they are doing, may edit this file to relax this requirement.
92+
IF(SSL_INCLUDE_DIRS
93+
AND SSL_LIB_RELEASE
94+
AND SSL_LIB_DEBUG
95+
AND SSL_TOO_LIB_RELEASE
96+
AND SSL_TOO_LIB_DEBUG)
97+
SET(SSL_FOUND true)
98+
SET(SSL_LIBRARIES
99+
optimized ${SSL_LIB_RELEASE} debug ${SSL_LIB_DEBUG}
100+
optimized ${SSL_TOO_LIB_RELEASE} debug ${SSL_TOO_LIB_DEBUG})
101+
ELSE(SSL_INCLUDE_DIRS
102+
AND SSL_LIB_RELEASE
103+
AND SSL_LIB_DEBUG
104+
AND SSL_TOO_LIB_RELEASE
105+
AND SSL_TOO_LIB_DEBUG)
106+
SET(SSL_FOUND false)
107+
ENDIF(SSL_INCLUDE_DIRS
108+
AND SSL_LIB_RELEASE
109+
AND SSL_LIB_DEBUG
110+
AND SSL_TOO_LIB_RELEASE
111+
AND SSL_TOO_LIB_DEBUG)
112+
ELSEIF(APPLE)
113+
FIND_LIBRARY(SSL_LIB
114+
NAMES
115+
ssl
116+
PATHS
117+
${SSL_PREFIX}/lib
118+
${SSL_PREFIX}/lib/VC
119+
/usr/lib
120+
/usr/local/lib
121+
NO_DEFAULT_PATH
122+
)
123+
ELSE (WIN32)
124+
FIND_LIBRARY(SSL_LIB
125+
NAMES
126+
ssl
127+
PATHS
128+
${SSL_PREFIX}/lib
129+
${SSL_PREFIX}/lib/VC
130+
/usr/lib
131+
/usr/local/lib
132+
)
133+
ENDIF (WIN32)
134+
135+
IF(SSL_LIB
136+
AND SSL_INCLUDE_DIRS)
137+
IF(WIN32)
138+
IF(SSL_TOO_LIB)
139+
SET(SSL_FOUND true)
140+
SET(SSL_LIBRARIES ${SSL_LIB} ${SSL_TOO_LIB})
141+
ELSE(SSL_TOO_LIB)
142+
SET(SSL_FOUND false)
143+
ENDIF(SSL_TOO_LIB)
144+
ELSE(WIN32)
145+
SET(SSL_FOUND true)
146+
SET(SSL_LIBRARIES ${SSL_LIB} -lcrypto)
147+
ENDIF(WIN32)
148+
ENDIF(SSL_LIB
149+
AND SSL_INCLUDE_DIRS)
150+

external_libs/SandiaDecay

src/ColorSelect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace
8888
return buffer;
8989
}
9090

91-
#if( defined(_MSC_VER) || ANDROID )
91+
#if( defined(_MSC_VER) || ANDROID || __linux__ )
9292
bool ishexnumber(const char c)
9393
{
9494
static const char hexchars[] = { '0','1','2','3','4','5','6','7','8','9','a','A','b','B','c','C','d','D','e','E','f','F' };

src/DetectorPeakResponse.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,12 @@ void DetectorPeakResponse::fromGadrasDefinition( std::istream &csvFile,
625625

626626
if( detWidth<=0.0 || heightToWidth<=0.0 )
627627
throw runtime_error( "Couldnt find detector dimensions in the Detector.dat file" );
628-
628+
629629
const float surfaceArea = detWidth * detWidth * heightToWidth;
630-
const float detectorDiameter = (4.0f/3.14159265359f) * sqrt(surfaceArea)
631-
* static_cast<float>(PhysicalUnits::cm);
632-
fromEnergyEfficiencyCsv( csvFile, detectorDiameter,
633-
static_cast<float>(PhysicalUnits::keV) );
630+
//const float diam = (4.0f/3.14159265359f) * sqrt(surfaceArea) * static_cast<float>(PhysicalUnits::cm);
631+
const float diam = 2.0f*sqrt(surfaceArea/3.14159265359f) * static_cast<float>(PhysicalUnits::cm);
632+
633+
fromEnergyEfficiencyCsv( csvFile, diam, static_cast<float>(PhysicalUnits::keV) );
634634

635635
m_efficiencySource = kGadrasEfficiencyDefintion;
636636

0 commit comments

Comments
 (0)