Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes conan build, adds documentation for this option #779

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ These two scripts build EPANET binaries for both the 32 and 64 bit Windows platf

A tutorial on [building OWA EPANET from source on Windows](tools/BuildAndTest.md), including running unit tests and performing regression testing, is also avaiable.

## Alternative build with Conan
Conan is an increasingly popular C/C++ package management suite. To build EPANET using Conan, use the following commands as a starting point:

```
conan build . -s build_type=Release
conan export-pkg . -s build_type=Release
```


# Testing

Unit tests have been written using the Boost Unit Testing Framework and other Boost libraries. The tests are compiled into individual executables that automatically perform checks on the EPANET toolkit and output libraries.
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ project(EPANET)
# Append local dir to module search path
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(BUILD_TESTS "Build tests (requires Boost)" OFF)
option(BUILD_PY_LIB "Build library for Python wrapper" OFF)
option(BUILD_COVERAGE "Build library for coverage" OFF)


IF (NOT BUILD_PY_LIB)
add_subdirectory(run)
ENDIF (NOT BUILD_PY_LIB)
Expand Down Expand Up @@ -96,7 +96,15 @@ IF(MSVC AND "${CMAKE_VS_PLATFORM_NAME}" MATCHES "(Win32)")
add_library(epanet2 SHARED ${EPANET_LIB_ALL} ${PROJECT_SOURCE_DIR}/include/epanet2.def)
set_source_files_properties(${PROJECT_SOURCE_DIR}/include/epanet2.def PROPERTIES_HEADER_FILE_ONLY TRUE)
ELSE(TRUE)
add_library(epanet2 SHARED ${EPANET_LIB_ALL})
add_library(epanet2 ${EPANET_LIB_ALL})
ENDIF(MSVC AND "${CMAKE_VS_PLATFORM_NAME}" MATCHES "(Win32)")

target_include_directories(epanet2 PUBLIC ${PROJECT_SOURCE_DIR}/include)

install(TARGETS epanet2 DESTINATION lib)
install(FILES ./include/epanet2.h DESTINATION include)
install(FILES ./include/epanet2_2.h DESTINATION include)
install(FILES ./include/epanet2_enums.h DESTINATION include)
install(DIRECTORY ./src/ DESTINATION include FILES_MATCHING PATTERN "*.h")


11 changes: 4 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conans import ConanFile
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout

class EpanetConan(ConanFile):
Expand Down Expand Up @@ -33,13 +33,10 @@ def build(self):
cmake.build()

def package(self):
self.copy("lib/libepanet2.dylib", "lib", keep_path=False)
self.copy("lib/libepanet-output.dylib", "lib", keep_path=False)
self.copy("*.h", "include", "include", keep_path=False)
self.copy("types.h", "include", "src", keep_path=False)
self.copy("hash.h", "include", "src", keep_path=False)
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libdirs = ["lib"]
self.cpp_info.libs = ["epanet2", "epanet-output"]
self.cpp_info.libs = ["epanet2"]
self.cpp_info.includedirs = ["include"]
Loading