Changeset: 1f75d7ad7674 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f75d7ad7674 Added Files: monetdb5/tools/monetdb.c Modified Files: CMakeLists.txt CMakeReadme.txt monetdb5/tools/CMakeLists.txt Branch: cmake-fun Log Message:
Added documentation for cmake generators used so far. Also made small fix for Xcode project build. diffs (159 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -752,7 +752,7 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "MinSizeRel flags" FORCE) set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "Release flags" FORCE) set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "RelWithDebugInfo flags" FORCE) -set(CMAKE_C_LINK_FLAGS "${LINK_OPTIONS}" CACHE STRING "Link flags for all builds" FORCE) # This variable is depreacted but still used +set(CMAKE_C_LINK_FLAGS "${LINK_OPTIONS}" CACHE STRING "Link flags for all builds" FORCE) # This variable is deprecated but still used set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" CACHE STRING "Shared library module link options for all builds" FORCE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "Shared library link options for all builds" FORCE) set(LINK_OPTIONS "${LINK_OPTIONS}" CACHE STRING "Link options for all builds" FORCE) diff --git a/CMakeReadme.txt b/CMakeReadme.txt --- a/CMakeReadme.txt +++ b/CMakeReadme.txt @@ -1,4 +1,4 @@ -Cmake 3.1 is required on Windows, On all other platforms, cmake 3.0 suffices. +cmake 3.7 is required on Windows (FindOpenSSL script), while on UNIX platforms cmake 3.0 suffices. On CentOS 6, enable epel repository, then install cmake3 package. While running the cmake command set internal variables to change the build properties in the form -D<var>=<value> @@ -15,6 +15,12 @@ CMAKE_MODULE_PATH - Location of custom C CMAKE_SHARED_LINKER_FLAGS - Linker options for shared libraries LINK_OPTIONS - Linker options for translation units for all builds +Available build types: +- Debug (default, use -DCMAKE_BUILD_TYPE=... to override) +- Release +- RelWithDebugInfo +- MinSizeRel (Release optimized for size) + - We set the library prefix variables on Windows compilation because we don't follow the naming convention there :( CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_PREFIX @@ -51,7 +57,8 @@ ENABLE_TESTING LOGDIR RUNDIR -PASSWORD_BACKEND +- Digest algorithm to use for mserver authentication messages +PASSWORD_BACKEND - MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384 or SHA512, defaults to SHA512 - Extra libraries WITH_BZ2 @@ -67,9 +74,83 @@ WITH_UUID WITH_VALGRIND WITH_ZLIB -Linux notes: - - libtools files are not generated yet. +What I tested so far: +- Linux with GCC 4.4.7 and Clang 3.4.2 with ENABLE_STRICT=NO. For newer versions of Clang and GCC I compiled +successfully with restrict flags. Tested on distributions Debian 8, Ubuntu 16.04, CentOS 6.10 and Fedora 30. +Also tested with Intel C++ Compiler 19. I generated both GNU make and ninja build files. +- FreeBSD 12 with GCC 8.3.0 and Clang 6.0.1. +- MacOS 10.13 with Apple Clang 10. +- Windows with Visual Studio 2015 (earliest version with enough C99 support). I tried "v140_clang_c2" toolset, but the +compiler crashed during compilation. I guess it's because of an earlier version of Clang (3.8). I tried the "LLVM_v140" +toolset with Clang 9.0.0 and compiled successfully with no restrictions. Some of the warnings triggered with +restrictions are compiler bugs, others we should ourselves. I didn't go further because we don't officially support +Clang on Windows. Also tested with Intel C++ Compiler 18 using "Intel C++ Compiler 18.0" toolset inside Cygwin. I +generated Visual Studio project files for every compiler plus nmake files and jom nmake files (for parallel builds) for +MSVC. + +I haven't built 32-bit binaries yet. +What I did NOT test (we don't support): +- Solaris +- Any other Unixes: AIX, HP-UX, IRIX, Minix... +- Cygwin +- MinGW and MinGW-w64 compilers on Windows + +Note that the install task depends on the build, so the build task will be executed if not so during the installation. +During generation phase, by default the current directory will be used to generate build files. Another directory can be +specified with the -B parameter. +------------------------------------------------------------------------------------------------------------------------ +--UNIX with default compiler (first found on PATH) and UNIX makefiles: +cmake -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +make -j<number of parallel builds> +make -j<number of parallel builds> install + +------------------------------------------------------------------------------------------------------------------------ +--UNIX with ninja generator and a compiler other than the default one: +cmake -G Ninja -DCMAKE_C_COMPILER=<path to compiler> -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +ninja -j<number of parallel builds> +ninja -j<number of parallel builds> install -We use CPack module to generate source tar files with compression. After cmake run: - cpack -G <generator> --config <path to compilation directory where CPackConfig.cmake is located> -For generators we use TBZ2 TGZ TXZ and ZIP. Check with 'cpack --help' for details. +------------------------------------------------------------------------------------------------------------------------ +--Xcode project +cmake -G Xcode -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +xcodebuild +cmake --build <compile dir> --target install + +------------------------------------------------------------------------------------------------------------------------ +--Visual Studio 2015 project using MSVC: +cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +cmake --build <compile dir> --target ALL_BUILD +cmake --build <compile dir> --target INSTALL + +------------------------------------------------------------------------------------------------------------------------ +--Visual Studio 2015 project with Intel compiler toolset that I used: +cmake -G "Visual Studio 14 2015 Win64" -T "Intel C++ Compiler 18.0" -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +cmake --build <compile dir> --target ALL_BUILD +cmake --build <compile dir> --target INSTALL + +------------------------------------------------------------------------------------------------------------------------ +--Visual Studio 2015 project with LLVM toolset that I used: +cmake -G "Visual Studio 14 2015 Win64" -T "LLVM_v140" -DCMAKE_INSTALL_PREFIX=<installation dir> -DENABLE_STRICT=NO <source dir> +cmake --build <compile dir> --target ALL_BUILD +cmake --build <compile dir> --target INSTALL + +------------------------------------------------------------------------------------------------------------------------ +--nmake (no Visual Studio files are generated, thus the generation is faster) +--The vcvarsall script must run first to set the path and environment variables for 64-bit build: +vcvarsall amd64 +cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +cmake --build <compile dir> --target all +cmake --build <compile dir> --target install + +------------------------------------------------------------------------------------------------------------------------ +--JOM is a adaptation of nmake from Qt to support parallel builds: https://wiki.qt.io/Jom +--The vcvarsall script must run first: +vcvarsall amd64 +cmake -G "NMake Makefiles JOM" -DCMAKE_INSTALL_PREFIX=<installation dir> <source dir> +cmake --build <compile dir> --target all -- -j<number of parallel builds> +cmake --build <compile dir> --target install + +------------------------------------------------------------------------------------------------------------------------ +--We use CPack module to generate source tar files with compression. After cmake run: +--For generators we use TBZ2 TGZ TXZ and ZIP. Check with 'cpack --help' for details. +cpack -G <generator> --config <path to compilation directory where CPackConfig.cmake file is located> diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt --- a/monetdb5/tools/CMakeLists.txt +++ b/monetdb5/tools/CMakeLists.txt @@ -15,7 +15,7 @@ if(WIN32) endif() endif() -add_library(monetdb5 SHARED ${MONETDB5_OBJECTS} libmonetdb5.rc) +add_library(monetdb5 SHARED ${MONETDB5_OBJECTS} monetdb.c libmonetdb5.rc) target_link_libraries(monetdb5 PUBLIC mutils mcrypt msabaoth PRIVATE ${MONETDB5_PRIVATE_LINK_LIBRARIES}) set_target_properties(monetdb5 PROPERTIES VERSION ${MONETDB5_VERSION} SOVERSION ${MONETDB5_VERSION_MAJOR}) diff --git a/monetdb5/tools/monetdb.c b/monetdb5/tools/monetdb.c new file mode 100644 --- /dev/null +++ b/monetdb5/tools/monetdb.c @@ -0,0 +1,9 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. + */ + +/* Xcode requires this extra file to compile monetdb5 target */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list