|
| 1 | +# This file is a part of pandas. See LICENSE for details about reuse and |
| 2 | +# copyright holders |
| 3 | +# |
1 | 4 | # Assembled from BSD/MIT/Apache-licensed code from a variety of copyright
|
2 | 5 | # holders, including at least
|
3 | 6 | #
|
|
6 | 9 | # Copyright (C) 2012-15 Continuum Analytics, Inc.
|
7 | 10 |
|
8 | 11 | cmake_minimum_required(VERSION 2.7)
|
| 12 | +project(pandas) |
9 | 13 |
|
10 | 14 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
|
11 | 15 | include(CMakeParseArguments)
|
12 | 16 |
|
13 | 17 | set(BUILD_SUPPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build-support)
|
| 18 | +set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) |
14 | 19 |
|
15 | 20 | # Allow "make install" to not depend on all targets.
|
16 | 21 | #
|
17 | 22 | # Must be declared in the top-level CMakeLists.txt.
|
18 | 23 | set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
|
19 | 24 |
|
20 |
| -# For thirdparty libs: glog, googletest, gflags |
21 |
| -include(toolchain) |
| 25 | +# For thirdparty libs: googletest |
| 26 | +# include(toolchain) |
22 | 27 |
|
23 |
| -project(pandas) |
| 28 | +set(CMAKE_MACOSX_RPATH 1) |
| 29 | +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) |
24 | 30 |
|
25 | 31 | ############################################################
|
26 | 32 | # Compiler flags
|
@@ -110,22 +116,9 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang")
|
110 | 116 | # http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
|
111 | 117 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
|
112 | 118 |
|
113 |
| - # Only hardcode -fcolor-diagnostics if stderr is opened on a terminal. Otherwise |
114 |
| - # the color codes show up as noisy artifacts. |
115 |
| - # |
116 |
| - # This test is imperfect because 'cmake' and 'make' can be run independently |
117 |
| - # (with different terminal options), and we're testing during the former. |
118 |
| - execute_process(COMMAND test -t 2 RESULT_VARIABLE PANDAS_IS_TTY) |
119 |
| - if ((${PANDAS_IS_TTY} EQUAL 0) AND (NOT ("$ENV{TERM}" STREQUAL "dumb"))) |
120 |
| - message("Running in a controlling terminal") |
121 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics") |
122 |
| - else() |
123 |
| - message("Running without a controlling terminal or in a dumb terminal") |
124 |
| - endif() |
| 119 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-unused-function -Wno-error") |
125 | 120 |
|
126 |
| - # Use libstdc++ and not libc++. The latter lacks support for tr1 in OSX |
127 |
| - # and since 10.9 is now the default. |
128 |
| - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") |
| 121 | + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") |
129 | 122 | endif()
|
130 | 123 |
|
131 | 124 | # Sanity check linking option.
|
@@ -482,46 +475,21 @@ function(ADD_THIRDPARTY_LIB LIB_NAME)
|
482 | 475 | endif()
|
483 | 476 | endfunction()
|
484 | 477 |
|
485 |
| -find_package(GLog REQUIRED) |
486 |
| -ADD_THIRDPARTY_LIB(glog |
487 |
| - STATIC_LIB "${GLOG_STATIC_LIB}" |
488 |
| - SHARED_LIB "${GLOG_SHARED_LIB}") |
489 |
| -list(APPEND PANDAS_BASE_LIBS glog) |
490 |
| - |
491 |
| -## GFlags |
492 |
| -find_package(GFlags REQUIRED) |
493 |
| -ADD_THIRDPARTY_LIB(gflags |
494 |
| - STATIC_LIB "${GFLAGS_STATIC_LIB}" |
495 |
| - SHARED_LIB "${GFLAGS_SHARED_LIB}") |
496 |
| -list(APPEND PANDAS_BASE_LIBS gflags) |
497 |
| - |
498 |
| -## GMock |
499 |
| -find_package(GMock REQUIRED) |
500 |
| -ADD_THIRDPARTY_LIB(gmock |
501 |
| - STATIC_LIB ${GMOCK_STATIC_LIBRARY}) |
502 |
| - |
503 | 478 | ## Python and libraries
|
504 | 479 | find_package(PythonInterp REQUIRED)
|
505 | 480 | find_package(PythonLibsNew REQUIRED)
|
506 | 481 | find_package(NumPy REQUIRED)
|
507 | 482 | include(UseCython)
|
508 | 483 |
|
| 484 | +message(STATUS "Found Python dynamic library: ${PYTHON_LIBRARIES}") |
| 485 | + |
509 | 486 | include_directories(SYSTEM
|
510 |
| - ${GLOG_INCLUDE_DIR} |
511 |
| - ${GMOCK_INCLUDE_DIR} |
512 |
| - ${GTEST_INCLUDE_DIR} |
513 |
| - ${GFLAGS_INCLUDE_DIR} |
514 | 487 | ${NUMPY_INCLUDE_DIRS}
|
515 | 488 | ${PYTHON_INCLUDE_DIRS}
|
516 | 489 | pandas/
|
| 490 | + thirdparty/ |
517 | 491 | src)
|
518 | 492 |
|
519 |
| -############################################################ |
520 |
| -# Linker setup |
521 |
| -############################################################ |
522 |
| -set(PANDAS_MIN_TEST_LIBS pandas_test_main pandas_test_util ${PANDAS_BASE_LIBS}) |
523 |
| -set(PANDAS_TEST_LINK_LIBS ${PANDAS_MIN_TEST_LIBS}) |
524 |
| - |
525 | 493 | ############################################################
|
526 | 494 | # "make ctags" target
|
527 | 495 | ############################################################
|
@@ -561,38 +529,67 @@ if (UNIX)
|
561 | 529 | `find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc -or -name \\*.h`)
|
562 | 530 | endif (UNIX)
|
563 | 531 |
|
| 532 | +############################################################# |
| 533 | +# Test linking |
| 534 | + |
| 535 | +set(PANDAS_MIN_TEST_LIBS |
| 536 | + pandas_test_main |
| 537 | + pandas) |
| 538 | + |
| 539 | +# Unit tests need to link to libpython. NumPy can be linked by importing the |
| 540 | +# numpy module |
| 541 | +if(NOT APPLE) |
| 542 | + ADD_THIRDPARTY_LIB(python |
| 543 | + SHARED_LIB "${PYTHON_LIBRARIES}") |
| 544 | + list(APPEND PANDAS_MIN_TEST_LIBS python) |
| 545 | +endif() |
| 546 | + |
| 547 | +set(PANDAS_TEST_LINK_LIBS ${PANDAS_MIN_TEST_LIBS}) |
| 548 | + |
564 | 549 | ############################################################
|
565 | 550 | # Subdirectories
|
566 | 551 | ############################################################
|
567 | 552 |
|
568 | 553 | add_subdirectory(src/pandas)
|
569 | 554 | add_subdirectory(src/pandas/util)
|
570 | 555 |
|
571 |
| -# Python and NumPy shared libraries must be manually imported / linked |
572 |
| -set(LINK_LIBS |
| 556 | +set(PANDAS_SRCS |
| 557 | + src/pandas/array.cc |
| 558 | + src/pandas/dispatch.cc |
| 559 | + src/pandas/init.cc |
| 560 | + src/pandas/numpy_interop.cc |
| 561 | + src/pandas/pytypes.cc |
| 562 | + |
| 563 | + src/pandas/types/boolean.cc |
| 564 | + src/pandas/types/category.cc |
| 565 | + src/pandas/types/integer.cc |
| 566 | + src/pandas/types/floating.cc |
573 | 567 | )
|
574 | 568 |
|
575 | 569 | add_library(pandas SHARED
|
576 | 570 | ${PANDAS_SRCS})
|
577 |
| -target_link_libraries(pandas ${LINK_LIBS}) |
| 571 | +target_link_libraries(pandas |
| 572 | + pandas_util) |
578 | 573 | set_target_properties(pandas PROPERTIES LINKER_LANGUAGE CXX)
|
579 | 574 |
|
580 |
| -# install(TARGETS pandas |
581 |
| -# LIBRARY DESTINATION lib) |
| 575 | +if(APPLE) |
| 576 | + set_target_properties(pandas PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") |
| 577 | +endif() |
582 | 578 |
|
583 | 579 | ############################################################
|
584 | 580 | # Setup and build Cython modules
|
585 | 581 | ############################################################
|
586 | 582 |
|
587 | 583 | foreach(pyx_api_file
|
588 |
| - pandas/native.pyx) |
| 584 | + pandas/native.pyx |
| 585 | + pandas/internals/config.pyx) |
589 | 586 | set_source_files_properties(${pyx_api_file} PROPERTIES CYTHON_API 1)
|
590 | 587 | endforeach(pyx_api_file)
|
591 | 588 |
|
592 | 589 | set(USE_RELATIVE_RPATH ON)
|
593 | 590 | set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
594 | 591 |
|
595 |
| -foreach(module native) |
| 592 | +foreach(module native internals.config) |
596 | 593 | string(REPLACE "." ";" directories ${module})
|
597 | 594 | list(GET directories -1 module_name)
|
598 | 595 | list(REMOVE_AT directories -1)
|
@@ -623,12 +620,12 @@ foreach(module native)
|
623 | 620 | math(EXPR i "${i} - 1" )
|
624 | 621 | endwhile(${i} GREATER 0)
|
625 | 622 |
|
626 |
| - # for inplace development for now |
| 623 | + # for inplace development for now |
627 | 624 | set(module_install_rpath "${CMAKE_SOURCE_DIR}/pandas/")
|
628 | 625 |
|
629 | 626 | set_target_properties(${module_name} PROPERTIES
|
630 | 627 | INSTALL_RPATH ${module_install_rpath})
|
631 | 628 | target_link_libraries(${module_name} pandas)
|
632 | 629 | endforeach(module)
|
633 | 630 |
|
634 |
| -add_dependencies(pandas native_pyx) |
| 631 | +# add_dependencies(pandas native_pyx) |
0 commit comments