Browse Source

Cleanup cmakelists

merge-requests/365/head
Jørgen Lien Sellæg 11 years ago
parent
commit
9f60e210b7
  1. 19
      CMakeLists.txt
  2. 160
      src/CMakeLists.txt
  3. 9
      src/cmake/Modules/FindLibClangmm.cmake

19
CMakeLists.txt

@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 2.8.4)
set(project_name juci)
set(module juci_to_python_api)
#### TODO WINDOWS SUPPORT ####
set(juci_config_folder "$ENV{HOME}/.juci")
set(bin_install_path "/usr/local/bin")
set(lib_install_path "/usr/local/lib/python2.7/dist-packages/")
#####
project (${project_name})
add_subdirectory("src")
install(
DIRECTORY "config" "plugins"
DESTINATION ${juci_config_folder}
USE_SOURCE_PERMISSIONS)

160
src/CMakeLists.txt

@ -1,104 +1,57 @@
cmake_minimum_required (VERSION 2.8.4)
set(project_name juci)
set(module juci_to_python_api)
project (${project_name})
add_definitions(-DBOOST_LOG_DYN_LINK) add_definitions(-DBOOST_LOG_DYN_LINK)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread -Wall -Wno-reorder") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread -Wall -Wno-reorder")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/")
#You are of course using Homebrew:
if(APPLE) if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/opt/gettext/lib -I/usr/local/opt/gettext/include -undefined dynamic_lookup") #TODO: fix this set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/opt/gettext/lib -I/usr/local/opt/gettext/include -undefined dynamic_lookup") #T
set(CMAKE_MACOSX_RPATH 1) set(CMAKE_MACOSX_RPATH 1)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig")
endif() endif()
INCLUDE(FindPkgConfig) INCLUDE(FindPkgConfig)
message("Searcing for libclang") set(validation true)
#LIBCLANG_FOUND System has libclang.
#LIBCLANG_INCLUDE_DIRS The libclang include directories. function(install_help APPLE UNIX WINDOWS)
#LIBCLANG_LIBRARIES The libraries needed to use libclang. message("Install package with:")
#LIBCLANG_LIBRARY_DIR The path to the directory containing libclang. if(UNIX)
#LIBCLANG_KNOWN_LLVM_VERSIONS Known LLVM release numbers. if(APPLE)
find_package(LibClangmm) message("brew install ${APPLE}")
find_package(LibClang) else()
message("sudo apt-get install ${UNIX}")
endif(APPLE)
endif(UNIX)
if(WINDOWS)
message("choco install ${WINDOWS}")
endif(WINDOWS)
endfunction(install_help)
function(validate FOUND APPLE UNIX WINDOWS)
if(!${FOUND})
set(validation false)
install_help(${APPLE} ${UNIX} ${WINDOWS})
endif()
endfunction(validate)
if(${LCL_FOUND}) find_package(LibClangmm)
message("libclangmm libraries found. Continuing") validate(${LCL_FOUND} "clangmm" "clangmm" "clangmm")
message("${LCL_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "The libclangmm libraries are required. Quitting.")
endif()
if(${LIBCLANG_FOUND}) find_package(LibClang)
message("libclangmm libraries found. Continuing") validate(${LIBCLANG_FOUND} "clang" "libclang-dev" "llvm")
message("${LIBCLANG_INCLUDE_DIRS}")
else()
message(FATAL_ERROR "The libclangmm libraries are required. Quitting.")
endif()
#### Finding boost, the variables below is set #####
#PYTHONLIBS_FOUND - True if headers and requested libraries were found
#PYTHON_INCLUDE_DIRS - Boost include directories
#PYTHON_LIBRARIES - Boost component libraries to be linked
find_package(PythonLibs 2.7) find_package(PythonLibs 2.7)
validate(${PYTHONLIBS_FOUND} "python" "libpython-dev" "python")
#If python is found
if(${PYTHONLIBS_FOUND})
message("Python libraries found. Continuing")
else()
message("Please install python libraries. The libraries where not found.")
message("Python include dirs: ${PYTHON_INCLUDE_DIRS}")
message("Python link dirs ${PYTHON_LIBRARIES}")
message(FATAL_ERROR "The python libraries are required. Quitting.")
endif()
#### Finding boost, the variables below is set #####
#Boost_FOUND - True if headers and requested libraries were found
#Boost_INCLUDE_DIRS - Boost include directories
#Boost_LIBRARY_DIRS - Link directories for Boost libraries
#Boost_LIBRARIES - Boost component libraries to be linked
find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED) find_package(Boost 1.55 COMPONENTS python thread log system filesystem REQUIRED)
validate(${Boost_FOUND} "boost" "libboost-all-dev" "boost")
#If boost is not found
if(${Boost_FOUND})
message("Boost libraries found. Continuing")
else()
message("Please install boost libraries. The libraries where not found.")
message("Boost library dirs: ${Boost_LIBRARY_DIRS}")
message("Boost include dirs: ${Boost_INCLUDE_DIRS}")
message("Boost link dirs ${Boost_LIBRARIES}")
message(FATAL_ERROR "The boost libraries are required. Quitting.")
endif()
#### Finding gtkmm, the variables below is set #####
#GTKMM_FOUND - True if headers and requested libraries were found
#GTKMM_INCLUDE_DIRS - GTKMM include directories
#GTKMM_LIBRARY_DIRS - Link directories for GTKMM libraries
#GTKMM_LIBRARIES - GTKMM libraries to be linked
pkg_check_modules(GTKMM gtkmm-3.0) # The name GTKMM is set here for the variables abouve pkg_check_modules(GTKMM gtkmm-3.0) # The name GTKMM is set here for the variables abouve
validate(${GTKMM_FOUND} "gtkmm" "libgtkmm-dev" "gtkmm")
#If gtkmm is not found
if(${GTKMM_FOUND})
message("Gtkmm libraries found. Continuing")
else()
message("Please install gtkmm libraries. The libraries where not found.")
message("Gtkmm library dirs ${GTKMM_LIBRARY_DIRS}")
message("Gtkmm include dirs ${GTKMM_INCLUDE_DIRS}")
message("Gtkmm link dirs ${GTKMM_LIBRARIES}")
message(FATAL_ERROR "The gtkmm libraries are required. Quitting.")
endif()
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0) pkg_check_modules(GTKSVMM gtksourceviewmm-3.0)
if(${GTKSVMM_FOUND}) validate(${GTKSVMM_FOUND} "gtksvmm" "libgtksvmm-dev" "gtkmmsv")
message("Gtksourceviewmm libraries found. Continuing")
else()
message(FATAL_ERROR "The gtksourceviewmm libraries are required. Quitting.")
endif()
# name of the executable on Windows will be example.exe if(${validation})
add_executable(${project_name} add_executable(${project_name}
#list of every needed file to create the executable
juci.h juci.h
juci.cc juci.cc
menu.h menu.h
@ -126,39 +79,46 @@ add_executable(${project_name}
tooltips.h tooltips.h
tooltips.cc tooltips.cc
singletons.h singletons.h
singletons.cc singletons.cc)
)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_library(${module} SHARED
add_library(${module} SHARED
api api
api_ext api_ext)
)
# dependencies
include_directories( include_directories(
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}
${GTKMM_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS}
${GTKSVMM_INCLUDE_DIRS} ${GTKSVMM_INCLUDE_DIRS}
${LCL_INCLUDE_DIRS} ${LCL_INCLUDE_DIRS}
${LIBCLANG_INCLUDE_DIRS} ${LIBCLANG_INCLUDE_DIRS})
)
link_directories( link_directories(
${GTKMM_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS}
${GTKSVMM_LIBRARY_DIRS} ${GTKSVMM_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}
${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}
${LCL_LIBRARY_DIRS} ${LCL_LIBRARY_DIRS}
${LIBCLANG_LIBRARY_DIRS} ${LIBCLANG_LIBRARY_DIRS})
set_target_properties(${module}
PROPERTIES PREFIX ""
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/")
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
target_link_libraries(${project_name}
${LIBCLANG_LIBRARIES}
${LCL_LIBRARIES}
${GTKMM_LIBRARIES}
${GTKSVMM_LIBRARIES}
${Boost_LIBRARIES}
${PYTHON_LIBRARIES})
install(TARGETS ${project_name} ${module}
RUNTIME DESTINATION ${bin_install_path}
LIBRARY DESTINATION ${lib_install_path}
) )
#module:
set_target_properties(${module} PROPERTIES PREFIX ""
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/")
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
#executable:
target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${GTKSVMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
endif(${validation})

9
src/cmake/Modules/FindLibClangmm.cmake

@ -1,20 +1,15 @@
# - Try to find LCL
# Once done this will define
# LCL_FOUND - Libclangmm is available # LCL_FOUND - Libclangmm is available
# LCL_INCLUDE_DIRS - The libclangmm include directories # LCL_INCLUDE_DIRS - The libclangmm include directories
# LCL_LIBRARIES - # LCL_LIBRARIES -
# LCL_DEFINITIONS - Compiler switches required for using libclangmm
find_package(PkgConfig) find_package(PkgConfig)
find_path(LCL_INCLUDE_DIR clangmm.h find_path(LCL_INCLUDE_DIR clangmm.h
HINTS "/usr/local/lib/libclangmm/include/" HINTS "/usr/local/include/libclangmm/"
) )
find_library(LCL_LIBRARY NAMES clangmm find_library(LCL_LIBRARY NAMES clangmm
HINTS "/usr/local/lib/libclangmm/" HINTS "/usr/local/lib/"
) )
set(LCL_LIBRARIES ${LCL_LIBRARY} ) set(LCL_LIBRARIES ${LCL_LIBRARY} )

Loading…
Cancel
Save