Skip to content

Commit

Permalink
Fix CFP linkage on WIN32, update examples/diffusionC to use CFP_NAMES…
Browse files Browse the repository at this point in the history
…PACE, examples/iterator to compile with MSVC, bump Appveyor build-version
  • Loading branch information
salasoom committed Oct 2, 2018
1 parent 966603e commit fd28cef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.5.3-{build}
version: 0.5.4-{build}

environment:
matrix:
Expand Down
13 changes: 12 additions & 1 deletion cfp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
add_library(cfp cfparrays.cpp)

if(DEFINED CFP_NAMESPACE)
target_compile_definitions(cfp PUBLIC "CFP_NAMESPACE=${CFP_NAMESPACE}")
list(APPEND cfp_public_defs "CFP_NAMESPACE=${CFP_NAMESPACE}")
endif()

if(WIN32)
# define ZFP_SOURCE when compiling libcfp to export symbols to Windows DLL
list(APPEND cfp_private_defs ZFP_SOURCE)
endif()

target_compile_definitions(cfp
PUBLIC ${cfp_public_defs}
PRIVATE ${cfp_private_defs})

target_include_directories(cfp
PUBLIC
${ZFP_SOURCE_DIR}/include
Expand Down
2 changes: 1 addition & 1 deletion cfp/src/cfparrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "cfparray3f.cpp"
#include "cfparray3d.cpp"

const cfp_api CFP_NAMESPACE = {
export_ const cfp_api CFP_NAMESPACE = {
// array1f
{
cfp_array1f_ctor_default,
Expand Down
2 changes: 1 addition & 1 deletion examples/diffusionC.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <math.h>

#include "cfparrays.h"
#define _ (cfp.array2d)
#define _ (CFP_NAMESPACE.array2d)

#define MAX(x, y) (((nx) > (ny)) ? (nx) : (ny))

Expand Down
2 changes: 1 addition & 1 deletion examples/iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main()
zfp::array1<double> v(10, 64.0);
// initialize and print array of random values
for (zfp::array1<double>::iterator p = v.begin(); p != v.end(); p++)
*p = drand48();
*p = rand();
std::cout << "random array" << std::endl;
print1(&v[0], v.size());
std::cout << std::endl;
Expand Down

0 comments on commit fd28cef

Please sign in to comment.