Skip to content

Commit

Permalink
Massive code relocation and a new (real) build system using CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
nlhepler committed Aug 31, 2011
1 parent 21341a7 commit 9d6b1eb
Show file tree
Hide file tree
Showing 1,451 changed files with 163 additions and 2,915 deletions.
131 changes: 131 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
cmake_minimum_required(VERSION 2.8)
project(HyPhy)

set(DEFAULT_COMPILE_FLAGS "-w -c -fsigned-char -fast -O3")

set(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Installation prefix")

add_subdirectory(contrib/gtest-1.6.0)
set_property(
TARGET gtest gtest_main
PROPERTY EXCLUDE_FROM_ALL true
)

# file(GLOB_RECURSE HYPHY_STDLIB res/)
# add_custom_command(OUTPUT ${HYPHY_STDLIB}

install(DIRECTORY res/ DESTINATION lib/hyphy)

# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)

file(GLOB SRC_CORE src/core/*.cpp)
file(GLOB SRC_NEW src/new/*.cpp)
file(GLOB SRC_GTESTS tests/gtests/*.cpp)

set(SRC_LINK src/lib/Link/THyPhy.cpp)
set(SRC_PREFS src/gui/preferences.cpp)
set(SRC_SQLITE3 contrib/SQLite-3.6.17/sqlite3.c)
set(SRC_UNIXMAIN src/mains/unix.cpp)
set(SRC_UTILS src/utils/hyphyunixutils.cpp)

set(SRC_COMMON ${SRC_CORE} ${SRC_NEW} ${SRC_SQLITE3} ${SRC_UTILS})

set_property(
SOURCE ${SRC_SQLITE3}
APPEND PROPERTY COMPILE_FLAGS "-Wno-int-to-pointer-cast -Wno-pointer-to-int-cast"
)

add_library(hyphy_mp SHARED
EXCLUDE_FROM_ALL
${SRC_COMMON} ${SRC_LINK} ${SRC_PREFS}
)
target_link_libraries(hyphy_mp curl ssl crypto)
install(TARGETS hyphy_mp
LIBRARY DESTINATION lib
OPTIONAL
)
add_custom_target(LIB DEPENDS hyphy_mp)

add_executable(HYPHYMP
EXCLUDE_FROM_ALL
${SRC_COMMON} ${SRC_UNIXMAIN}
)
target_link_libraries(HYPHYMP curl ssl crypto)
install(TARGETS HYPHYMP
RUNTIME DESTINATION bin
OPTIONAL
)
add_custom_target(MP2 DEPENDS HYPHYMP)

add_executable(HYPHYMPI
EXCLUDE_FROM_ALL
${SRC_COMMON} ${SRC_UNIXMAIN}
)
target_link_libraries(HYPHYMPI curl ssl crypto)
install(TARGETS HYPHYMPI
RUNTIME DESTINATION bin
OPTIONAL
)
add_custom_target(MPI DEPENDS HYPHYMPI)

add_executable(HYPHYGTEST
EXCLUDE_FROM_ALL
${SRC_COMMON} ${SRC_GTESTS} ${SRC_UNIXMAIN}
)
add_dependencies(HYPHYGTEST gtest)
target_link_libraries(HYPHYGTEST curl ssl crypto gtest)
add_custom_target(GTEST DEPENDS HYPHYGTEST)

include_directories(src/core/include src/gui/include src/lib/Link src/new/include contrib contrib/gtest-1.6.0/include tests/gtests)
add_definitions(-D_SLKP_LFENGINE_REWRITE_ -DINTPTR_TYPE=long)

if(UNIX)
add_definitions(-D__UNIX__)
endif(UNIX)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-D__HYPHY_64__)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)

set_property(
TARGET hyphy_mp
APPEND PROPERTY COMPILE_DEFINITIONS __HEADLESS__
)

set_property(
TARGET hyphy_mp HYPHYMP
APPEND PROPERTY COMPILE_DEFINITIONS __MP__ __MP2__
)

set_property(
TARGET HYPHYMPI
PROPERTY COMPILE_DEFINITIONS __HYPHYMPI__
)

set_property(
TARGET HYPHYGTEST
APPEND PROPERTY COMPILE_DEFINITIONS __UNITTEST__
)

set_property(
TARGET HYPHYMP HYPHYMPI HYPHYGTEST
APPEND PROPERTY COMPILE_DEFINITIONS _HYPHY_BASEDIRECTORY_="${CMAKE_INSTALL_PREFIX}/lib/hyphy"
)

set_property(
TARGET hyphy_mp HYPHYMP HYPHYMPI
PROPERTY COMPILE_FLAGS ${DEFAULT_COMPILE_FLAGS}
)

set_property(
TARGET HYPHYGTEST
PROPERTY COMPILE_FLAGS "${DEFAULT_COMPILE_FLAGS} -g -fprofile-arcs -ftest-coverage"
)
24 changes: 24 additions & 0 deletions cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")

# suppress nauseating output
cmake_policy(SET CMP0007 OLD)
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

// Build for PPC and Intel, 32- and 64-bit
ARCHS = i386
ARCHS = i386 x86_64 ppc ppc64

// Zerolink prevents link warnings so turn it off
ZERO_LINK = NO
Expand All @@ -33,9 +33,9 @@ ALWAYS_SEARCH_USER_PATHS = NO
GCC_DYNAMIC_NO_PIC = YES

// Default SDK and minimum OS version is 10.4
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk
MACOSX_DEPLOYMENT_TARGET = 10.6
GCC_VERSION = 4.2
SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk
MACOSX_DEPLOYMENT_TARGET = 10.4
GCC_VERSION = 4.0

// VERSIONING BUILD SETTINGS (used in Info.plist)
GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@
isa = PBXProject;
buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "gtest" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9d6b1eb

Please sign in to comment.