Skip to content

Commit 87b2387

Browse files
committed
Initial public release
0 parents  commit 87b2387

File tree

117 files changed

+51563
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+51563
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
wiki/

CMakeLists.txt

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
2+
# #
3+
# Copyright (c) 2019, De Graef Group, Carnegie Mellon University #
4+
# All rights reserved. #
5+
# #
6+
# Author: William C. Lenthe #
7+
# #
8+
# This package is free software; you can redistribute it and/or #
9+
# modify it under the terms of the GNU General Public License as #
10+
# published by the Free Software Foundation; either version 2 of the #
11+
# License, or (at your option) any later version. #
12+
# #
13+
# This program is distributed in the hope that it will be useful, #
14+
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16+
# GNU General Public License for more details. #
17+
# #
18+
# You should have received a copy of the GNU General Public License #
19+
# along with this program; if not, check the Free Software Foundation #
20+
# website: <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html> #
21+
# #
22+
# #
23+
# Interested in a commercial license? Contact: #
24+
# #
25+
# Center for Technology Transfer and Enterprise Creation #
26+
# 4615 Forbes Avenue, Suite 302 #
27+
# Pittsburgh, PA 15213 #
28+
# #
29+
# phone. : 412.268.7393 #
30+
# email : innovation@cmu.edu #
31+
# website: https://www.cmu.edu/cttec/ #
32+
# #
33+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
34+
35+
project(EMSphInx)
36+
# cmake_minimum_required(VERSION 3.12) # 3.12 for the parallel option for cmake --build
37+
cmake_minimum_required(VERSION 3.14) # for FetchContent_MakeAvailable (could fall back to 3.12 with alternate pattern but it is now deprecated)
38+
39+
set(CMAKE_CXX_STANDARD 11) # apparently you still need to explicitly request 2011 conformance in 2019...
40+
41+
################################
42+
# package options #
43+
################################
44+
45+
option(EMSPHINX_BUILD_SHARED "should shared or static libraries be preferred" OFF)
46+
option(EMSPHINX_FFTW_F "enable float templates by linking against fftw_f" OFF)
47+
option(EMSPHINX_FFTW_D "enable double templates by linking against fftw" ON )
48+
option(EMSPHINX_FFTW_L "enable long double templates by linking against fftw_l" OFF)
49+
option(EMSPHINX_BUILD_FFTW "fetch and build FFTW instead of using an existing system installation" ON )
50+
option(EMSPHINX_FFTW_SIMD "should SSE/SSE2/AVX instructions be enabled for fftw build (faster run, slower compiler)" ON )
51+
option(EMSPHINX_FFTW_AVX2 "should AVX2 instructions be enabled for fftw build (not supported on all processors) " OFF)
52+
option(EMSPHINX_BUILD_HDF5 "fetch and build HDF5 instead of using an existing system installation" ON )
53+
option(EMSPHINX_BUILD_TESTS "should test programs (/test/*) be built" ON )
54+
option(EMSPHINX_BUILD_GUIS "should the GUI programs be built (experimental)" OFF)
55+
if(EMSPHINX_BUILD_GUIS)
56+
option(EMSPHINX_BUILD_wxWidgets "should wxWidgets be built from source" ON)
57+
endif()
58+
59+
################################
60+
# multicore compiling #
61+
################################
62+
63+
include(ProcessorCount)
64+
ProcessorCount(NCORES)
65+
if(NOT NCORES EQUAL 0)
66+
set(CMAKE_BUILD_PARALLEL_LEVEL NCORES)
67+
endif()
68+
69+
################################
70+
# compiler specific adjustment #
71+
################################
72+
73+
# visual studio
74+
if(MSVC)
75+
add_definitions(-D_SCL_SECURE_NO_WARNINGS) # these warnings are annoying and not critical
76+
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # these warnings are annoying and not critical
77+
# add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>) # use multi core compiling
78+
add_compile_options(/MP) # the generator expression version breaks wxWidgets
79+
endif()
80+
81+
# gcc
82+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
83+
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-pthread" )# std::thread requires pthreads on gcc
84+
endif()
85+
86+
# non clang osx
87+
# if(APPLE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # only for gcc, not clang
88+
# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # there seems to be an rpath issue on apple + GCC
89+
# endif()
90+
set(MACOSX_RPATH ON) # still haven't fully resolved this...
91+
92+
################################
93+
# dynamic library copying #
94+
################################
95+
96+
# get prefix/extension for built libraries
97+
if(EMSPHINX_BUILD_SHARED)
98+
set(LIB_PRE ${CMAKE_SHARED_LIBRARY_PREFIX})
99+
set(LIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX})
100+
else()
101+
set(LIB_PRE ${CMAKE_STATIC_LIBRARY_PREFIX})
102+
set(LIB_EXT ${CMAKE_STATIC_LIBRARY_SUFFIX})
103+
endif()
104+
105+
# determine name of files to link against (windows makes .dll for runtime but also keeps .lib for linking) and copy into build directory
106+
if(MSVC)
107+
set(LNK_EXT ${CMAKE_STATIC_LIBRARY_SUFFIX}) # link against the .lib
108+
set(CPY_DIR bin) # location to copy shared libraries from
109+
else()
110+
set(LNK_EXT ${LIB_EXT}) # link against static or dynamic as appropriate
111+
set(CPY_DIR lib) # location to copy shared libraries from
112+
endif()
113+
114+
################################
115+
# git versioning #
116+
################################
117+
118+
find_package(Git REQUIRED)
119+
execute_process( # get branch name
120+
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
121+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
122+
OUTPUT_VARIABLE EMSPHINX_GIT_BRANCH
123+
OUTPUT_STRIP_TRAILING_WHITESPACE
124+
)
125+
execute_process( # get abbreviated hash
126+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
127+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
128+
OUTPUT_VARIABLE EMSPHINX_GIT_HASH
129+
OUTPUT_STRIP_TRAILING_WHITESPACE
130+
)
131+
132+
if("${EMSPHINX_GIT_BRANCH}" STREQUAL "")
133+
message(FATAL_ERROR "failed to determine git branch)")
134+
endif()
135+
if("${EMSPHINX_GIT_HASH}" STREQUAL "")
136+
message(FATAL_ERROR "failed to determine git hash)")
137+
endif()
138+
139+
add_definitions("-DEMSPHINX_GIT_HASH=${EMSPHINX_GIT_HASH}")
140+
add_definitions("-DEMSPHINX_GIT_BRANCH=${EMSPHINX_GIT_BRANCH}")
141+
142+
################################
143+
# dependencies #
144+
################################
145+
146+
# fetch SHT file format content
147+
# this could be done with a git submodule but the user would have to call:
148+
# git submodule update
149+
# git clone --recursive
150+
# which is a bit annoying
151+
include(FetchContent)
152+
FetchContent_Declare(
153+
SHTfile
154+
GIT_REPOSITORY "https://github.com/EMsoft-org/SHTfile"
155+
GIT_TAG "cfd13df"
156+
# GIT_TAG "v3.1.2" # just get the most recent version for now
157+
# GIT_PROGRESS TRUE # its currently only 1 file, we probably don't need to print out progress
158+
)
159+
# set(FETCHCONTENT_QUIET NO) # again only 1 file
160+
FetchContent_MakeAvailable(SHTfile)
161+
FetchContent_GetProperties(SHTfile BINARY_DIR SHTfile_BINARY_DIR)
162+
include_directories(${SHTfile_BINARY_DIR})
163+
164+
# compiled dependencies
165+
include(${CMAKE_CURRENT_LIST_DIR}/depends/FFTW.cmake) # build or find existing FFTW
166+
include(${CMAKE_CURRENT_LIST_DIR}/depends/HDF5.cmake) # build or find existing HDF5
167+
168+
if(EMSPHINX_BUILD_GUIS)
169+
include(${CMAKE_CURRENT_LIST_DIR}/depends/wxWidgets.cmake) # build or find existing HDF5
170+
endif()
171+
172+
# png support, for now I've included these files directly due to download issues on some versions of cmake (if libcurl doesn't support https)
173+
set(BuildMiniZ OFF)
174+
if(BuildMiniZ)
175+
set(MINIZ_VERSION "2.0.8")
176+
ExternalProject_Add(
177+
miniz PREFIX "miniz"
178+
URL https://github.com/richgel999/miniz/releases/download/${MINIZ_VERSION}/miniz-${MINIZ_VERSION}.zip
179+
URL_HASH MD5=0692c3f080267b24419ab67c1eefc881 # make sure the download wasn't corrupted (/ someone hasn't injected a different version)
180+
CONFIGURE_COMMAND "" ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/miniz/src/miniz/ ${CMAKE_SOURCE_DIR}/include/miniz # copy everything (source + license are most critical)
181+
BUILD_COMMAND "" INSTALL_COMMAND ""
182+
)
183+
endif(BuildMiniZ)
184+
185+
################################
186+
# add actual components #
187+
################################
188+
189+
# include headers
190+
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
191+
include_directories(${CMAKE_CURRENT_LIST_DIR}/icons)
192+
193+
# add test programs if needed
194+
if(EMSPHINX_BUILD_TESTS)
195+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test ${CMAKE_BINARY_DIR}/test) # don't put in /cpp/test
196+
endif()
197+
198+
# add actual programs
199+
include(${CMAKE_CURRENT_LIST_DIR}/programs/CMakeLists.txt) # include instead of add_subdirectory so we don't get a subfolder in the build

ReadMe.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
![EMSphInx Logo](icons/sphinx.png)
2+
3+
# EMSphInx
4+
*EMSphInx* is a collection of modules and programs that can be used to index a variety of diffraction patterns, ranging from EBSD to TKD, ECP, and x-ray Laue patterns. EMSphInx is currently a public beta; please report bugs to the issue tracker. If you use these programs for research, consider citing the corresponding papers:
5+
6+
* [EBSD Indexing](https://doi.org/10.1016/j.ultramic.2019.112841)
7+
* [Pseudo-symmetry Prediction](https://doi.org/10.1107/S1600576719011233)
8+
9+
## Financial Support
10+
The *EMSphInx* code was developed with support from an ONR Vannevar Bush Faculty Fellowship grant, N00014-­16-­1-­2821. The central indexing algorithm is covered by a provisional patent application.
11+
12+
## Build Instructions
13+
Nightly builds will be available soon for a variety of operating systems
14+
15+
*EMSphInx* requires [CMake 3.14 or higher](https://www.cmake.org/download) to build. All dependencies are downloaded and compiled as part of the build process by default. The easiest way to build a non-default version of *EMSphInx* is with the cmake gui or ccmake. If you are restricted to the command line and only need the default configuration you can build with the following sequence:
16+
17+
Download the source
18+
19+
> git clone https://github.com/EMsoft-org/EMSphInx
20+
21+
Create a build directory and move into it
22+
23+
> mkdir EMSphInxBuild
24+
25+
> cd EMSphInxBuild
26+
27+
Run cmake and build, if you would like to build the GUIs you can optionally set the GUI CMake flag (e.g. -DEMSPHINX_BUILD_GUIS=ON)
28+
29+
> cmake ../EMSphInx
30+
31+
> make -j
32+
33+
FFTW can compile SIMD instructions on some platforms even if they are not available on the current hardware. If you encounter illegal instructions at runtime try compiling with SIMD disabled (-DEMSPHINX_FFTW_SIMD=OFF). AVX2 instructions are disabled by default but can be enabled with EMSPHINX_FFTW_AVX2.
34+
35+
## Utility Program Overview
36+
37+
1. IndexEBSD
38+
39+
index EBSD patterns on the command line with a namelist file
40+
41+
2. MasterXcorr
42+
43+
compute spherical cross correlation between 2 spherical master patterns
44+
45+
3. ShtWisdom
46+
47+
build FFTW wisdom on new systems (reduces initialization time on first execution of other programs)
48+
49+
4. mp2sht
50+
51+
convert from EMsoft EBSD master patterns to the new SHT file format used by the indexing programs
52+
53+
5. EMSphInxEBSD (only if EMSPHINX_BUILD_GUIS=ON)
54+
55+
graphical user interface to build namelist files for IndexEBSD and/or index patterns directly
56+
57+
Help files for these programs are available as wiki pages on [github.com:EMsoft-org/EMSphInx/wiki]() or in the documentation folder of this repository.
58+
59+
## New features in 0.1
60+
- Public Beta
61+
62+
## What's coming in future versions
63+
- Additional diffraction modalities
64+
- Python bindings
65+
66+
Feel free to request additional features using the repo's [issue tracker](https://github.com/EMsoft-org/EMSphInx/issues) (please be sure to tag your issue with the 'enhancement flag')
67+
68+
## License ##
69+
70+
*EMSphInx* source files are distributed under GNU General Public License v2.0 (GPL2), see the license.txt file for details.
71+
72+
*EMSphInx* also includes several files from BSD licensed (3-clause) projects (please refer to the individual files for details):
73+
74+
- include/miniz/miniz.c

data/Nickel.sht

73.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)