From 9be8ca371462ecfde174886c1260432c6539c139 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 4 Nov 2013 14:49:42 +0800 Subject: [PATCH] [cmake] output lib to root/lib --- CMakeLists.txt | 1 - cocos/2d/CMakeLists.txt | 7 +++++++ cocos/audio/CMakeLists.txt | 9 ++++++++- cocos/base/CMakeLists.txt | 7 +++++++ cocos/editor-support/cocosbuilder/CMakeLists.txt | 7 +++++++ cocos/editor-support/cocostudio/CMakeLists.txt | 7 +++++++ cocos/editor-support/spine/CMakeLists.txt | 7 +++++++ cocos/gui/CMakeLists.txt | 5 +++++ cocos/math/kazmath/CMakeLists.txt | 8 +++++++- cocos/network/CMakeLists.txt | 7 +++++++ extensions/CMakeLists.txt | 7 +++++++ external/chipmunk/src/CMakeLists.txt | 9 +++++++++ external/json/CMakeLists.txt | 8 +++++++- external/tinyxml2/CMakeLists.txt | 7 +++++++ external/unzip/CMakeLists.txt | 7 +++++++ samples/Cpp/HelloCpp/CMakeLists.txt | 4 ++-- samples/Cpp/TestCpp/CMakeLists.txt | 4 ++-- samples/Lua/HelloLua/CMakeLists.txt | 4 ++-- samples/Lua/TestLua/CMakeLists.txt | 8 +++++--- 19 files changed, 110 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f93de1683..e07f618e27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,6 @@ link_directories( add_subdirectory(cocos/math/kazmath) # chipmunk library -set(BUILD_STATIC 1) add_subdirectory(external/chipmunk/src) # box2d library diff --git a/cocos/2d/CMakeLists.txt b/cocos/2d/CMakeLists.txt index 1e66ba9cb4..f147d233b6 100644 --- a/cocos/2d/CMakeLists.txt +++ b/cocos/2d/CMakeLists.txt @@ -140,3 +140,10 @@ target_link_libraries(cocos2d rt z ) + +set_target_properties(cocos2d + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/audio/CMakeLists.txt b/cocos/audio/CMakeLists.txt index 4f56e9b44b..9e88293ddd 100644 --- a/cocos/audio/CMakeLists.txt +++ b/cocos/audio/CMakeLists.txt @@ -9,4 +9,11 @@ add_library(audio STATIC target_link_libraries(audio fmodex64 -) \ No newline at end of file +) + +set_target_properties(audio + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/base/CMakeLists.txt b/cocos/base/CMakeLists.txt index c46e07c114..3d37d21a2f 100644 --- a/cocos/base/CMakeLists.txt +++ b/cocos/base/CMakeLists.txt @@ -18,3 +18,10 @@ set(COCOS_BASE_SRC add_library(cocosbase STATIC ${COCOS_BASE_SRC} ) + +set_target_properties(cocosbase + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/editor-support/cocosbuilder/CMakeLists.txt b/cocos/editor-support/cocosbuilder/CMakeLists.txt index 57f1113de6..00763e1fb7 100644 --- a/cocos/editor-support/cocosbuilder/CMakeLists.txt +++ b/cocos/editor-support/cocosbuilder/CMakeLists.txt @@ -31,3 +31,10 @@ include_directories( add_library(cocosbuilder STATIC ${CCB_SRC} ) + +set_target_properties(cocosbuilder + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt index 8aa09558d9..acff17a4a9 100644 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ b/cocos/editor-support/cocostudio/CMakeLists.txt @@ -45,3 +45,10 @@ add_library(cocostudio STATIC target_link_libraries(cocostudio jsoncpp ) + +set_target_properties(cocostudio + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/editor-support/spine/CMakeLists.txt b/cocos/editor-support/spine/CMakeLists.txt index e76d1ea6f8..0d6664b98d 100644 --- a/cocos/editor-support/spine/CMakeLists.txt +++ b/cocos/editor-support/spine/CMakeLists.txt @@ -29,3 +29,10 @@ include_directories( add_library(spine STATIC ${SPINE_SRC} ) + +set_target_properties(spine + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/cocos/gui/CMakeLists.txt b/cocos/gui/CMakeLists.txt index 069ce8a960..916e5cf0f2 100644 --- a/cocos/gui/CMakeLists.txt +++ b/cocos/gui/CMakeLists.txt @@ -27,3 +27,8 @@ add_library(gui STATIC ${GUI_SRC} ) +set_target_properties(gui + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) diff --git a/cocos/math/kazmath/CMakeLists.txt b/cocos/math/kazmath/CMakeLists.txt index 1dc636037d..208b4a97c2 100644 --- a/cocos/math/kazmath/CMakeLists.txt +++ b/cocos/math/kazmath/CMakeLists.txt @@ -14,4 +14,10 @@ SET(KAZMATH_SOURCES ${CMAKE_SOURCE_DIR}/cocos/math/kazmath/src/GL/matrix.c ) -ADD_SUBDIRECTORY(src) \ No newline at end of file +ADD_SUBDIRECTORY(src) + +set_target_properties(kazmath + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) diff --git a/cocos/network/CMakeLists.txt b/cocos/network/CMakeLists.txt index 1b001c6210..3bd130111b 100644 --- a/cocos/network/CMakeLists.txt +++ b/cocos/network/CMakeLists.txt @@ -10,3 +10,10 @@ add_library(network STATIC target_link_libraries(network curl ) + +set_target_properties(network + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 5b85c4657b..176cd831ce 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -32,3 +32,10 @@ include_directories( add_library(extensions STATIC ${EXTENSIONS_SRC} ) + +set_target_properties(extensions + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/external/chipmunk/src/CMakeLists.txt b/external/chipmunk/src/CMakeLists.txt index 6f10d0177d..a0d15b7b8a 100644 --- a/external/chipmunk/src/CMakeLists.txt +++ b/external/chipmunk/src/CMakeLists.txt @@ -1,3 +1,5 @@ +set(BUILD_STATIC 1) + file(GLOB chipmunk_source_files "*.c" "constraints/*.c") file(GLOB chipmunk_public_header "${chipmunk_SOURCE_DIR}/include/chipmunk/*.h") file(GLOB chipmunk_constraint_header "${chipmunk_SOURCE_DIR}/include/chipmunk/constraints/*.h") @@ -39,3 +41,10 @@ if(BUILD_SHARED OR INSTALL_STATIC) install(FILES ${chipmunk_public_header} DESTINATION include/chipmunk) install(FILES ${chipmunk_constraint_header} DESTINATION include/chipmunk/constraints) endif(BUILD_SHARED OR INSTALL_STATIC) + +set_target_properties(chipmunk_static + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/external/json/CMakeLists.txt b/external/json/CMakeLists.txt index 257385a307..87018744ef 100644 --- a/external/json/CMakeLists.txt +++ b/external/json/CMakeLists.txt @@ -1,6 +1,6 @@ set(JSONCPP_SRC json_reader.cpp - json_value.cpp + json_value.cpp json_writer.cpp ) @@ -12,3 +12,9 @@ add_library(jsoncpp STATIC ${JSONCPP_SRC} ) +set_target_properties(jsoncpp + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/external/tinyxml2/CMakeLists.txt b/external/tinyxml2/CMakeLists.txt index 42822a3bc4..6877779b2c 100644 --- a/external/tinyxml2/CMakeLists.txt +++ b/external/tinyxml2/CMakeLists.txt @@ -5,3 +5,10 @@ set(TINYXML2_SRC add_library(tinyxml2 STATIC ${TINYXML2_SRC} ) + +set_target_properties(tinyxml2 + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/external/unzip/CMakeLists.txt b/external/unzip/CMakeLists.txt index 8d15111c8e..ae98584279 100644 --- a/external/unzip/CMakeLists.txt +++ b/external/unzip/CMakeLists.txt @@ -6,3 +6,10 @@ set(UNZIP_SRC add_library(unzip STATIC ${UNZIP_SRC} ) + +set_target_properties(unzip + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib" +) + diff --git a/samples/Cpp/HelloCpp/CMakeLists.txt b/samples/Cpp/HelloCpp/CMakeLists.txt index e8ee537a78..646a1574ab 100644 --- a/samples/Cpp/HelloCpp/CMakeLists.txt +++ b/samples/Cpp/HelloCpp/CMakeLists.txt @@ -13,9 +13,9 @@ add_executable(${SAMPLE_NAME} target_link_libraries(${SAMPLE_NAME} audio cocos2d) -set(SAMPLE_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${SAMPLE_NAME}") +set(SAMPLE_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${SAMPLE_NAME}") -SET_TARGET_PROPERTIES(${SAMPLE_NAME} PROPERTIES +set_target_properties(${SAMPLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SAMPLE_BIN_DIR}") COPY_RES( ${SAMPLE_NAME} "Resources/*" "${SAMPLE_BIN_DIR}") diff --git a/samples/Cpp/TestCpp/CMakeLists.txt b/samples/Cpp/TestCpp/CMakeLists.txt index d6c921f1d5..0547ee04b1 100644 --- a/samples/Cpp/TestCpp/CMakeLists.txt +++ b/samples/Cpp/TestCpp/CMakeLists.txt @@ -154,9 +154,9 @@ target_link_libraries(${SAMPLE_NAME} box2d ) -set(SAMPLE_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${SAMPLE_NAME}") +set(SAMPLE_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${SAMPLE_NAME}") -SET_TARGET_PROPERTIES(${SAMPLE_NAME} PROPERTIES +set_target_properties(${SAMPLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SAMPLE_BIN_DIR}") COPY_RES( ${SAMPLE_NAME} "Resources/*" "${SAMPLE_BIN_DIR}") diff --git a/samples/Lua/HelloLua/CMakeLists.txt b/samples/Lua/HelloLua/CMakeLists.txt index e1e41b7867..81b1fa4357 100644 --- a/samples/Lua/HelloLua/CMakeLists.txt +++ b/samples/Lua/HelloLua/CMakeLists.txt @@ -28,9 +28,9 @@ target_link_libraries(${SAMPLE_NAME} cocos2d ) -set(SAMPLE_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${SAMPLE_NAME}") +set(SAMPLE_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${SAMPLE_NAME}") -SET_TARGET_PROPERTIES(${SAMPLE_NAME} PROPERTIES +set_target_properties(${SAMPLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SAMPLE_BIN_DIR}") COPY_RES( ${SAMPLE_NAME} "Resources/*" "${SAMPLE_BIN_DIR}") diff --git a/samples/Lua/TestLua/CMakeLists.txt b/samples/Lua/TestLua/CMakeLists.txt index fb2225945d..cb37076c59 100644 --- a/samples/Lua/TestLua/CMakeLists.txt +++ b/samples/Lua/TestLua/CMakeLists.txt @@ -28,10 +28,12 @@ target_link_libraries(${SAMPLE_NAME} cocos2d ) -set(SAMPLE_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${SAMPLE_NAME}") +set(SAMPLE_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${SAMPLE_NAME}") -SET_TARGET_PROPERTIES(${SAMPLE_NAME} PROPERTIES +set_target_properties(${SAMPLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${SAMPLE_BIN_DIR}") -COPY_RES( ${SAMPLE_NAME} "Resources/*" "${SAMPLE_BIN_DIR}") +COPY_RES(${SAMPLE_NAME} "Resources/*" "${SAMPLE_BIN_DIR}") +COPY_RES_EXTRA(${SAMPLE_NAME} "${CMAKE_SOURCE_DIR}/samples/TestCpp/Resources/*") +# "${SAMPLE_BIN_DIR}")