Skip to content

Commit f16a695

Browse files
committed
preparation for export headers
1 parent 1846cd8 commit f16a695

File tree

3 files changed

+71
-49
lines changed

3 files changed

+71
-49
lines changed

CMakeLists.txt

+22-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ cmake_minimum_required (VERSION 2.8.11)
22

33
project(libmsym C)
44

5+
# EXPORT HEADER
6+
#project(libmsym)
7+
#include (GenerateExportHeader)
8+
59
set(LIBMSYM_MAJOR_VERSION 0)
610
set(LIBMSYM_MINOR_VERSION 2)
711
set(LIBMSYM_PATCH_VERSION 0)
@@ -28,10 +32,23 @@ include_directories("${PROJECT_SOURCE_DIR}")
2832

2933
file (GLOB source src/*.c)
3034
add_library (msym ${source})
35+
3136
if (BUILD_SHARED_LIBS)
32-
set_target_properties (msym PROPERTIES
33-
POSITION_INDEPENDENT_CODE "TRUE")
37+
set_target_properties (msym PROPERTIES
38+
POSITION_INDEPENDENT_CODE "TRUE")
39+
# EXPORT HEADER
40+
# set(CMAKE_C_VISIBILITY_PRESET hidden)
41+
# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
3442
endif ()
43+
44+
# EXPORT HEADER
45+
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
46+
#generate_export_header(msym
47+
# BASE_NAME msym
48+
# EXPORT_MACRO_NAME MSYM_EXPORT
49+
# EXPORT_FILE_NAME msym_EXPORTS.h
50+
# STATIC_DEFINE MSYM_EXPORTS_BUILT_AS_STATIC)
51+
3552
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
3653
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -DLIBMSYM_DEBUG")
3754
#set_target_properties (msym PROPERTIES
@@ -56,6 +73,9 @@ install(FILES
5673
"${PROJECT_BINARY_DIR}/libmsymConfigVersion.cmake"
5774
DESTINATION "${INSTALL_CMAKE_DIR}")
5875

76+
# EXPORT HEADER
77+
#install(FILES "${PROJECT_BINARY_DIR}/msym_EXPORTS.h" DESTINATION "${INSTALL_INCLUDE_DIR}/libmsym")
78+
5979
install(TARGETS msym
6080
EXPORT libmsymTargets
6181
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"

libmsymConfig.cmake.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ if(NOT TARGET msym AND NOT LIBMSYM_BINARY_DIR)
1010
include("${LIBMSYM_CMAKE_DIR}/libmsymTargets.cmake")
1111
endif()
1212

13-
# These are IMPORTED targets created by FooBarTargets.cmake
13+
# These are IMPORTED targets created by libmsymTargets.cmake
1414
set(LIBMSYM_LIBRARIES msym)

src/msym.h

+48-46
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#ifdef __cplusplus
1515
extern "C" {
1616
#endif
17-
17+
18+
//#include "msym_EXPORTS.h" // automatically generated by cmake
19+
#define MSYM_EXPORT
1820
#include "msym_error.h"
1921

2022
typedef struct _msym_context * msym_context;
@@ -160,55 +162,55 @@ extern "C" {
160162
} msym_character_table_t;
161163

162164

163-
msym_context msymCreateContext();
164-
msym_error_t msymReleaseContext(msym_context ctx);
165-
166-
const msym_thresholds_t *msymGetDefaultThresholds();
167-
msym_error_t msymSetThresholds(msym_context ctx, const msym_thresholds_t *thresholds);
168-
msym_error_t msymGetThresholds(msym_context ctx, const msym_thresholds_t **thresholds);
169-
msym_error_t msymSetElements(msym_context ctx, int length, msym_element_t *elements);
170-
msym_error_t msymGetElements(msym_context ctx, int *length, msym_element_t **elements);
171-
msym_error_t msymSetBasisFunctions(msym_context ctx, int length, msym_basis_function_t *basis);
172-
msym_error_t msymGetBasisFunctions(msym_context ctx, int *length, msym_basis_function_t **basis);
173-
msym_error_t msymGetPointGroupType(msym_context ctx, msym_point_group_type_t *t, int *n);
174-
msym_error_t msymSetPointGroupByName(msym_context ctx, const char *name);
175-
msym_error_t msymSetPointGroupByType(msym_context ctx, msym_point_group_type_t type, int n);
176-
msym_error_t msymGetPointGroupName(msym_context ctx, int l, char *buf);
177-
msym_error_t msymGetSubgroups(msym_context ctx, int *l, const msym_subgroup_t **subgroups);
178-
msym_error_t msymSelectSubgroup(msym_context ctx, const msym_subgroup_t *subgroup);
179-
msym_error_t msymGetSymmetryOperations(msym_context ctx, int *sopsl, const msym_symmetry_operation_t **sops);
180-
msym_error_t msymGetEquivalenceSets(msym_context ctx, int *l, const msym_equivalence_set_t **es);
181-
msym_error_t msymGetSubrepresentationSpaces(msym_context ctx, int *l, const msym_subrepresentation_space_t **srs);
182-
msym_error_t msymGetCharacterTable(msym_context ctx, const msym_character_table_t **ct);
183-
184-
msym_error_t msymFindEquivalenceSets(msym_context ctx);
185-
msym_error_t msymFindEquivalenceSetPermutations(msym_context ctx);
186-
msym_error_t msymFindSymmetry(msym_context ctx);
187-
msym_error_t msymSymmetrizeElements(msym_context context, double *err);
188-
msym_error_t msymApplyTranslation(msym_context ctx, msym_element_t *element, double v[3]);
165+
msym_context MSYM_EXPORT msymCreateContext();
166+
msym_error_t MSYM_EXPORT msymReleaseContext(msym_context ctx);
167+
168+
const msym_thresholds_t MSYM_EXPORT *msymGetDefaultThresholds();
169+
msym_error_t MSYM_EXPORT msymSetThresholds(msym_context ctx, const msym_thresholds_t *thresholds);
170+
msym_error_t MSYM_EXPORT msymGetThresholds(msym_context ctx, const msym_thresholds_t **thresholds);
171+
msym_error_t MSYM_EXPORT msymSetElements(msym_context ctx, int length, msym_element_t *elements);
172+
msym_error_t MSYM_EXPORT msymGetElements(msym_context ctx, int *length, msym_element_t **elements);
173+
msym_error_t MSYM_EXPORT msymSetBasisFunctions(msym_context ctx, int length, msym_basis_function_t *basis);
174+
msym_error_t MSYM_EXPORT msymGetBasisFunctions(msym_context ctx, int *length, msym_basis_function_t **basis);
175+
msym_error_t MSYM_EXPORT msymGetPointGroupType(msym_context ctx, msym_point_group_type_t *t, int *n);
176+
msym_error_t MSYM_EXPORT msymSetPointGroupByName(msym_context ctx, const char *name);
177+
msym_error_t MSYM_EXPORT msymSetPointGroupByType(msym_context ctx, msym_point_group_type_t type, int n);
178+
msym_error_t MSYM_EXPORT msymGetPointGroupName(msym_context ctx, int l, char *buf);
179+
msym_error_t MSYM_EXPORT msymGetSubgroups(msym_context ctx, int *l, const msym_subgroup_t **subgroups);
180+
msym_error_t MSYM_EXPORT msymSelectSubgroup(msym_context ctx, const msym_subgroup_t *subgroup);
181+
msym_error_t MSYM_EXPORT msymGetSymmetryOperations(msym_context ctx, int *sopsl, const msym_symmetry_operation_t **sops);
182+
msym_error_t MSYM_EXPORT msymGetEquivalenceSets(msym_context ctx, int *l, const msym_equivalence_set_t **es);
183+
msym_error_t MSYM_EXPORT msymGetSubrepresentationSpaces(msym_context ctx, int *l, const msym_subrepresentation_space_t **srs);
184+
msym_error_t MSYM_EXPORT msymGetCharacterTable(msym_context ctx, const msym_character_table_t **ct);
185+
186+
msym_error_t MSYM_EXPORT msymFindEquivalenceSets(msym_context ctx);
187+
msym_error_t MSYM_EXPORT msymFindEquivalenceSetPermutations(msym_context ctx);
188+
msym_error_t MSYM_EXPORT msymFindSymmetry(msym_context ctx);
189+
msym_error_t MSYM_EXPORT msymSymmetrizeElements(msym_context context, double *err);
190+
msym_error_t MSYM_EXPORT msymApplyTranslation(msym_context ctx, msym_element_t *element, double v[3]);
189191
#ifdef __cplusplus
190-
msym_error_t msymSymmetrizeWavefunctions(msym_context ctx, int l, void *c, int *species, msym_partner_function_t *pf);
191-
msym_error_t msymGetSALCs(msym_context ctx, int l, void *c, int *species, msym_partner_function_t *pf);
192+
msym_error_t MSYM_EXPORT msymSymmetrizeWavefunctions(msym_context ctx, int l, void *c, int *species, msym_partner_function_t *pf);
193+
msym_error_t MSYM_EXPORT msymGetSALCs(msym_context ctx, int l, void *c, int *species, msym_partner_function_t *pf);
192194

193195
#else
194-
msym_error_t msymSymmetrizeWavefunctions(msym_context ctx, int l, double c[l][l], int species[l], msym_partner_function_t pf[l]);
195-
msym_error_t msymGetSALCs(msym_context ctx, int l, double c[l][l], int species[l], msym_partner_function_t pf[l]);
196+
msym_error_t MSYM_EXPORT msymSymmetrizeWavefunctions(msym_context ctx, int l, double c[l][l], int species[l], msym_partner_function_t pf[l]);
197+
msym_error_t MSYM_EXPORT msymGetSALCs(msym_context ctx, int l, double c[l][l], int species[l], msym_partner_function_t pf[l]);
196198
#endif
197-
msym_error_t msymSymmetrySpeciesComponents(msym_context ctx, int wfl, double *wf, int sl, double *s);
198-
msym_error_t msymGenerateElements(msym_context ctx, int length, msym_element_t *elements);
199-
msym_error_t msymGenerateSubrepresentationSpaces(msym_context ctx);
200-
msym_error_t msymAlignAxes(msym_context ctx);
201-
202-
msym_error_t msymGetCenterOfMass(msym_context ctx, double v[3]);
203-
msym_error_t msymSetCenterOfMass(msym_context ctx, double v[3]);
204-
msym_error_t msymGetRadius(msym_context ctx, double *radius);
205-
msym_error_t msymGetGeometry(msym_context ctx, msym_geometry_t *geometry);
206-
msym_error_t msymGetPrincipalMoments(msym_context ctx, double eigval[3]);
207-
msym_error_t msymGetPrincipalAxes(msym_context ctx, double eigvec[3][3]);
208-
msym_error_t msymGetAlignmentAxes(msym_context ctx, double primary[3], double secondary[3]);
209-
msym_error_t msymSetAlignmentAxes(msym_context ctx, double primary[3], double secondary[3]);
210-
msym_error_t msymGetAlignmentTransform(msym_context ctx, double transform[3][3]);
211-
msym_error_t msymSetAlignmentTransform(msym_context ctx, double transform[3][3]);
199+
msym_error_t MSYM_EXPORT msymSymmetrySpeciesComponents(msym_context ctx, int wfl, double *wf, int sl, double *s);
200+
msym_error_t MSYM_EXPORT msymGenerateElements(msym_context ctx, int length, msym_element_t *elements);
201+
msym_error_t MSYM_EXPORT msymGenerateSubrepresentationSpaces(msym_context ctx);
202+
msym_error_t MSYM_EXPORT msymAlignAxes(msym_context ctx);
203+
204+
msym_error_t MSYM_EXPORT msymGetCenterOfMass(msym_context ctx, double v[3]);
205+
msym_error_t MSYM_EXPORT msymSetCenterOfMass(msym_context ctx, double v[3]);
206+
msym_error_t MSYM_EXPORT msymGetRadius(msym_context ctx, double *radius);
207+
msym_error_t MSYM_EXPORT msymGetGeometry(msym_context ctx, msym_geometry_t *geometry);
208+
msym_error_t MSYM_EXPORT msymGetPrincipalMoments(msym_context ctx, double eigval[3]);
209+
msym_error_t MSYM_EXPORT msymGetPrincipalAxes(msym_context ctx, double eigvec[3][3]);
210+
msym_error_t MSYM_EXPORT msymGetAlignmentAxes(msym_context ctx, double primary[3], double secondary[3]);
211+
msym_error_t MSYM_EXPORT msymSetAlignmentAxes(msym_context ctx, double primary[3], double secondary[3]);
212+
msym_error_t MSYM_EXPORT msymGetAlignmentTransform(msym_context ctx, double transform[3][3]);
213+
msym_error_t MSYM_EXPORT msymSetAlignmentTransform(msym_context ctx, double transform[3][3]);
212214

213215
#ifdef __cplusplus
214216
}

0 commit comments

Comments
 (0)