Changeset: bc4b4ad03ac5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc4b4ad03ac5
Removed Files:
        monetdb5/tools/monetdb.c
Modified Files:
        clients/mapilib/CMakeLists.txt
        common/stream/CMakeLists.txt
        gdk/CMakeLists.txt
        monetdb5/CMakeLists.txt
        monetdb5/extras/mal_optimizer_template/CMakeLists.txt
        monetdb5/mal/CMakeLists.txt
        monetdb5/modules/atoms/CMakeLists.txt
        monetdb5/modules/kernel/CMakeLists.txt
        monetdb5/modules/mal/CMakeLists.txt
        monetdb5/optimizer/CMakeLists.txt
        monetdb5/scheduler/CMakeLists.txt
        monetdb5/tools/CMakeLists.txt
        sql/backends/monet5/CMakeLists.txt
        sql/backends/monet5/generator/CMakeLists.txt
        tools/mserver/CMakeLists.txt
Branch: cmake-fun
Log Message:

Simplify libmonetdb5 compilation by compiling and linking all source files at 
once instead of linking static libraries. The later option is not portable 
across platforms, which requires specific hacks.


diffs (truncated from 536 to 300 lines):

diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt
--- a/clients/mapilib/CMakeLists.txt
+++ b/clients/mapilib/CMakeLists.txt
@@ -8,25 +8,10 @@
 
 include_directories(../../common/options ../../common/stream 
../../common/utils ${CRYPTO_INCLUDE_DIR})
 
-set(MAPI_OBJECTS mapi.c)
-set(MAPI_LIBRARIES ${SOCKET_LIBRARIES} ${CRYPTO_LIBRARIES} moptions mcrypt 
stream)
-
-if(MSVC)
-       add_library(mapi STATIC ${MAPI_OBJECTS})
-       target_link_libraries(mapi PRIVATE ${MAPI_LIBRARIES})
-
-       add_library(mapishared SHARED ${MAPI_OBJECTS})
-       target_link_libraries(mapishared PRIVATE ${MAPI_LIBRARIES})
-       set_target_properties(mapishared PROPERTIES OUTPUT_NAME mapi)
-       target_compile_definitions(mapishared PRIVATE LIBMAPI)
-
-       install(TARGETS mapishared LIBRARY DESTINATION ${LIBDIR})
-else()
-       add_library(mapi SHARED ${MAPI_OBJECTS})
-       target_link_libraries(mapi PRIVATE ${MAPI_LIBRARIES})
-       set_target_properties(mapi PROPERTIES VERSION ${MAPI_VERSION} SOVERSION 
${MAPI_VERSION_MAJOR})
-       target_compile_definitions(mapi PRIVATE LIBMAPI)
-endif()
+add_library(mapi SHARED mapi.c)
+target_link_libraries(mapi PRIVATE ${SOCKET_LIBRARIES} ${CRYPTO_LIBRARIES} 
moptions mcrypt stream)
+set_target_properties(mapi PROPERTIES VERSION ${MAPI_VERSION} SOVERSION 
${MAPI_VERSION_MAJOR})
+target_compile_definitions(mapi PRIVATE LIBMAPI)
 
 install(TARGETS mapi DESTINATION ${LIBDIR})
 install(FILES mapi.h DESTINATION ${INCLUDEDIR}/monetdb)
diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt
--- a/common/stream/CMakeLists.txt
+++ b/common/stream/CMakeLists.txt
@@ -9,28 +9,13 @@
 include_directories(${ZLIB_INCLUDE_DIR} ${BZIP2_INCLUDE_DIR} 
${SNAPPY_INCLUDE_DIR} ${LZ4_INCLUDE_DIR}
                                        ${LIBLZMA_INCLUDE_DIR} 
${CURL_INCLUDE_DIR} ${ICONV_INCLUDE_DIR})
 
-set(STREAM_OBJECTS stream.c stream.h stream_socket.h)
-set(STREAM_LIBRARIES ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${SNAPPY_LIBRARIES} 
${LZ4_LIBRARIES} ${LIBLZMA_LIBRARIES}
-                                        ${CURL_LIBRARIES} ${ICONV_LIBRARIES} 
${SOCKET_LIBRARIES})
-
-if(MSVC)
-       add_library(stream STATIC ${STREAM_OBJECTS})
-       target_link_libraries(stream PRIVATE ${STREAM_LIBRARIES})
+add_library(stream SHARED stream.c stream.h stream_socket.h)
+target_link_libraries(stream PRIVATE ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} 
${SNAPPY_LIBRARIES} ${LZ4_LIBRARIES}
+                                         ${LIBLZMA_LIBRARIES} 
${CURL_LIBRARIES} ${ICONV_LIBRARIES} ${SOCKET_LIBRARIES})
+set_target_properties(stream PROPERTIES VERSION ${STREAM_VERSION} SOVERSION 
${STREAM_VERSION_MAJOR})
+target_compile_definitions(stream PRIVATE LIBSTREAM)
 
-       add_library(streamshared SHARED ${STREAM_OBJECTS})
-       target_link_libraries(streamshared PRIVATE ${STREAM_LIBRARIES})
-       set_target_properties(streamshared PROPERTIES OUTPUT_NAME stream)
-       target_compile_definitions(streamshared PRIVATE LIBSTREAM)
-
-       install(TARGETS streamshared LIBRARY DESTINATION ${LIBDIR})
-else()
-       add_library(stream SHARED ${STREAM_OBJECTS})
-       target_link_libraries(stream PRIVATE ${STREAM_LIBRARIES})
-       set_target_properties(stream PROPERTIES VERSION ${STREAM_VERSION} 
SOVERSION ${STREAM_VERSION_MAJOR})
-       target_compile_definitions(stream PRIVATE LIBSTREAM)
-endif()
-
-install(TARGETS stream LIBRARY DESTINATION ${LIBDIR})
+install(TARGETS stream DESTINATION ${LIBDIR})
 install(FILES stream_socket.h stream.h DESTINATION ${INCLUDEDIR}/monetdb)
 
 if(NOT WIN32)
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -8,54 +8,38 @@
 
 include_directories(../common/options ../common/stream ../common/utils 
${VALGRIND_INCLUDE_DIR})
 
-set(GDK_OBJECTS
-       gdk_select.c
-       gdk_calc.c gdk_calc.h gdk_calc_compare.h gdk_calc_private.h
-       gdk_ssort.c gdk_ssort_impl.h
-       gdk_aggr.c
-       gdk.h gdk_cand.h gdk_atomic.h gdk_batop.c
-       gdk_search.c gdk_hash.c gdk_hash.h gdk_tm.c
-       gdk_orderidx.c
-       gdk_align.c gdk_bbp.c gdk_bbp.h
-       gdk_heap.c gdk_utils.c gdk_utils.h
-       gdk_atoms.c gdk_atoms.h gdk_string.c
-       gdk_qsort.c gdk_qsort_impl.h
-       gdk_storage.c gdk_bat.c
-       gdk_delta.c gdk_cross.c gdk_system.c gdk_value.c
-       gdk_posix.c gdk_logger.c gdk_sample.c xoshiro256starstar.h
-       gdk_private.h gdk_delta.h gdk_logger.h gdk_posix.h
-       gdk_system.h gdk_system_private.h gdk_tm.h gdk_storage.h
-       gdk_group.c
-       gdk_imprints.c gdk_imprints.h
-       gdk_join.c gdk_project.c
-       gdk_unique.c
-       gdk_interprocess.c gdk_interprocess.h
-       gdk_firstn.c
-       gdk_analytic_bounds.c
-       gdk_analytic_func.c gdk_analytic.h)
-set(GDK_LIBRARIES ${MATH_LIBRARIES} ${SOCKET_LIBRARIES} ${MALLOC_LIBRARIES} 
${PTHREAD_LIBRARIES} ${DL_LIBRARIES}
-       moptions mutils stream)
-
-if(MSVC)
-       add_library(gdk STATIC ${GDK_OBJECTS})
-       target_link_libraries(gdk PRIVATE ${GDK_LIBRARIES})
-       set_target_properties(gdk PROPERTIES OUTPUT_NAME bat)
-
-       add_library(gdkshared SHARED ${GDK_OBJECTS})
-       target_link_libraries(gdkshared PRIVATE ${GDK_LIBRARIES})
-       set_target_properties(gdkshared PROPERTIES OUTPUT_NAME bat)
-       target_compile_definitions(gdkshared PRIVATE LIBGDK)
-
-       install(TARGETS gdkshared LIBRARY DESTINATION ${LIBDIR})
-else()
-       add_library(gdk SHARED ${GDK_OBJECTS})
-       target_link_libraries(gdk PRIVATE PRIVATE ${GDK_LIBRARIES})
-       set_target_properties(gdk PROPERTIES VERSION ${GDK_VERSION} SOVERSION 
${GDK_VERSION_MAJOR}
-                                                 RUNTIME_OUTPUT_NAME bat 
LIBRARY_OUTPUT_NAME bat)
-endif()
+add_library(gdk SHARED
+                       gdk_select.c
+                       gdk_calc.c gdk_calc.h gdk_calc_compare.h 
gdk_calc_private.h
+                       gdk_ssort.c gdk_ssort_impl.h
+                       gdk_aggr.c
+                       gdk.h gdk_cand.h gdk_atomic.h gdk_batop.c
+                       gdk_search.c gdk_hash.c gdk_hash.h gdk_tm.c
+                       gdk_orderidx.c
+                       gdk_align.c gdk_bbp.c gdk_bbp.h
+                       gdk_heap.c gdk_utils.c gdk_utils.h
+                       gdk_atoms.c gdk_atoms.h gdk_string.c
+                       gdk_qsort.c gdk_qsort_impl.h
+                       gdk_storage.c gdk_bat.c
+                       gdk_delta.c gdk_cross.c gdk_system.c gdk_value.c
+                       gdk_posix.c gdk_logger.c gdk_sample.c 
xoshiro256starstar.h
+                       gdk_private.h gdk_delta.h gdk_logger.h gdk_posix.h
+                       gdk_system.h gdk_system_private.h gdk_tm.h gdk_storage.h
+                       gdk_group.c
+                       gdk_imprints.c gdk_imprints.h
+                       gdk_join.c gdk_project.c
+                       gdk_unique.c
+                       gdk_interprocess.c gdk_interprocess.h
+                       gdk_firstn.c
+                       gdk_analytic_bounds.c
+                       gdk_analytic_func.c gdk_analytic.h)
+target_link_libraries(gdk PRIVATE ${MATH_LIBRARIES} ${SOCKET_LIBRARIES} 
${MALLOC_LIBRARIES} ${PTHREAD_LIBRARIES}
+                                         ${DL_LIBRARIES} moptions mutils 
stream)
+set_target_properties(gdk PROPERTIES VERSION ${GDK_VERSION} SOVERSION 
${GDK_VERSION_MAJOR} RUNTIME_OUTPUT_NAME bat
+                                         LIBRARY_OUTPUT_NAME bat)
 target_compile_definitions(gdk PRIVATE LIBGDK)
 
-install(TARGETS gdk LIBRARY DESTINATION ${LIBDIR})
+install(TARGETS gdk DESTINATION ${LIBDIR})
 install(FILES
                gdk.h
                gdk_analytic.h
diff --git a/monetdb5/CMakeLists.txt b/monetdb5/CMakeLists.txt
--- a/monetdb5/CMakeLists.txt
+++ b/monetdb5/CMakeLists.txt
@@ -6,12 +6,6 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-if(WIN32) # hack to link libmonetdb5, cmake has trouble linking static 
libraries into a single shared library while exposing symbols on Linux..
-       set(LIBMONETDB5_LINKING STATIC)
-else()
-       set(LIBMONETDB5_LINKING OBJECT)
-endif()
-
 add_subdirectory(mal)
 add_subdirectory(modules)
 add_subdirectory(optimizer)
diff --git a/monetdb5/extras/mal_optimizer_template/CMakeLists.txt 
b/monetdb5/extras/mal_optimizer_template/CMakeLists.txt
--- a/monetdb5/extras/mal_optimizer_template/CMakeLists.txt
+++ b/monetdb5/extras/mal_optimizer_template/CMakeLists.txt
@@ -11,7 +11,7 @@ include_directories(../../optimizer ../.
 add_library(opt_sql_append MODULE opt_sql_append.c opt_sql_append.h)
 target_link_libraries(opt_sql_append PRIVATE monetdb5 gdk)
 set_target_properties(opt_sql_append PROPERTIES RUNTIME_OUTPUT_NAME 
_opt_sql_append LIBRARY_OUTPUT_NAME _opt_sql_append)
-target_compile_definitions(opt_sql_append PRIVATE LIBOPT_SQL_APPEND LIBMAL 
LIBATOMS LIBKERNEL LIBOPTIMIZER LIBSCHEDULER LIBMONETDB5)
+target_compile_definitions(opt_sql_append PRIVATE LIBOPT_SQL_APPEND)
 
 install(TARGETS opt_sql_append DESTINATION ${LIBDIR}/monetdb5)
 install(FILES opt_sql_append.mal DESTINATION ${LIBDIR}/monetdb5)
diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt
--- a/monetdb5/mal/CMakeLists.txt
+++ b/monetdb5/mal/CMakeLists.txt
@@ -6,44 +6,6 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-include_directories(. ../../common/options ../../common/stream 
../../common/utils ../../clients/mapilib ../../gdk
-                                       ../optimizer ../modules/mal 
${CRYPTO_INCLUDE_DIR})
-
-add_library(mal ${LIBMONETDB5_LINKING}
-                       mal.c mal.h
-                       mal_atom.c mal_atom.h
-                       mal_authorize.c mal_authorize.h
-                       mal_builder.c mal_builder.h
-                       mal_client.c mal_client.h
-                       mal_debugger.c mal_debugger.h
-                       mal_errors.h
-                       mal_exception.c mal_exception.h
-                       mal_factory.c mal_factory.h
-                       mal_function.c mal_function.h
-                       mal_import.c mal_import.h
-                       mal_runtime.c mal_runtime.h
-                       mal_instruction.c mal_instruction.h
-                       mal_resource.c mal_resource.h
-                       mal_interpreter.c mal_interpreter.h
-                       mal_dataflow.c mal_dataflow.h
-                       mal_linker.c mal_linker.h
-                       mal_listing.c mal_listing.h
-                       mal_module.c mal_module.h
-                       mal_namespace.c mal_namespace.h
-                       mal_parser.c mal_parser.h
-                       mal_profiler.c mal_profiler.h
-                       mal_readline.c mal_readline.h
-                       mal_resolve.c mal_resolve.h
-                       mal_sabaoth.c mal_sabaoth.h
-                       mal_scenario.c mal_scenario.h
-                       mal_session.c mal_session.h
-                       mal_stack.c mal_stack.h
-                       mal_type.c mal_type.h
-                       mal_utils.c mal_utils.h
-                       mal_private.h)
-set_target_properties(mal PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_compile_definitions(mal PRIVATE LIBMAL LIBATOMS LIBKERNEL LIBOPTIMIZER 
LIBSCHEDULER LIBMONETDB5)
-
 install(FILES
                mal.h
                mal_client.h
diff --git a/monetdb5/modules/atoms/CMakeLists.txt 
b/monetdb5/modules/atoms/CMakeLists.txt
--- a/monetdb5/modules/atoms/CMakeLists.txt
+++ b/monetdb5/modules/atoms/CMakeLists.txt
@@ -6,29 +6,6 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-include_directories(../../mal ../../../common/options ../../../common/stream 
../../../common/utils ../../../gdk
-                                       ${LIBXML2_INCLUDE_DIR} 
${CRYPTO_INCLUDE_DIR})
-
-set(ATOM_ITEMS
-       batxml.c
-       blob.c blob.h
-       color.c color.h
-       identifier.c
-       inet.c
-       json.c json.h
-       mtime.c mtime_analytic.c mtime.h
-       str.c str.h
-       streams.c streams.h
-       url.c url.h
-       uuid.c
-       xml.c xml.h)
-if(WIN32)
-       list(APPEND ATOM_ITEMS strptime.c)
-endif()
-add_library(atoms ${LIBMONETDB5_LINKING} ${ATOM_ITEMS})
-set_target_properties(atoms PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_compile_definitions(atoms PRIVATE LIBMAL LIBATOMS LIBKERNEL 
LIBOPTIMIZER LIBSCHEDULER LIBMONETDB5)
-
 install(FILES
                batxml.mal
                blob.mal
diff --git a/monetdb5/modules/kernel/CMakeLists.txt 
b/monetdb5/modules/kernel/CMakeLists.txt
--- a/monetdb5/modules/kernel/CMakeLists.txt
+++ b/monetdb5/modules/kernel/CMakeLists.txt
@@ -6,24 +6,6 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 #]]
 
-include_directories(../../mal ../atoms ../../../common/options 
../../../common/stream ../../../gdk)
-
-add_library(kernel ${LIBMONETDB5_LINKING}
-                       aggr.c
-                       alarm.c
-                       algebra.c algebra.h
-                       bat5.c bat5.h
-                       batcolor.c batcolor.h
-                       batmmath.c batmmath.h
-                       batstr.c
-                       group.c group.h
-                       logger.c
-                       microbenchmark.c microbenchmark.h
-                       mmath.c mmath.h mmath_private.h
-                       status.c status.h)
-set_target_properties(kernel PROPERTIES POSITION_INDEPENDENT_CODE ON)
-target_compile_definitions(kernel PRIVATE LIBMAL LIBATOMS LIBKERNEL 
LIBOPTIMIZER LIBSCHEDULER LIBMONETDB5)
-
 install(FILES
                bat5.mal algebra.mal status.mal
                mmath.mal alarm.mal batstr.mal
diff --git a/monetdb5/modules/mal/CMakeLists.txt 
b/monetdb5/modules/mal/CMakeLists.txt
--- a/monetdb5/modules/mal/CMakeLists.txt
+++ b/monetdb5/modules/mal/CMakeLists.txt
@@ -6,45 +6,6 @@
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to