Browse Source

cmake: Various fixes.

* Allow overriding install path with CMAKE_INSTALL_PREFIX.
* make sure js2min.py can be found when building out of source.
* Replace empty macros with void(0).
  Expressions like "debug(x) && foo()" fail if debug(x) is an empty macro.
* Make sure node-natives.h creation is deterministic.
* Fix version string.
  The copyright header made the node_version.h file larger
  than the previously set file read limit.
v0.7.4-release
Tom Hughes 13 years ago
committed by Ben Noordhuis
parent
commit
b267dc458d
  1. 5
      cmake/configure.cmake
  2. 14
      cmake/node_build.cmake
  3. 4
      cmake/package.cmake

5
cmake/configure.cmake

@ -33,10 +33,13 @@ if(${node_arch} MATCHES unknown)
set(node_arch x86)
endif()
set(NODE_INCLUDE_PREFIX ${CMAKE_INSTALL_PREFIX})
# Copy tools directory for out-of-source build
string(COMPARE EQUAL $(PROJECT_BINARY_DIR) ${PROJECT_SOURCE_DIR} in_source_build)
if(NOT ${in_source_build})
if(NOT in_source_build)
execute_process(COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
configure_file(${PROJECT_SOURCE_DIR}/deps/v8/tools/jsmin.py ${PROJECT_BINARY_DIR}/tools COPYONLY)
endif()
# Set some compiler/linker flags..

14
cmake/node_build.cmake

@ -6,8 +6,8 @@ set(macros_file ${PROJECT_BINARY_DIR}/macros.py)
# replace debug(x) and assert(x) with nothing in release build
if(${CMAKE_BUILD_TYPE} MATCHES Release)
file(APPEND ${macros_file} "macro debug(x) = ;\n")
file(APPEND ${macros_file} "macro assert(x) = ;\n")
file(APPEND ${macros_file} "macro debug(x) = void(0);\n")
file(APPEND ${macros_file} "macro assert(x) = void(0);\n")
endif()
if(NOT DTRACE)
@ -21,16 +21,20 @@ if(NOT DTRACE)
DTRACE_NET_SOCKET_READ
DTRACE_NET_SOCKET_WRITE)
foreach(probe ${dtrace_probes})
file(APPEND ${macros_file} "macro ${probe}(x) = ;\n")
file(APPEND ${macros_file} "macro ${probe}(x) = void(0);\n")
endforeach()
endif()
# Sort the JS files being built into natives so that the build is
# deterministic
list(SORT js2c_files)
# include macros file in generation
set(js2c_files ${js2c_files} ${macros_file})
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/src/node_natives.h
COMMAND ${PYTHON_EXECUTABLE} tools/js2c.py ${PROJECT_BINARY_DIR}/src/node_natives.h ${js2c_files}
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/js2c.py ${PROJECT_BINARY_DIR}/src/node_natives.h ${js2c_files}
DEPENDS ${js2c_files})
set(node_platform_src "src/platform_${node_platform}.cc")
@ -138,5 +142,5 @@ install(FILES
src/node_version.h
${PROJECT_BINARY_DIR}/src/node_config.h
DESTINATION include/node
DESTINATION ${NODE_INCLUDE_PREFIX}/include/node
)

4
cmake/package.cmake

@ -2,6 +2,10 @@
# package
#
# Allow absolute paths when installing
# see http://www.cmake.org/pipermail/cmake/2008-July/022958.html
set(CPACK_SET_DESTDIR "ON")
if(${node_platform} MATCHES darwin)
set(CPACK_GENERATOR "TGZ;PackageMaker")
# CPack requires the files to end in .txt

Loading…
Cancel
Save