Skip to content

Commit 23100e6

Browse files
Merge branch 'master' of https://github.com/nexusformat/code
2 parents 629cef6 + 336bba8 commit 23100e6

13 files changed

Lines changed: 101 additions & 15 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Makefile
1212
cmake_install.cmake
1313
install_manifest.txt
1414

15-
15+
# Ignore usual in-tree CMake build area
16+
/build/
1617

1718
# Compiled Object files
1819
*.slo

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ add_custom_target(html)
5151
if(CMAKE_HOST_UNIX)
5252
#easy on Unix - just follow the GNU standard
5353
include(GNUInstallDirs)
54-
endif()
54+
else()
55+
set(CMAKE_INSTALL_LIBDIR lib)
56+
set(CMAKE_INSTALL_DOCDIR doc)
57+
set(CMAKE_INSTALL_INCLUDEDIR include)
58+
set(CMAKE_INSTALL_MANDIR man)
59+
set(CMAKE_INSTALL_BINDIR bin)
60+
endif()
5561

5662

5763
#-----------------------------------------------------------------------------

README.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,34 @@ programs (if configured to build them). To build the API documentation use
124124
125125
$ make html
126126
$ make install-html
127+
128+
Building the code on Windows
129+
============================
130+
131+
These instructions will build everything except the applications using LIBXML2 (e.g. nxtranslate)
132+
133+
* Download and install HDF4 and/or HDF5 libraries from HDF web site
134+
135+
- within these installations is a "cmake" directory, I needed to remove/rename this to get everything to configure properly
136+
137+
* Download MXML source from http://www.msweet.org/projects.php?Z3
138+
139+
- open the vcnet directory
140+
- you need to edit mxml1.def and a add a single line containing the text mxml_error to the end of this file
141+
- open the visual studio solution and build the project
142+
- copy the files mxml.h mxml1.lib mxml1.dll to some other location
143+
144+
* Define HDF4_ROOT, HDF5_ROOT and MXML_ROOT environment variables to point to the top of each installed area
145+
146+
- you should use / rather than \\ for the paths specified in these variables
147+
148+
* Create an empty build directory somewhere - this can be within your nexus source tree
149+
* Run CMAKE-GUI to generate Visual studio solutions files
150+
151+
- Provide source and build paths in the relevant boxes
152+
- Click on Configure, choose appropriate visual studio version when prompted
153+
- A list of options will appear, choose the appropriate ENABLE_ ones and press Configure again
154+
- If nothing is red, click on Generate
155+
156+
* Browse to the build directory and open the generated NeXus.sln
157+
* Build the solution

bindings/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ install (TARGETS NeXus_CPP_Static_Library NeXus_CPP_Shared_Library
5555
DESTINATION ${CMAKE_INSTALL_LIBDIR}
5656
COMPONENT Runtime )
5757

58-
INSTALL (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
58+
INSTALL (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus
5959
COMPONENT Development)
6060

6161

cmake_include/FindHDF4.cmake

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,37 @@
2525
#
2626
#=============================================================================
2727

28+
<<<<<<< HEAD
2829
find_library(HDF4_LIBRARIES NAMES df mfhdf PATH_SUFFIXES hdf)
2930
find_library(HDF4_DF_LIBRARY NAMES df PATH_SUFFIXES hdf)
3031
find_library(HDF4_MFHDF_LIBRARY NAMES mfhdf PATH_SUFFIXES hdf)
3132
message(STATUS "DF library found: ${HDF4_DF_LIBRARY}")
3233
message(STATUS "MFHDF library found: ${HDF4_MFHDF_LIBRARY}")
3334

3435
message(STATUS "HDF4 libraries: ${HDF4_LIBRARIES}")
36+
=======
37+
set(HDF4_LIBRARIES df mfhdf)
3538

36-
find_library(_HDF4_DF_LIBRARY NAMES df PATH_SUFFIXES hdf)
39+
#------------------------------------------------------------------------------
40+
# find the runtime binaries of the HDF4 library
41+
#------------------------------------------------------------------------------
42+
find_library(HDF4_LIBRARIES NAMES df mfhdf
43+
HINTS ENV HDF4_ROOT
44+
PATH_SUFFIXES hdf)
45+
46+
find_library(_HDF4_DF_LIBRARY NAMES df hdf
47+
HINTS ENV
48+
HDF4_ROOT PATH_SUFFIXES hdf)
49+
>>>>>>> 336bba8dd4b92aa97c0684b1285f94d575b23f8a
50+
51+
#if the binaries have been found their parent directory has to be
52+
#extracted from the total path
3753
get_filename_component(HDF4_LIBRARY_DIRS ${_HDF4_DF_LIBRARY} PATH)
3854

39-
find_path ( HDF4_INCLUDE_DIR mfhdf.h PATH /usr/include /usr/include/hdf)
55+
#------------------------------------------------------------------------------
56+
# find the HDF4 header file
57+
#------------------------------------------------------------------------------
58+
find_path (HDF4_INCLUDE_DIR mfhdf.h HINTS ENV HDF4_ROOT PATH_SUFFIXES hdf)
4059

4160
include ( FindPackageHandleStandardArgs )
4261
find_package_handle_standard_args( HDF4 DEFAULT_MSG HDF4_LIBRARIES HDF4_INCLUDE_DIR )
@@ -55,6 +74,6 @@ find_package(JPEG REQUIRED)
5574
#------------------------------------------------------------------------------
5675
# add libraries to the link list for NAPI
5776
#------------------------------------------------------------------------------
58-
list(APPEND NAPI_LINK_LIBS df mfhdf jpeg)
77+
list(APPEND NAPI_LINK_LIBS ${_HDF4_DF_LIBRARY} mfhdf jpeg)
5978
include_directories ( SYSTEM ${HDF4_INCLUDE_DIR} )
6079
link_directories(${HDF4_LIBRARY_DIRS})

cmake_include/FindMXML.cmake

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,27 @@
2525
#
2626
#==============================================================================
2727

28-
find_module(MXML
29-
LIB_NAMES mxml
30-
HEADER_NAMES mxml.h
31-
MOD_NAME mxml)
28+
29+
if(CMAKE_HOST_UNIX)
30+
find_module(MXML
31+
LIB_NAMES mxml
32+
HEADER_NAMES mxml.h
33+
MOD_NAME mxml)
34+
else()
35+
find_module(MXML
36+
LIB_NAMES mxml mxml1
37+
HEADER_NAMES mxml.h
38+
MOD_NAME mxml)
39+
endif()
3240

3341
if(NOT HAVE_MXML)
3442
#the user has explicitely requested to build with MXML - as we could not
3543
#find the library we have to exit the configuration
3644
message(FATAL_ERROR "User requested MXML not found!")
3745
endif()
3846

39-
list(APPEND NAPI_LINK_LIBS mxml)
47+
if(CMAKE_HOST_UNIX)
48+
list(APPEND NAPI_LINK_LIBS mxml)
49+
else()
50+
list(APPEND NAPI_LINK_LIBS mxml mxml1)
51+
endif()

cmake_include/Utilities.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ endfunction()
125125
# to look for the module. The name of the module is passed via the
126126
# MOD_NAME keywoard argument.
127127
# 3.) If no pkg-config module is available, the function looks in the
128-
# default search paths.
128+
# default search paths. It can use the environment variable
129+
# ${MOD_NAME}_ROOT as a path hint.
129130
#
130131
# Arguments:
131132
# Positional arguments:
@@ -193,7 +194,7 @@ function(find_module VAR )
193194

194195
#if pkg-config was not successful we have to do this the hard way
195196
if(NOT ${VAR}_FOUND)
196-
find_library(${VAR}_LIBFILES NAME ${LIB_NAMES} PATHS)
197+
find_library(${VAR}_LIBFILES NAME ${LIB_NAMES} PATHS ENV ${MOD_NAME}_ROOT)
197198
if(${${VAR}_LIBFILES} MATCHES "${VAR}_LIBFILES-NOTFOUND")
198199
set(STATUS "Could not find ${VAR} runtime binaries!")
199200
set(HAVE_${VAR} FALSE PARENT_SCOPE)
@@ -203,7 +204,7 @@ function(find_module VAR )
203204
message(STATUS "${VAR} libraries: ${${VAR}_LIBFILES}")
204205
endif()
205206

206-
find_file(${VAR}_HDRFILES NAME ${HEADER_NAMES} PATHS)
207+
find_file(${VAR}_HDRFILES NAME ${HEADER_NAMES} PATHS ENV ${MOD_NAME}_ROOT)
207208
if(${${VAR}_HDRFILES} MATCHES "${VAR}_HDRFILES-NOTFOUND")
208209
message(STATUS "Could not find ${VAR} header files!")
209210
set(HAVE_${VAR} FALSE PARENT_SCOPE)

include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ SET(INCLUDE_FILES napi.h napiu.h)
3131
configure_file(nxconfig.h.in nxconfig.h @ONLY)
3232

3333
INSTALL (FILES ${INCLUDE_FILES}
34-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ COMPONENT Development)
34+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus COMPONENT Development)

src/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727

2828
add_definitions(-DIN_NEXUS_LIBRARY=1 ${NX_CPP})
2929

30+
# this means a static nexus library will use a DLL HDF5. OK for now,
31+
# but may want to change later.
32+
if (WIN32)
33+
add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB=1)
34+
endif (WIN32)
35+
3036
#-----------------------------------------------------------------------------
3137
# generate list of common source files
3238
#-----------------------------------------------------------------------------

test/leak_test1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <stdio.h>
2+
#ifndef _WIN32
23
#include <unistd.h>
4+
#endif
35
#include <stdlib.h>
46
#include <napi.h>
57

0 commit comments

Comments
 (0)