Commit 79b83f81 authored by Dominik Charousset's avatar Dominik Charousset

some CMake tuning for Xcode project generator

parent f493412e
...@@ -3,6 +3,7 @@ Doxyfile ...@@ -3,6 +3,7 @@ Doxyfile
cppa.creator.user* cppa.creator.user*
html/ html/
build/* build/*
cli_build/*
build-clang/* build-clang/*
build-gcc/* build-gcc/*
Makefile Makefile
......
...@@ -14,6 +14,21 @@ endif () ...@@ -14,6 +14,21 @@ endif ()
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# set binary output path
if ("${EXECUTABLE_OUTPUT_PATH}" STREQUAL "")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
endif ()
# set library output path
if ("${LIBRARY_OUTPUT_PATH}" STREQUAL "")
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
endif ()
# set library output path to binary output path for Xcode projects
if ("${CMAKE_GENERATOR}" STREQUAL "Xcode")
set(LIBRARY_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}")
endif ()
# check if the user provided CXXFLAGS on the command line # check if the user provided CXXFLAGS on the command line
if (CMAKE_CXX_FLAGS) if (CMAKE_CXX_FLAGS)
set(CXXFLAGS_PROVIDED true) set(CXXFLAGS_PROVIDED true)
...@@ -92,6 +107,8 @@ else () ...@@ -92,6 +107,8 @@ else ()
message(FATAL_ERROR "This platform is not supported by libcppa") message(FATAL_ERROR "This platform is not supported by libcppa")
endif() endif()
# get header files; only needed by CMake generators,
# e.g., for creating proper Xcode projects
file(GLOB LIBCPPA_HDRS "cppa/*.hpp" file(GLOB LIBCPPA_HDRS "cppa/*.hpp"
"cppa/detail/*.hpp" "cppa/detail/*.hpp"
"cppa/intrusive/*.hpp" "cppa/intrusive/*.hpp"
...@@ -100,6 +117,7 @@ file(GLOB LIBCPPA_HDRS "cppa/*.hpp" ...@@ -100,6 +117,7 @@ file(GLOB LIBCPPA_HDRS "cppa/*.hpp"
"cppa/qtsupport/*.hpp" "cppa/qtsupport/*.hpp"
"cppa/util/*.hpp") "cppa/util/*.hpp")
# list cpp files including platform-dependent files
set(LIBCPPA_SRC set(LIBCPPA_SRC
${LIBCPPA_PLATFORM_SRC} ${LIBCPPA_PLATFORM_SRC}
src/abstract_tuple.cpp src/abstract_tuple.cpp
...@@ -217,6 +235,7 @@ else (DISABLE_CONTEXT_SWITCHING) ...@@ -217,6 +235,7 @@ else (DISABLE_CONTEXT_SWITCHING)
find_package(Boost 1.51.0 COMPONENTS context) find_package(Boost 1.51.0 COMPONENTS context)
# without REQUIRED, find_package(Boost...) returns with Boost_FOUND=FALSE # without REQUIRED, find_package(Boost...) returns with Boost_FOUND=FALSE
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
# disable implicitly
set(DISABLE_CONTEXT_SWITCHING true) set(DISABLE_CONTEXT_SWITCHING true)
else (NOT Boost_FOUND) else (NOT Boost_FOUND)
if (${Boost_VERSION} LESS 105400) if (${Boost_VERSION} LESS 105400)
...@@ -243,7 +262,7 @@ if (DISABLE_CONTEXT_SWITCHING) ...@@ -243,7 +262,7 @@ if (DISABLE_CONTEXT_SWITCHING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCPPA_DISABLE_CONTEXT_SWITCHING") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCPPA_DISABLE_CONTEXT_SWITCHING")
endif () endif ()
# bulid shared library only if not comiling static only # bulid shared library if not comiling static only
if (NOT "${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes") if (NOT "${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes")
add_library(libcppa SHARED ${LIBCPPA_SRC} ${LIBCPPA_HDRS}) add_library(libcppa SHARED ${LIBCPPA_SRC} ${LIBCPPA_HDRS})
target_link_libraries(libcppa ${LD_FLAGS}) target_link_libraries(libcppa ${LD_FLAGS})
...@@ -257,7 +276,7 @@ if (NOT "${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes") ...@@ -257,7 +276,7 @@ if (NOT "${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes")
install(TARGETS libcppa LIBRARY DESTINATION lib) install(TARGETS libcppa LIBRARY DESTINATION lib)
endif () endif ()
# build static library if --build-static or --build-static-only was set # build static library only if --build-static or --build-static-only was set
if ("${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes" OR "${CPPA_BUILD_STATIC}" STREQUAL "yes") if ("${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes" OR "${CPPA_BUILD_STATIC}" STREQUAL "yes")
add_library(libcppaStatic STATIC ${LIBCPPA_HDRS} ${LIBCPPA_SRC}) add_library(libcppaStatic STATIC ${LIBCPPA_HDRS} ${LIBCPPA_SRC})
set_target_properties(libcppaStatic PROPERTIES OUTPUT_NAME cppa_static) set_target_properties(libcppaStatic PROPERTIES OUTPUT_NAME cppa_static)
...@@ -280,15 +299,6 @@ add_custom_target(uninstall ...@@ -280,15 +299,6 @@ add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
if (LIBRARY_OUTPUT_PATH)
set (CPPA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
set (CPPA_LIBRARY_PATH ${LIBRARY_OUTPUT_PATH})
else ()
set (CPPA_LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib)
set (CPPA_LIBRARY_PATH ${CPPA_LIBRARY_OUTPUT_PATH})
set (LIBRARY_OUTPUT_PATH ${CPPA_LIBRARY_OUTPUT_PATH} CACHE PATH "Single directory for all libraries")
endif ()
# setting path to cppa headers and libcppa # setting path to cppa headers and libcppa
set (CPPA_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/libcppa) set (CPPA_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/libcppa)
set (CPPA_INCLUDE ${CPPA_INCLUDE_PATH}) set (CPPA_INCLUDE ${CPPA_INCLUDE_PATH})
...@@ -297,7 +307,12 @@ if ("${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes") ...@@ -297,7 +307,12 @@ if ("${CPPA_BUILD_STATIC_ONLY}" STREQUAL "yes")
set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa_static.a ${LD_FLAGS}) set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa_static.a ${LD_FLAGS})
else () else ()
if (APPLE) if (APPLE)
set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa.dylib) if ("${CMAKE_GENERATOR}" STREQUAL "Xcode")
set (CPPA_LIBRARY "-lcppa")
else ()
set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa.dylib)
endif ()
#set (CPPA_LIBRARY -L${LIBRARY_OUTPUT_PATH} -lcppa)
elseif (UNIX) elseif (UNIX)
set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa.so) set (CPPA_LIBRARY ${LIBRARY_OUTPUT_PATH}/libcppa.so)
else () else ()
...@@ -305,11 +320,6 @@ else () ...@@ -305,11 +320,6 @@ else ()
endif () endif ()
endif () endif ()
if (EXECUTABLE_OUTPUT_PATH)
else ()
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin CACHE PATH "Single directory for all executables")
endif ()
# set up subdirectories # set up subdirectories
if (NOT "${CPPA_NO_UNIT_TESTS}" STREQUAL "yes") if (NOT "${CPPA_NO_UNIT_TESTS}" STREQUAL "yes")
enable_testing() enable_testing()
......
...@@ -93,18 +93,18 @@ configure () ...@@ -93,18 +93,18 @@ configure ()
if [ -n "$2" ]; then if [ -n "$2" ]; then
workdir="$builddir-$2" workdir="$builddir-$2"
else else
workdir=$builddir workdir="$builddir"
fi fi
workdirs="$workdirs $workdir" workdirs="$workdirs $workdir"
if [ -n "$3" ]; then if [ -n "$3" ]; then
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH $3 append_cache_entry EXECUTABLE_OUTPUT_PATH PATH "$3"
else else
append_cache_entry EXECUTABLE_OUTPUT_PATH PATH "$workdir/bin" append_cache_entry EXECUTABLE_OUTPUT_PATH PATH "$workdir/bin"
fi fi
if [ -n "$4" ]; then if [ -n "$4" ]; then
append_cache_entry LIBRARY_OUTPUT_PATH PATH $4 append_cache_entry LIBRARY_OUTPUT_PATH PATH "$4"
else else
append_cache_entry LIBRARY_OUTPUT_PATH PATH "$workdir/lib" append_cache_entry LIBRARY_OUTPUT_PATH PATH "$workdir/lib"
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment