Skip to content

Commit 9c73bd8

Browse files
Merge pull request #408 from nexusformat/windows
Windows build fixes. Gite it a try ;)
2 parents 6543c43 + 283a20a commit 9c73bd8

10 files changed

Lines changed: 140 additions & 32 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ add_custom_target(html)
5151
if(CMAKE_HOST_UNIX)
5252
#easy on Unix - just follow the GNU standard
5353
include(GNUInstallDirs)
54+
set(STATIC_LIBRARY_SUFFIX "")
55+
set(NEXUS_INSTALL_SHLIB ${CMAKE_INSTALL_LIBDIR})
5456
else()
5557
set(CMAKE_INSTALL_LIBDIR lib)
5658
set(CMAKE_INSTALL_DOCDIR doc)
5759
set(CMAKE_INSTALL_INCLUDEDIR include)
5860
set(CMAKE_INSTALL_MANDIR man)
5961
set(CMAKE_INSTALL_BINDIR bin)
62+
set(STATIC_LIBRARY_SUFFIX "Static")
63+
set(NEXUS_INSTALL_SHLIB ${CMAKE_INSTALL_BINDIR})
6064
endif()
6165

6266

README.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,13 @@ These instructions will build everything except the applications using LIBXML2 (
150150

151151
- Provide source and build paths in the relevant boxes
152152
- Click on Configure, choose appropriate visual studio version (with Win64 suffix if needed) when prompted
153-
- A list of options will appear, select the ENABLE_* boxes for the components you need and press Configure again
154-
- If nothing is red, click on Generate
153+
- A list of options will appear, select the ENABLE_* boxes for the components you need
154+
- Also check the CMAKE_INSTALL_PREFIX is appropriate, this is the root where file may be installed to later
155+
- press Configure again
156+
- If anything now appears in red, it means it is a newly displayed option. If you change ones of these (or any other value) you need to pres Configure again, otherwise move onto the next step
157+
- Click on Generate
155158

156159
* Browse to the build directory and open the generated NeXus.sln
157160
* Build the solution
161+
162+
- If you wish to copy files to the install directory above, right click and Build the INSTALL project

applications/NXconvert/nxconvert_common.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@
3434

3535
static const char* nx_formats[] = { "XML", "HDF4", "HDF5", "DEFINITION", NULL };
3636

37-
#ifdef _WIN32
38-
#ifdef NXCONVERT_EXPORTS
39-
__declspec(dllexport)
40-
#else
41-
__declspec(dllimport)
42-
#endif /* NXCONVERT_EXPORTS */
43-
#endif /* _WIN32 */
37+
// not needed now we are not being used as a library
38+
//#ifdef _WIN32
39+
//#ifdef NXCONVERT_EXPORTS
40+
//__declspec(dllexport)
41+
//#else
42+
//__declspec(dllimport)
43+
//#endif /* NXCONVERT_EXPORTS */
44+
//#endif /* _WIN32 */
4445
extern int convert_file(int nx_format, const char* inFile, int nx_read_access, const char* outFile, int nx_write_access, const char* definition_name_);
4546

4647
#endif /* NXCONVERT_COMMON */

bindings/cpp/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ set_property(SOURCE ${SOURCES} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS})
3838
#------------------------------------------------------------------------------
3939
add_library (NeXus_CPP_Static_Library STATIC ${HEADERS} ${SOURCES})
4040
set_target_properties(NeXus_CPP_Static_Library PROPERTIES
41-
OUTPUT_NAME NeXusCPP)
41+
OUTPUT_NAME NeXusCPP${STATIC_LIBRARY_SUFFIX})
4242

4343
target_link_libraries(NeXus_CPP_Static_Library NeXus_Static_Library)
4444

@@ -51,9 +51,14 @@ set_target_properties(NeXus_CPP_Shared_Library PROPERTIES
5151
VERSION "${ABI_VERSION}"
5252
SOVERSION ${ABI_CURRENT})
5353

54-
install (TARGETS NeXus_CPP_Static_Library NeXus_CPP_Shared_Library
54+
install (TARGETS NeXus_CPP_Shared_Library
55+
RUNTIME DESTINATION ${NEXUS_INSTALL_SHLIB} COMPONENT Runtime
56+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
57+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
58+
59+
install (TARGETS NeXus_CPP_Static_Library
5560
DESTINATION ${CMAKE_INSTALL_LIBDIR}
56-
COMPONENT Runtime )
61+
COMPONENT Development)
5762

5863
INSTALL (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus
5964
COMPONENT Development)

bindings/f77/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set (SOURCES napif.f)
3636
add_library (NeXus_F77_Static_Library STATIC ${HEADERS} ${SOURCES})
3737

3838
set_target_properties(NeXus_F77_Static_Library PROPERTIES
39-
OUTPUT_NAME NeXus77)
39+
OUTPUT_NAME NeXus77${STATIC_LIBRARY_SUFFIX})
4040

4141
target_link_libraries(NeXus_F77_Static_Library NeXus_Static_Library)
4242

@@ -52,9 +52,14 @@ set_target_properties(NeXus_F77_Shared_Library PROPERTIES
5252

5353
target_link_libraries(NeXus_F77_Shared_Library NeXus_Shared_Library)
5454

55-
install (TARGETS NeXus_F77_Static_Library NeXus_F77_Shared_Library
56-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
57-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nexus COMPONENT Development)
55+
install (TARGETS NeXus_F77_Shared_Library
56+
RUNTIME DESTINATION ${NEXUS_INSTALL_SHLIB} COMPONENT Runtime
57+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
58+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
59+
60+
install (TARGETS NeXus_F77_Static_Library
61+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/nexus
62+
COMPONENT Development)
5863

5964
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/napif.inc
6065
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nexus

bindings/f90/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ set (SOURCES NXmodule.f90 NXUmodule.f90)
3434
#------------------------------------------------------------------------------
3535

3636
add_library (NeXus_F90_Static_Library STATIC ${SOURCES})
37-
set_target_properties(NeXus_F90_Static_Library PROPERTIES OUTPUT_NAME NeXus90)
37+
set_target_properties(NeXus_F90_Static_Library PROPERTIES OUTPUT_NAME NeXus90${STATIC_LIBRARY_SUFFIX})
3838
target_link_libraries(NeXus_F90_Static_Library NeXus_Static_Library)
3939

4040
#------------------------------------------------------------------------------
@@ -51,6 +51,11 @@ set_target_properties(NeXus_F90_Shared_Library PROPERTIES
5151

5252
target_link_libraries(NeXus_F90_Shared_Library NeXus_Shared_Library )
5353

54-
install (TARGETS NeXus_F90_Static_Library NeXus_F90_Shared_Library
55-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Runtime
56-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/nexus COMPONENT Development)
54+
install (TARGETS NeXus_F90_Shared_Library
55+
RUNTIME DESTINATION ${NEXUS_INSTALL_SHLIB} COMPONENT Runtime
56+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
57+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
58+
59+
install (TARGETS NeXus_F90_Static_Library
60+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/nexus
61+
COMPONENT Development)

cmake_include/FindMXML.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,4 @@ if(NOT HAVE_MXML)
4444
message(FATAL_ERROR "User requested MXML not found!")
4545
endif()
4646

47-
if(CMAKE_HOST_UNIX)
48-
list(APPEND NAPI_LINK_LIBS mxml)
49-
else()
50-
list(APPEND NAPI_LINK_LIBS mxml mxml1)
51-
endif()
47+
list(APPEND NAPI_LINK_LIBS ${MXML_LIBFILES})

cmake_include/Utilities.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,6 @@ function(find_module VAR )
218218
endif()
219219
set(${VAR}_INCLUDE_DIRS ${${VAR}_INCLUDE_DIRS} PARENT_SCOPE)
220220
set(${VAR}_LIBRARY_DIRS ${${VAR}_LIBRARY_DIRS} PARENT_SCOPE)
221+
set(${VAR}_LIBFILES ${${VAR}_LIBFILES} PARENT_SCOPE)
221222

222223
endfunction()

src/CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ endif (WIN32)
3737
# generate list of common source files
3838
#-----------------------------------------------------------------------------
3939
set (NAPISRC napi.c napiu.c nxstack.c nxstack.h stptok.c nxdataset.c
40+
napi_fortran_helper.c
4041
nxdataset.h nx_stptok.h)
4142

42-
if (ENABLE_FORTRAN90 OR ENABLE_FORTRAN77)
43-
set (NAPISRC ${NAPISRC} napi_fortran_helper.c)
44-
endif(ENABLE_FORTRAN90 OR ENABLE_FORTRAN77)
45-
4643
set (NAPILINK)
4744

4845
#-----------------------------------------------------------------------------
@@ -80,7 +77,7 @@ set_property(SOURCE ${NAPISRC} APPEND PROPERTY COMPILE_FLAGS ${NX_CFLAGS})
8077
add_library (NeXus_Static_Library STATIC ${NAPISRC})
8178

8279
set_target_properties(NeXus_Static_Library PROPERTIES
83-
OUTPUT_NAME NeXus)
80+
OUTPUT_NAME NeXus${STATIC_LIBRARY_SUFFIX})
8481

8582
target_link_libraries(NeXus_Static_Library ${NAPI_LINK_LIBS})
8683
#------------------------------------------------------------------------------
@@ -92,6 +89,10 @@ set_target_properties(NeXus_Shared_Library PROPERTIES
9289
OUTPUT_NAME NeXus
9390
VERSION ${ABI_VERSION}
9491
SOVERSION ${ABI_CURRENT})
92+
if(MSVC)
93+
set_target_properties(NeXus_Shared_Library PROPERTIES LINK_FLAGS
94+
"/DEF:\"${CMAKE_CURRENT_SOURCE_DIR}/NeXus.def\"")
95+
endif(MSVC)
9596

9697
target_link_libraries(NeXus_Shared_Library ${NAPI_LINK_LIBS})
9798

@@ -100,8 +101,9 @@ target_link_libraries(NeXus_Shared_Library ${NAPI_LINK_LIBS})
100101
# install the targets
101102
#-----------------------------------------------------------------------------
102103
install (TARGETS NeXus_Shared_Library
103-
DESTINATION ${CMAKE_INSTALL_LIBDIR}
104-
COMPONENT Runtime)
104+
RUNTIME DESTINATION ${NEXUS_INSTALL_SHLIB} COMPONENT Runtime
105+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
106+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development)
105107

106108
install (TARGETS NeXus_Static_Library
107109
DESTINATION ${CMAKE_INSTALL_LIBDIR}

src/NeXus.def

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
LIBRARY NeXus.dll
2+
EXPORTS
3+
NXIReportError
4+
NXIprintlink
5+
NXMDisableErrorReporting
6+
NXMEnableErrorReporting
7+
NXMGetError
8+
NXMSetError
9+
NXMSetTError
10+
createNXDataset
11+
createTextNXDataset
12+
dropNXDataset
13+
getNXDatasetByteLength
14+
getNXDatasetDim
15+
getNXDatasetLength
16+
getNXDatasetRank
17+
getNXDatasetText
18+
getNXDatasetType
19+
getNXDatasetValue
20+
getNXDatasetValueAt
21+
nxiclose_
22+
nxiclosedata_
23+
nxiclosegroup_
24+
nxicompmakedata_
25+
nxicompmakedata64_
26+
nxicompress_
27+
nxifclose_
28+
nxifcompmakedata_
29+
nxifcompress_
30+
nxifflush_
31+
nxiflush_
32+
nxifmakedata_
33+
nxifopen_
34+
nxifputattr_
35+
nxifree_
36+
nxigetattr_
37+
nxigetattrinfo_
38+
nxigetdata_
39+
nxigetdataid_
40+
nxigetgroupid_
41+
nxigetgroupinfo_
42+
nxigetrawinfo_
43+
nxigetrawinfo64_
44+
nxigetinfo_
45+
nxigetinfo64_
46+
nxigetnextattr_
47+
nxigetnextentry_
48+
nxigetslab_
49+
nxigetslab64_
50+
nxiinitattrdir_
51+
nxiinitgroupdir_
52+
nxiinquirefile_
53+
nxiisexternalgroup_
54+
nxilinkexternal_
55+
nximakedata_
56+
nximakedata64_
57+
nximakegroup_
58+
nximakelink_
59+
nximakenamedlink_
60+
nximalloc_
61+
nximalloc64_
62+
nxiopen_
63+
nxiopendata_
64+
nxiopengroup_
65+
nxiopengrouppath_
66+
nxiopenpath_
67+
nxiopensourcegroup_
68+
nxiputattr_
69+
nxiputdata_
70+
nxiputslab_
71+
nxiputslab64_
72+
nxisameid_
73+
nxisetcache_
74+
nxisetnumberformat_
75+
putNXDatasetValue
76+
putNXDatasetValueAt
77+
nxigetpath_
78+
nxilinkexternaldataset_
79+
nxiisexternaldataset_
80+
nxireopen_
81+
nxiputattra_
82+
nxigetnextattra_
83+
nxigetattra_
84+
nxigetattrainfo_

0 commit comments

Comments
 (0)