Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.
Open
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
34 changes: 15 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

# Turn on GPOS_DEBUG define for DEBUG builds.
if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(GPOS_DEBUG 1)
endif()

# Override CMAKE_SYSTEM_PROCESSOR if it has been explicitly set in a toolchain file.
if (FORCED_CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${FORCED_CMAKE_SYSTEM_PROCESSOR})
Expand Down Expand Up @@ -102,19 +107,6 @@ if (COMPILER_HAS_FNO_OMIT_FRAME_POINTER)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
endif()

# Turn on GPOS_DEBUG define for DEBUG builds.
cmake_policy(SET CMP0043 NEW)
set_property(
DIRECTORY
APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:GPOS_DEBUG>)

# Turn on platform-specific defines.
set_property(
DIRECTORY
APPEND PROPERTY COMPILE_DEFINITIONS
GPOS_${CMAKE_SYSTEM_NAME}
GPOS_${CMAKE_SYSTEM_PROCESSOR})

# Autodetect bit-width if not already set by toolchain file.
if (NOT GPOS_ARCH_BITS)
# Autodetect bit-width.
Expand All @@ -133,11 +125,6 @@ if (NOT GPOS_ARCH_BITS)
endif()
endif()

set_property(
DIRECTORY
APPEND PROPERTY COMPILE_DEFINITIONS
GPOS_${GPOS_ARCH_BITS}BIT)

# Need pthreads.
find_package(Threads REQUIRED)
if (NOT CMAKE_USE_PTHREADS_INIT)
Expand All @@ -158,9 +145,14 @@ endif()

include_directories(libgpos/include)

# Generate version-number header.
# Generate version-number and config headers.
configure_file(version.h.in
${PROJECT_BINARY_DIR}/libgpos/include/gpos/version.h)
configure_file(config.h.in
${PROJECT_BINARY_DIR}/libgpos/include/gpos/config.h)

# Make the generated header files available at compilation of libgpos itself.
include_directories(${PROJECT_BINARY_DIR}/libgpos/include/)

# Compile .cpp source files under libgpos/src into monolithic gpos library.
add_library(gpos
Expand Down Expand Up @@ -432,12 +424,16 @@ if (VERBOSE_INSTALL_PATH)
install(DIRECTORY libgpos/include/gpos DESTINATION "${installpath}/include")
install(FILES "${PROJECT_BINARY_DIR}/libgpos/include/gpos/version.h"
DESTINATION "${installpath}/include/gpos")
install(FILES "${PROJECT_BINARY_DIR}/libgpos/include/gpos/config.h"
DESTINATION "${installpath}/include/gpos")
else()
get_filename_component(full_install_name_dir "${CMAKE_INSTALL_PREFIX}/lib" ABSOLUTE)
install(TARGETS gpos DESTINATION lib)
install(DIRECTORY libgpos/include/gpos DESTINATION include)
install(FILES "${PROJECT_BINARY_DIR}/libgpos/include/gpos/version.h"
DESTINATION include/gpos)
install(FILES "${PROJECT_BINARY_DIR}/libgpos/include/gpos/config.h"
DESTINATION include/gpos)
endif()

# Mac OS X handles searching for dynamic libraries differently from other
Expand Down
26 changes: 26 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2016 Greenplum, Inc.
//
// @filename:
// config.h
//
// @doc:
// Various compile-time options that affect binary
// compatibility.
//
//---------------------------------------------------------------------------
#ifndef GPOS_config_H
#define GPOS_config_H

#cmakedefine GPOS_DEBUG 1

// Thes comes from CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR
#define GPOS_${CMAKE_SYSTEM_NAME} 1
#define GPOS_${CMAKE_SYSTEM_PROCESSOR} 1

// This comes from GPOS_ARCH_BITS (based on CMAKE_SIZEOF_VOID_P)
#define GPOS_${GPOS_ARCH_BITS}BIT 1

#endif // GPOS_config_H
// EOF
2 changes: 2 additions & 0 deletions libgpos/include/gpos/_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef GPOS_api_H
#define GPOS_api_H

#include "gpos/config.h"

#ifdef __cplusplus
extern "C"
{
Expand Down
1 change: 1 addition & 0 deletions libgpos/include/gpos/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#ifndef GPOS_assert_H
#define GPOS_assert_H

#include "gpos/config.h"

// retail assert; available in all builds
#define GPOS_RTL_ASSERT(x) ((x) ? ((void)0) : \
Expand Down