Skip to content

Commit

Permalink
CMake fixes. This will make ASP not build, but will fix that soon too.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-alexandrov committed Jun 3, 2020
1 parent efeb570 commit cc97104
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 72 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
## Add precompiled header tool
#list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/CMakePCHCompiler)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -lm")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g -D_GLIBCXX_USE_CXX11_ABI=0 -lm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -std=c++11 -lm -pthread -lpthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g -lm -pthread -lpthread")

add_subdirectory(src)

Expand Down
53 changes: 0 additions & 53 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

include(Utilities) # Contains functions

#===============================================================================
# Project information

# Need this to make sure we get the compiler from PATH.
# - cc and c++ both need to be on the PATH.
find_program(CMAKE_C_COMPILER NAMES $ENV{CC} gcc PATHS ENV PATH NO_DEFAULT_PATH)
Expand Down Expand Up @@ -55,9 +52,6 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)


#===============================================================================

# Set the install path if not specified by the user.
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE PATH "default install path" FORCE )
Expand All @@ -84,8 +78,6 @@ add_custom_target(doxygen doxygen
COMMAND ln -s ${CMAKE_SOURCE_DIR}/docs/doxygen/index.html ${CMAKE_SOURCE_DIR}/docs/doxygen-output.html
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")



# Add external dependencies which still need to be built

# Build GTest
Expand All @@ -98,50 +90,5 @@ target_link_libraries(gtest_main gtest)
target_compile_definitions(gtest PRIVATE GTEST_USE_OWN_TR1_TUPLE=1)
target_compile_definitions(gtest_main PRIVATE GTEST_USE_OWN_TR1_TUPLE=1)




# Add all of our code
add_subdirectory(vw)

#========================================================================================

# Deprecated - We no longer use protobuf files!
function(generate_protobuf_files PROTO_GEN_OUT)

# Finds all .proto files in the current dir
file(GLOB PROTO_INPUT RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.proto")

# Protobuf compiler
find_program(PROTOC protoc)
set(PROTOC_C_OUT_FLAG --cpp_out)

# Set where generated files go to and add that directory to the include path
set(PROTO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PROTO_GEN_DIR})

# For each input protobuf file
foreach(PROTO_FILE ${PROTO_INPUT})
# Get the name of the file without extension
get_filename_component(PROTO_NAME ${PROTO_FILE} NAME_WE)

# Add the two generated files to PROTO_GEN variable
set(PROTO_GEN ${PROTO_GEN}
${PROTO_GEN_DIR}/${PROTO_NAME}.pb.h
${PROTO_GEN_DIR}/${PROTO_NAME}.pb.cc)
endforeach()

# Add the custom command that will generate all the files
# - The generated files will be put in the CMake build directory, not the source tree.
#message("Output files: ${PROTO_GEN}")
add_custom_command(OUTPUT ${PROTO_GEN}
COMMAND ${PROTOC} ${PROTO_INPUT} ${PROTOC_C_OUT_FLAG} ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${PROTO_INPUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating Protocol Buffers...")

set(${PROTO_GEN_OUT} ${PROTO_GEN} PARENT_SCOPE) # Set up output variable
endfunction(generate_protobuf_files)



34 changes: 17 additions & 17 deletions src/vw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ if(BINARYBUILDER_INSTALL_DIR)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${BINARYBUILDER_INSTALL_DIR}")
endif()

if("${ISIS3_DEPS_DIR}" STREQUAL "")
message(FATAL_ERROR "You need to set ISIS3_DEPS_DIR: ${ISIS3_DEPS_DIR}")
if("${ISIS_DEPS_DIR}" STREQUAL "")
message(FATAL_ERROR "You need to set ISIS_DEPS_DIR: ${ISIS_DEPS_DIR}")
endif()

# Libraries use paths like "vw/blah/blah.h" so we need to include the top of the tree
Expand All @@ -63,7 +63,7 @@ SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Make sure installed files can find installed libraries
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${CMAKE_INSTALL_PREFIX}/lib ${ISIS3_DEPS_DIR}/lib ${ISIS3_DEPS_DIR}/lib64)
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${CMAKE_INSTALL_PREFIX}/lib ${ISIS_DEPS_DIR}/lib ${ISIS_DEPS_DIR}/lib64)


# --- Custom options ---
Expand All @@ -87,10 +87,10 @@ set(BOOST_MIN_VERSION "1.65")
set(REQUIRED_BOOST_LIBS program_options system filesystem regex date_time thread iostreams)
#set(Boost_DEBUG 1) # Uncomment for useful finding boost debug output
#if(BINARYBUILDER_INSTALL_DIR) # Look in BinaryBuilder directory
if(ISIS3_DEPS_DIR) # Look in BinaryBuilder directory
set(BOOST_ROOT "${ISIS3_DEPS_DIR}")
set(BOOST_LIBRARYDIR "${ISIS3_DEPS_DIR}/lib")
set(BOOST_INCLUDEDIR "${ISIS3_DEPS_DIR}/include")
if(ISIS_DEPS_DIR) # Look in BinaryBuilder directory
set(BOOST_ROOT "${ISIS_DEPS_DIR}")
set(BOOST_LIBRARYDIR "${ISIS_DEPS_DIR}/lib")
set(BOOST_INCLUDEDIR "${ISIS_DEPS_DIR}/include")

#DBoost_INCLUDE_DIR=$HOME/projects/BinaryBuilder/build_asp/install/include/boost-1_67

Expand Down Expand Up @@ -128,7 +128,7 @@ find_package(Threads REQUIRED)
find_package(LAPACK)
find_package(BLAS)
#else() # Use our BB compiled version
# find_external_library(LAPACK ${ISIS3_DEPS_DIR} "" "lapack;blas" REQUIRED)
# find_external_library(LAPACK ${ISIS_DEPS_DIR} "" "lapack;blas" REQUIRED)
#endif()
if(LAPACK_FOUND)
set(VW_HAVE_PKG_LAPACK 1)
Expand All @@ -140,12 +140,12 @@ if(LAPACK_FOUND)
#endif()
endif()

find_external_library(FLANN ${ISIS3_DEPS_DIR} "" "flann_cpp" REQUIRED)
find_external_library(JPEG ${ISIS3_DEPS_DIR} "" "jpeg" NOT_REQUIRED)
find_external_library(PNG ${ISIS3_DEPS_DIR} "" "png;png16" NOT_REQUIRED)
find_external_library(TIFF ${ISIS3_DEPS_DIR} "" "tiff" NOT_REQUIRED)
find_external_library(Z ${ISIS3_DEPS_DIR} "" "z" REQUIRED)
find_external_library(PROJ4 ${ISIS3_DEPS_DIR} "" "proj" REQUIRED)
find_external_library(FLANN ${ISIS_DEPS_DIR} "" "flann_cpp" REQUIRED)
find_external_library(JPEG ${ISIS_DEPS_DIR} "" "jpeg" NOT_REQUIRED)
find_external_library(PNG ${ISIS_DEPS_DIR} "" "png;png16" NOT_REQUIRED)
find_external_library(TIFF ${ISIS_DEPS_DIR} "" "tiff" NOT_REQUIRED)
find_external_library(Z ${ISIS_DEPS_DIR} "" "z" REQUIRED)
find_external_library(PROJ4 ${ISIS_DEPS_DIR} "" "proj" REQUIRED)
find_external_library(GDAL ${BINARYBUILDER_INSTALL_DIR} "" "gdal" REQUIRED)

# TODO: Make a function?
Expand All @@ -160,12 +160,12 @@ set(OPENCV_LIB_NAMES opencv_calib3d opencv_reg
opencv_ml opencv_ximgproc
opencv_objdetect opencv_xobjdetect
opencv_photo opencv_xphoto)
find_external_library(OPENCV ${ISIS3_DEPS_DIR} "" "${OPENCV_LIB_NAMES}" REQUIRED)
find_external_library(OPENCV ${ISIS_DEPS_DIR} "" "${OPENCV_LIB_NAMES}" REQUIRED)


set(ILMBASE_LIB_NAMES Half Iex Imath IlmThread)
find_external_library(ILMBASE ${BINARYBUILDER_INSTALL_DIR} "" "${ILMBASE_LIB_NAMES}" REQUIRED)
find_external_library(OPENEXR ${BINARYBUILDER_INSTALL_DIR} "OpenEXR" "IlmImf;IlmThread" REQUIRED)
find_external_library(ILMBASE ${ISIS_DEPS_DIR} "" "${ILMBASE_LIB_NAMES}" REQUIRED)
find_external_library(OPENEXR ${ISIS_DEPS_DIR} "OpenEXR" "IlmImf;IlmThread" REQUIRED)

# CMake will try to find these packages if needed,
# they are not included with BinaryBuilder.
Expand Down

0 comments on commit cc97104

Please sign in to comment.