Skip to content

Commit 3ca451a

Browse files
authored
restructure native library (#130)
1 parent f882daa commit 3ca451a

File tree

13 files changed

+48
-38
lines changed

13 files changed

+48
-38
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ jobs:
8585
matrix:
8686
os: [ubuntu-18.04, windows-2019]
8787
python-version: [3.7, 3.8, 3.9]
88+
exclude:
89+
- os: ubuntu-18.04
90+
python-version: 3.7
8891
timeout-minutes: 20
8992

9093
steps:

pythonfmu/pythonfmu-export/CMakeLists.txt

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,6 @@ if (WIN32)
4040
set(Python3_LIBRARIES ${Python3_LIBRARY_DIRS}/python3.lib)
4141
endif ()
4242

43-
# ==============================================================================
44-
# Sources
45-
# ==============================================================================
46-
47-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/headers)
48-
49-
set(sources
50-
cpp/cppfmu_cs.cpp
51-
cpp/fmi_functions.cpp
52-
cpp/PySlaveInstance.cpp
53-
)
54-
55-
add_library(pythonfmu-export ${sources})
56-
target_compile_features(pythonfmu-export PUBLIC "cxx_std_17")
57-
target_include_directories(pythonfmu-export
58-
PUBLIC
59-
"$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>"
60-
"${Python3_INCLUDE_DIRS}"
61-
PRIVATE
62-
"${CMAKE_CURRENT_SOURCE_DIR}"
63-
)
64-
65-
target_link_libraries(pythonfmu-export
66-
PRIVATE
67-
${Python3_LIBRARIES}
68-
)
69-
7043
if (WIN32)
7144
set(TARGET_PLATFORM win)
7245
elseif (APPLE)
@@ -83,14 +56,4 @@ endif ()
8356

8457
message("Building pythonfmu-export for platform ${TARGET_PLATFORM}")
8558

86-
if (WIN32)
87-
set_target_properties(pythonfmu-export
88-
PROPERTIES
89-
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../resources/binaries/${TARGET_PLATFORM}"
90-
)
91-
else ()
92-
set_target_properties(pythonfmu-export
93-
PROPERTIES
94-
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../resources/binaries/${TARGET_PLATFORM}"
95-
)
96-
endif ()
59+
add_subdirectory(src)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
set(headers
3+
cppfmu/cppfmu_cs.hpp
4+
cppfmu/cppfmu_common.hpp
5+
6+
fmi/fmi2Functions.h
7+
fmi/fmi2FunctionTypes.h
8+
fmi/fmi2TypesPlatform.h
9+
10+
pythonfmu/PySlaveInstance.hpp
11+
pythonfmu/PyState.hpp
12+
)
13+
14+
set(sources
15+
cppfmu/cppfmu_cs.cpp
16+
cppfmu/fmi_functions.cpp
17+
pythonfmu/PySlaveInstance.cpp
18+
)
19+
20+
add_library(pythonfmu-export ${sources} ${headers})
21+
target_compile_features(pythonfmu-export PUBLIC "cxx_std_17")
22+
23+
target_include_directories(pythonfmu-export
24+
PRIVATE
25+
"${Python3_INCLUDE_DIRS}"
26+
"${CMAKE_CURRENT_SOURCE_DIR}"
27+
)
28+
29+
target_link_libraries(pythonfmu-export
30+
PRIVATE
31+
${Python3_LIBRARIES}
32+
)
33+
34+
if (WIN32)
35+
set_target_properties(pythonfmu-export
36+
PROPERTIES
37+
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/../resources/binaries/${TARGET_PLATFORM}"
38+
)
39+
else ()
40+
set_target_properties(pythonfmu-export
41+
PROPERTIES
42+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/../resources/binaries/${TARGET_PLATFORM}"
43+
)
44+
endif ()

pythonfmu/pythonfmu-export/headers/cppfmu/cppfmu_common.hpp renamed to pythonfmu/pythonfmu-export/src/cppfmu/cppfmu_common.hpp

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

pythonfmu/pythonfmu-export/headers/fmi/fmi2FunctionTypes.h renamed to pythonfmu/pythonfmu-export/src/fmi/fmi2FunctionTypes.h

File renamed without changes.
File renamed without changes.

pythonfmu/pythonfmu-export/headers/fmi/fmi2TypesPlatform.h renamed to pythonfmu/pythonfmu-export/src/fmi/fmi2TypesPlatform.h

File renamed without changes.

0 commit comments

Comments
 (0)