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

Add cmake build system #71

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ CMakeFiles
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
cmake_*

# Packages #
############
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "poco"]
path = poco
url = [email protected]:Bjoe/poco.git
branch = feature-hunter-support
72 changes: 72 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
cmake_minimum_required(VERSION 3.2.0)

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/Bjoe/hunter/archive/026b81652febb03e3e6e2519868dc59d84de2dfe.zip"
SHA1 "fac046931de6f4762f2d9d321494af8b00aba1bf"
LOCAL
)

project(macchina.io)

hunter_add_package(PocoCpp)

set(CMAKE_SKIP_RPATH TRUE)

# Read the version information from the VERSION file
file (STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION )
message(STATUS "macchina.io version: ${PACKAGE_VERSION}")
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION})
string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION})
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION})

set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})

# Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf
# directories. This simplifies manual testing and the use of the build
# tree rather than installed Boost libraries.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR})
# Windows DLLs are "runtime" for CMake. Output them to "bin" like the Visual Studio projects do.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR})

# Append our module directory to CMake
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/platform/OSP/cmake)

find_package(Poco REQUIRED Foundation Data Crypto JSON Net NetSSL Util XML Zip) # TODO(BJoe) Add support for CppUnit PageCompiler Redis
# Build third party libraries
#add_subdirectory(platform)
add_subdirectory(platform/Serial)
add_subdirectory(platform/WebTunnel)
add_subdirectory(platform/RemotingNG)
add_subdirectory(platform/Geo)
# add_subdirectory(platform/JS/V8) TODO(BJoe) Fix build error


# Build OSP
add_subdirectory(platform/OSP/BundleCreator)
add_subdirectory(platform/OSP)
add_subdirectory(platform/OSP/CodeCacheUtility)

# Build core bundles
add_subdirectory(platform/OSP/Core)
add_subdirectory(platform/OSP/Net)
add_subdirectory(platform/OSP/Web)

# Build sample
add_subdirectory(platform/OSP/samples/WebInfo)
add_subdirectory(platform/OSP/samples/ServiceListener)

add_subdirectory(launcher)
add_subdirectory(server)

add_dependencies(osp.core bundle)
add_dependencies(poco.net bundle)
add_dependencies(osp.web bundle)
add_dependencies(com.appinf.osp.samples.servicelistener bundle)

install(EXPORT OSP NAMESPACE Poco:: DESTINATION lib/cmake/macchina)
install(EXPORT Web NAMESPACE Poco::OSP:: DESTINATION lib/cmake/macchina)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/platform/OSP/cmake/MacchinaOSPConfig.cmake
DESTINATION lib/cmake/macchina)
21 changes: 21 additions & 0 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
hunter_config(PocoCpp VERSION 1.9.1
#GIT_SUBMODULE thirdparty/poco
CMAKE_ARGS
BUILD_SHARED_LIBS=ON
POCO_STATIC=OFF
ENABLE_MONGODB=OFF
ENABLE_PDF=OFF
ENABLE_DATA_MYSQL=OFF
ENABLE_DATA_POSTGRESQL=OFF
ENABLE_DATA_ODBC=OFF
ENABLE_SEVENZIP=OFF
ENABLE_APACHECONNECTOR=OFF
ENABLE_CPPPARSER=OFF
ENABLE_POCODOC=OFF
ENABLE_CRYPTO=ON
ENABLE_NETSSL=ON
ENABLE_DATA=ON
ENABLE_PAGECOMPILER=ON
ENABLE_CPPUNIT=ON # Needs support in Poco
ENABLE_TESTS=ON
)
Loading