Permalink
Browse files

Major refactor of cmake code -- much more straightforward, fewer poss…

…ible naming conflicts
  • Loading branch information...
1 parent f8a15d2 commit 49fb59ef5ac49b222be98965c6e2da27526b0ce8 Richard Bateman committed Feb 18, 2011
Showing with 327 additions and 321 deletions.
  1. +36 −25 CMakeLists.txt
  2. +39 −26 cmake/{projectConfig_main.cmake.in → CommonPluginConfig.cmake}
  3. +4 −4 cmake/Win.cmake
  4. +2 −2 cmake/X11.cmake
  5. +58 −54 cmake/common.cmake
  6. +2 −2 cmake/options.cmake
  7. +24 −17 cmake/paths.cmake
  8. +1 −2 { → cmake}/pluginProjects.cmake
  9. +7 −9 examples/BasicMediaPlayer/CMakeLists.txt
  10. +2 −2 examples/BasicMediaPlayer/Mac/projectDef.cmake
  11. +5 −5 examples/BasicMediaPlayer/Win/projectDef.cmake
  12. +3 −4 examples/FBTestPlugin/CMakeLists.txt
  13. +3 −3 examples/FBTestPlugin/Mac/projectDef.cmake
  14. +5 −5 examples/FBTestPlugin/Win/projectDef.cmake
  15. +2 −2 examples/FBTestPlugin/X11/projectDef.cmake
  16. +3 −5 fbgen/src/CMakeLists.txt
  17. +2 −2 fbgen/src/Mac/projectDef.cmake
  18. +1 −1 fbgen/src/Win/WiX/TemplateInstaller.wxs
  19. +7 −7 fbgen/src/Win/projectDef.cmake
  20. +2 −2 fbgen/src/X11/projectDef.cmake
  21. +3 −3 gen_templates/firebreathWin.rc
  22. +7 −9 src/ActiveXCore/CMakeLists.txt
  23. +8 −12 src/NPAPIHost/CMakeLists.txt
  24. +10 −11 src/NpapiCore/CMakeLists.txt
  25. +22 −21 src/PluginAuto/CMakeLists.txt
  26. +9 −10 src/PluginCore/CMakeLists.txt
  27. +8 −9 src/ScriptingCore/CMakeLists.txt
  28. +0 −2 src/libs/HttpService/CMakeLists.txt
  29. +3 −3 src/libs/curl/CMakeLists.txt
  30. +6 −5 src/libs/jsoncpp/CMakeLists.txt
  31. +0 −1 src/libs/log4cplus/CMakeLists.txt
  32. +3 −1 src/libs/openssl/CMakeLists.txt
  33. +16 −19 tests/ActiveXCoreTest/CMakeLists.txt
  34. +11 −16 tests/NpapiCoreTest/CMakeLists.txt
  35. +12 −17 tests/ScriptingCoreTest/CMakeLists.txt
  36. +0 −2 tests/unittest-cpp/UnitTest++/CMakeLists.txt
  37. +1 −1 winprep.cmd
View
61 CMakeLists.txt 100644 → 100755
@@ -17,26 +17,28 @@ cmake_minimum_required (VERSION 2.6)
set (CMAKE_BACKWARDS_COMPATIBILITY 2.6)
Project (FireBreath)
+set(FB_EXPORT_FILE FireBreath_Exports.cmake)
-set(CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-
-include(${CMAKE_DIR}/common.cmake)
-
-#check to make sure we're either using WITH_SYSTEM_BOOST or have the firebreath-boost lib installed
-check_boost()
+# First, find FB_ROOT
+get_filename_component(FB_ROOT ${CMAKE_CURRENT_LIST_FILE} PATH CACHE)
+include(${FB_ROOT}/cmake/common.cmake)
if (APPLE)
clear_xcode_patches()
endif()
-if (NOT EXISTS ${PROJECTS_SOURCE_DIR})
- message(FATAL_ERROR "The specified project directory ${PROJECTS_SOURCE_DIR} is not found")
+#check to make sure we're either using WITH_SYSTEM_BOOST or have the firebreath-boost lib installed
+fb_check_boost()
+
+if (FB_PROJECTS_DIR AND NOT EXISTS ${FB_PROJECTS_DIR})
+ message(FATAL_ERROR "The specified project directory ${FB_PROJECTS_DIR} is not found")
endif()
if (VERBOSE)
- message("Firebreath solution dir: " ${PROJECT_BINARY_DIR})
+ message("Firebreath solution dir: " ${CMAKE_CURRENT_BINARY_DIR})
endif()
+# These are required for FireBreath to run
find_package(Threads REQUIRED)
add_boost_library(thread)
add_boost_library(system)
@@ -46,16 +48,22 @@ endif()
# Common core projects -- projects that don't have any plugin specific code,
# but are required before any plugins are loaded
-add_subdirectory(${SCRIPTINGCORE_SOURCE_DIR})
-add_subdirectory(${PLUGINCORE_SOURCE_DIR})
-add_subdirectory(${NPAPICORE_SOURCE_DIR})
-if (WIN32)
- add_subdirectory(${ACTIVEXCORE_SOURCE_DIR})
+# we use an explicit binary directory here in case this file is included out-of-tree
+get_target_property(FB_SCRIPTINGCORE_LOADED ScriptingCore TYPE)
+if (NOT FB_SCRIPTINGCORE_LOADED)
+ add_subdirectory(${FB_SCRIPTINGCORE_SOURCE_DIR} ${FB_SCRIPTINGCORE_BUILD_DIR})
+ add_subdirectory(${FB_PLUGINCORE_SOURCE_DIR} ${FB_PLUGINCORE_BUILD_DIR})
+ add_subdirectory(${FB_NPAPICORE_SOURCE_DIR} ${FB_NPAPICORE_BUILD_DIR})
+ set (FB_EXPORT_TARGETS ScriptingCore PluginCore NpapiCore)
+ if (WIN32)
+ add_subdirectory(${FB_ACTIVEXCORE_SOURCE_DIR} ${FB_ACTIVEXCORE_BUILD_DIR})
+ set (FB_EXPORT_TARGETS ${FB_EXPORT_TARGETS} ActiveXCore)
+ endif()
endif()
# search the project src dir for plugin project directories
file (GLOB PLUGIN_PROJECTS
- ${PROJECTS_SOURCE_DIR}/[^.]*
+ ${FB_PROJECTS_DIR}/[^.]*
)
if (VERBOSE)
@@ -68,26 +76,29 @@ foreach (CURPROJECT ${PLUGIN_PROJECTS})
if (EXISTS "${CURPROJECT}/CMakeLists.txt" AND EXISTS "${CURPROJECT}/PluginConfig.cmake")
set (FOUND_PROJECTS 1)
get_filename_component(PROJNAME ${CURPROJECT} NAME_WE)
- configure_file(${CMAKE_DIR}/projectConfig_main.cmake.in ${PROJECTS_BINARY_DIR}/${PROJNAME}/projectConfig.cmake COPYONLY)
if (VERBOSE)
- message("Configuring plugin project ${CURPROJECT} in ${PROJECTS_BINARY_DIR}/${PROJNAME}")
+ message("Configuring plugin project ${CURPROJECT} in ${FB_PROJECTS_BINARY_DIR}/${PROJNAME}")
endif()
- add_subdirectory("${CURPROJECT}" "${PROJECTS_BINARY_DIR}/${PROJNAME}")
+ add_firebreath_plugin(${CURPROJECT} ${PROJNAME})
else()
message("${CURPROJECT}/ does not seem to be a FireBreath Plugin")
endif()
endforeach()
# Common projects -- projects that don't have any plugin specific code
-add_subdirectory(${UNITTEST_FW_SOURCE_DIR})
-add_subdirectory(${NPAPIHOST_SOURCE_DIR})
-add_subdirectory(${SCRIPTINGCORETEST_SOURCE_DIR})
-if (WIN32)
- add_subdirectory(${ACTIVEXCORETEST_SOURCE_DIR})
+if (NOT FB_SCRIPTINGCORE_LOADED)
+ add_subdirectory(${FB_UNITTEST_FW_SOURCE_DIR} ${FB_UNITTEST_FW_BUILD_DIR})
+ add_subdirectory(${FB_NPAPIHOST_SOURCE_DIR} ${FB_NPAPIHOST_BUILD_DIR})
+ add_subdirectory(${FB_SCRIPTINGCORETEST_SOURCE_DIR} ${FB_SCRIPTINGCORETEST_BUILD_DIR})
+ if (WIN32)
+ add_subdirectory(${FB_ACTIVEXCORETEST_SOURCE_DIR} ${FB_ACTIVEXCORETEST_BUILD_DIR})
+ endif()
+ #add_subdirectory(${FB_NPAPICORETEST_SOURCE_DIR}) # - not functional, needs to be re-done
endif()
-#add_subdirectory(${NPAPICORETEST_SOURCE_DIR}) # - not functional, needs to be re-done
-if (NOT FOUND_PROJECTS)
+if (NOT FOUND_PROJECTS AND "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ # If this file is the root file then we should have a projects directory
MESSAGE("No projects found in ${PROJECTS_SOURCE_DIR}/.")
MESSAGE(FATAL_ERROR "To build examples, run 'prep<ver> examples'")
endif()
+
@@ -12,31 +12,40 @@
#Copyright 2009 PacketPass, Inc and the Firebreath development team
#\**********************************************************/
-get_filename_component (GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)
+# Note that PluginConfig.cmake should have been included before this file!
+# Also note that this file will be included once per plugin project and is
+# intended to assist with cleaning up configuration values, generating
+# needed files, etc.
-get_filename_component(TEMPLATE_DIR "${FB_ROOT_DIR}/gen_templates" ABSOLUTE)
-get_filename_component(TEMPLATE_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen" ABSOLUTE)
-message("Generating plugin configuration files in ${TEMPLATE_DEST_DIR}")
+set (FB_CURRENT_PLUGIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+get_filename_component(FB_TEMPLATE_DIR "${FB_ROOT_DIR}/gen_templates" ABSOLUTE)
+get_filename_component(FB_TEMPLATE_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/projects/${PLUGIN_NAME}/gen" ABSOLUTE)
+message("Generating plugin configuration files in ${FB_TEMPLATE_DEST_DIR}")
+
+# By this point we should have added any firebreath libraries that we want, so
+# FBLIB_DEFINITONS should be filled out
add_definitions(${FBLIB_DEFINITIONS})
-include_directories(
+# Generally needed include directories for each plugin
+set(PLUGIN_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
- ${GECKOSDK_SOURCE_DIR}
+ ${FB_GECKOSDK_SOURCE_DIR}
${FB_INCLUDE_DIRS}
- ${NPAPICORE_SOURCE_DIR}
- ${ACTIVEXCORE_SOURCE_DIR}
- ${SCRIPTINGCORE_SOURCE_DIR}
- ${PLUGINAUTO_SOURCE_DIR}
- ${PLUGINAUTO_SOURCE_DIR}/Win
- ${PLUGINCORE_SOURCE_DIR}
- ${GEN_DIR}/gen
+ ${FB_NPAPICORE_SOURCE_DIR}
+ ${FB_ACTIVEXCORE_SOURCE_DIR}
+ ${FB_SCRIPTINGCORE_SOURCE_DIR}
+ ${FB_PLUGINAUTO_SOURCE_DIR}/${FB_PLATFORM_NAME}
+ ${FB_PLUGINAUTO_SOURCE_DIR}
+ ${FB_PLUGINCORE_SOURCE_DIR}
+ ${FB_TEMPLATE_DEST_DIR}
${Boost_INCLUDE_DIRS}
${FBLIB_INCLUDE_DIRS}
${ATL_INCLUDE_DIRS}
- ${CONFIG_DIR}
+ ${FB_CONFIG_DIR}
)
+# Clean up PluginConfig values as needed
# set up the mimetype strings
string(REPLACE ";" "|" FBMIMETYPE_LIST "${FBSTRING_MIMEType}")
string(REGEX REPLACE "\\.dll$" "" FBSTRING_PluginFileName "${FBSTRING_PluginFileName}")
@@ -48,35 +57,37 @@ else()
set(FB_WIX_INSTALL_LOCATION "AppDataFolder")
endif()
+
# configure default generated files
-file(GLOB TEMPLATELIST ${TEMPLATE_DIR}/[^.]*)
+# TODO: Fix this to not need configure_template; it is suboptimal
+file(GLOB TEMPLATELIST ${FB_TEMPLATE_DIR}/[^.]*)
foreach(TemplateFile ${TEMPLATELIST})
get_filename_component(CURFILE ${TemplateFile} NAME)
get_filename_component(CUREXT ${TemplateFile} EXT)
if (CUREXT STREQUAL ".h" OR CUREXT STREQUAL ".hpp" OR CUREXT STREQUAL ".inc")
- set (CUR_DEST ${TEMPLATE_DEST_DIR}/global)
+ set (CUR_DEST ${FB_TEMPLATE_DEST_DIR}/global)
else()
- set (CUR_DEST ${TEMPLATE_DEST_DIR})
+ set (CUR_DEST ${FB_TEMPLATE_DEST_DIR})
endif()
- if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${CURFILE})
+ if (EXISTS ${FB_CURRENT_PLUGIN_DIR}/${CURFILE})
if (VERBOSE)
message("Configuring ${CURFILE} from project source dir")
endif()
- configure_template(${CMAKE_CURRENT_SOURCE_DIR}/${CURFILE} ${CUR_DEST}/${CURFILE})
+ configure_template(${FB_CURRENT_PLUGIN_DIR}/${CURFILE} ${CUR_DEST}/${CURFILE})
else()
if (VERBOSE)
message("Configuring ${CURFILE}")
endif()
- configure_template(${TEMPLATE_DIR}/${CURFILE} ${CUR_DEST}/${CURFILE})
+ configure_template(${FB_TEMPLATE_DIR}/${CURFILE} ${CUR_DEST}/${CURFILE})
endif()
endforeach()
# configure project-specific generated files
-file(GLOB TEMPLATELIST ${CMAKE_CURRENT_SOURCE_DIR}/templates/[^.]*)
+file(GLOB TEMPLATELIST ${FB_CURRENT_PLUGIN_DIR}/templates/[^.]*)
foreach(TemplateFile ${TEMPLATELIST})
get_filename_component(CURFILE ${TemplateFile} NAME)
message("Configuring ${CURFILE}")
- configure_template(${CMAKE_CURRENT_SOURCE_DIR}/templates/${CURFILE} ${TEMPLATE_DEST_DIR}/${CURFILE})
+ configure_template(${FB_CURRENT_PLUGIN_DIR}/templates/${CURFILE} ${TEMPLATE_DEST_DIR}/${CURFILE})
endforeach()
# Repititions in the following are intentional to fix linking errors due to
@@ -96,13 +107,15 @@ if (WIN32)
ActiveXCore
${PLUGIN_INTERNAL_DEPS}
${ATL_LIBRARY}
+ psapi
)
- file (GLOB GENERATED RELATIVE ${CMAKE_CURRENT_BINARY_DIR}
- ${GEN_DIR}/gen/[^.]*.rgs
- ${GEN_DIR}/gen/[^.]*.def
- ${GEN_DIR}/gen/[^.]*.rc
+ file (GLOB GENERATED
+ ${FB_TEMPLATE_DEST_DIR}/[^.]*.rgs
+ ${FB_TEMPLATE_DEST_DIR}/[^.]*.def
+ ${FB_TEMPLATE_DEST_DIR}/[^.]*.rc
)
+ SOURCE_GROUP(Generated FILES ${GENERATED})
endif(WIN32)
View
@@ -136,8 +136,8 @@ MACRO(add_windows_plugin PROJNAME INSOURCES)
set_target_properties (${PROJNAME} PROPERTIES
OUTPUT_NAME ${FBSTRING_PluginFileName}
PROJECT_LABEL ${PROJNAME}
- RUNTIME_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
- LIBRARY_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
+ RUNTIME_OUTPUT_DIRECTORY "${FB_BIN_DIR}/${PLUGIN_NAME}"
+ LIBRARY_OUTPUT_DIRECTORY "${FB_BIN_DIR}/${PLUGIN_NAME}"
LINK_FLAGS "${LINK_FLAGS}"
)
@@ -202,7 +202,7 @@ function (add_wix_installer PROJNAME WIX_SOURCEFILES WIX_COMPGROUP WIX_OUTDIR WI
set(SOURCELIST ${SOURCELIST} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
ENDFOREACH()
- set (WIX_HEAT_FLAGS ${WIX_HEAT_FLAGS} -var var.BINSRC "-t:${CMAKE_DIR}\\FixFragment.xslt")
+ set (WIX_HEAT_FLAGS ${WIX_HEAT_FLAGS} -var var.BINSRC "-t:${FB_ROOT}\\cmake\\FixFragment.xslt")
set (WIX_CANDLE_FLAGS ${WIX_LINK_FLAGS} -dBINSRC=${WIX_OUTDIR})
set (WIX_LINK_FLAGS ${WIX_LINK_FLAGS} -sw1076)
WIX_HEAT(WIX_DLLFILES WIXDLLWXS_LIST NONE)
@@ -218,7 +218,7 @@ function (add_wix_installer PROJNAME WIX_SOURCEFILES WIX_COMPGROUP WIX_OUTDIR WI
set_source_files_properties(${WIXOBJ_LIST} ${WIX_DEST} PROPERTIES GENERATED 1)
SOURCE_GROUP(Binary FILES ${WIXOBJ_LIST})
set (WIX_SOURCES
- ${CMAKE_DIR}/dummy.cpp
+ ${FB_ROOT}/cmake/dummy.cpp
${WIX_SOURCEFILES}
${SOURCELIST}
${WIXOBJ_LIST}
View
4 cmake/X11.cmake 100644 → 100755
@@ -61,8 +61,8 @@ MACRO(add_x11_plugin PROJNAME INSOURCES)
PROJECT_LABEL "${PROJNAME}"
LINK_FLAGS "${NPAPI_LINK_FLAGS}"
PREFIX ""
- RUNTIME_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
- LIBRARY_OUTPUT_DIRECTORY "${BIN_DIR}/${PLUGIN_NAME}"
+ RUNTIME_OUTPUT_DIRECTORY "${FB_BIN_DIR}/${PLUGIN_NAME}"
+ LIBRARY_OUTPUT_DIRECTORY "${FB_BIN_DIR}/${PLUGIN_NAME}"
)
ENDMACRO(add_x11_plugin)
Oops, something went wrong.

0 comments on commit 49fb59e

Please sign in to comment.