Skip to content

Commit fdc0294

Browse files
committed
add visibility.h
1 parent 93c4228 commit fdc0294

File tree

9 files changed

+66
-20
lines changed

9 files changed

+66
-20
lines changed

api/iceberg/puffin.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
#include <memory>
2323
#include <string_view>
2424

25+
#include "iceberg/visibility.h"
26+
2527
namespace iceberg {
2628

27-
class Puffin {
29+
class ICEBERG_EXPORT Puffin {
2830
public:
2931
virtual ~Puffin() = default;
3032
virtual std::string_view print() const = 0;

api/iceberg/table.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
#include <memory>
2323
#include <string_view>
2424

25+
#include "iceberg/visibility.h"
26+
2527
namespace iceberg {
2628

27-
class Table {
29+
class ICEBERG_EXPORT Table {
2830
public:
2931
virtual ~Table() = default;
3032
virtual std::string_view print() const = 0;

api/iceberg/visibility.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#pragma once
21+
22+
#if defined(_WIN32) || defined(__CYGWIN__)
23+
# ifdef ICEBERG_STATIC
24+
# define ICEBERG_EXPORT
25+
# else
26+
# ifdef ICEBERG_EXPORTING
27+
# define ICEBERG_EXPORT __declspec(dllexport)
28+
# else
29+
# define ICEBERG_EXPORT __declspec(dllimport)
30+
# endif
31+
# endif
32+
#else
33+
# define ICEBERG_EXPORT
34+
#endif

src/arrow/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ add_iceberg_lib(iceberg_arrow
7373
${ICEBERG_ARROW_SHARED_INSTALL_INTERFACE_LIBS})
7474

7575
if(ICEBERG_BUILD_STATIC AND WIN32)
76-
target_compile_definitions(iceberg_arrow_static PUBLIC ICEBERG_ARROW_STATIC)
76+
target_compile_definitions(iceberg_arrow_static PUBLIC ICEBERG_STATIC)
7777
endif()
7878

7979
foreach(LIB_TARGET ${ICEBERG_ARROW_LIBRARIES})
80-
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_ARROW_EXPORTING)
80+
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING)
8181
endforeach()
8282

8383
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/demo_arrow.h"

src/arrow/demo_arrow.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,11 @@
2121

2222
#include <string>
2323

24-
#ifdef _WIN32
25-
# ifdef ICEBERG_ARROW_STATIC
26-
# define ICEBERG_ARROW_EXPORT
27-
# else
28-
# ifdef ICEBERG_ARROW_EXPORTING
29-
# define ICEBERG_ARROW_EXPORT __declspec(dllexport)
30-
# else
31-
# define ICEBERG_ARROW_EXPORT __declspec(dllimport)
32-
# endif
33-
# endif
34-
#else
35-
# define ICEBERG_ARROW_EXPORT
36-
#endif
24+
#include "iceberg/visibility.h"
3725

3826
namespace iceberg::arrow {
3927

40-
class ICEBERG_ARROW_EXPORT DemoArrow {
28+
class ICEBERG_EXPORT DemoArrow {
4129
public:
4230
std::string print() const;
4331
};

src/core/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,15 @@ set(ICEBERG_CORE_INCLUDES "${ICEBERG_API_DIR}")
2121
add_iceberg_lib(iceberg_core
2222
SOURCES
2323
${ICEBERG_CORE_SOURCES}
24+
OUTPUTS
25+
ICEBERG_CORE_LIBRARIES
2426
PRIVATE_INCLUDES
2527
${ICEBERG_CORE_INCLUDES})
28+
29+
if(ICEBERG_BUILD_STATIC AND WIN32)
30+
target_compile_definitions(iceberg_core_static PUBLIC ICEBERG_STATIC)
31+
endif()
32+
33+
foreach(LIB_TARGET ${ICEBERG_CORE_LIBRARIES})
34+
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING)
35+
endforeach()

src/core/demo_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace iceberg {
2525

26-
class DemoTable : public Table {
26+
class ICEBERG_EXPORT DemoTable : public Table {
2727
public:
2828
DemoTable() = default;
2929
~DemoTable() override = default;

src/puffin/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,15 @@ set(ICEBERG_PUFFIN_INCLUDES "${ICEBERG_API_DIR}")
2121
add_iceberg_lib(iceberg_puffin
2222
SOURCES
2323
${ICEBERG_PUFFIN_SOURCES}
24+
OUTPUTS
25+
ICEBERG_PUFFIN_LIBRARIES
2426
PRIVATE_INCLUDES
2527
${ICEBERG_PUFFIN_INCLUDES})
28+
29+
if(ICEBERG_BUILD_STATIC AND WIN32)
30+
target_compile_definitions(iceberg_puffin_static PUBLIC ICEBERG_STATIC)
31+
endif()
32+
33+
foreach(LIB_TARGET ${ICEBERG_PUFFIN_LIBRARIES})
34+
target_compile_definitions(${LIB_TARGET} PRIVATE ICEBERG_EXPORTING)
35+
endforeach()

src/puffin/demo_puffin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace iceberg {
2525

26-
class DemoPuffin : public Puffin {
26+
class ICEBERG_EXPORT DemoPuffin : public Puffin {
2727
public:
2828
DemoPuffin() = default;
2929
~DemoPuffin() override = default;

0 commit comments

Comments
 (0)