mirror of
https://github.com/arcan1s/moldyn.git
synced 2025-07-16 23:30:00 +00:00
refactoring
This commit is contained in:
@ -1,23 +1,33 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project(statgen)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_policy(SET CMP0003 OLD)
|
||||
|
||||
set(MY_CXX_FLAGS "-Wall")
|
||||
set(CMAKE_CXX_FLAGS "-O0 ${MY_CXX_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-lm")
|
||||
# set project name
|
||||
set (PROJECT statgen)
|
||||
# set additional cmake file
|
||||
include (${PROJECT}.cmake)
|
||||
|
||||
set(SOURCE_EXE main.c)
|
||||
set(SOURCE_LIB add_main.c
|
||||
coords.c
|
||||
graph.c
|
||||
int2char.c
|
||||
messages.c
|
||||
stat_print.c
|
||||
stat_select.c
|
||||
stat_sort.c
|
||||
summary_stat.c)
|
||||
|
||||
add_library(stat SHARED ${SOURCE_LIB})
|
||||
add_executable(statgen ${SOURCE_EXE})
|
||||
# additional options
|
||||
OPTION (WITH_DEBUG_MODE "Build with debug mode" ON)
|
||||
OPTION (ADD_INCLUDE "Add include files" ON)
|
||||
|
||||
target_link_libraries(statgen stat)
|
||||
# set libraries
|
||||
set (LIBRARIES)
|
||||
foreach (LIBRARY ${LIBRARIES})
|
||||
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
|
||||
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
|
||||
if ("${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND")
|
||||
message (STATUS "Adding library sources")
|
||||
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# additional targets
|
||||
set (TARGETS "")
|
||||
set (HEADERS "")
|
||||
|
||||
message (STATUS "SOURCES: ${SOURCES}")
|
||||
|
||||
add_subdirectory (src)
|
23
statgen/CMakeLists_bckp.txt
Normal file
23
statgen/CMakeLists_bckp.txt
Normal file
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(statgen)
|
||||
|
||||
set(MY_CXX_FLAGS "-Wall")
|
||||
set(CMAKE_CXX_FLAGS "-O0 ${MY_CXX_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-lm")
|
||||
|
||||
set(SOURCE_EXE main.c)
|
||||
set(SOURCE_LIB add_main.c
|
||||
coords.c
|
||||
graph.c
|
||||
int2char.c
|
||||
messages.c
|
||||
stat_print.c
|
||||
stat_select.c
|
||||
stat_sort.c
|
||||
summary_stat.c)
|
||||
|
||||
add_library(stat SHARED ${SOURCE_LIB})
|
||||
add_executable(statgen ${SOURCE_EXE})
|
||||
|
||||
target_link_libraries(statgen stat)
|
3376
statgen/oct-clb.001
3376
statgen/oct-clb.001
File diff suppressed because it is too large
Load Diff
105726
statgen/oct-clb_4.55.dat
105726
statgen/oct-clb_4.55.dat
File diff suppressed because it is too large
Load Diff
3241
statgen/oct.001
3241
statgen/oct.001
File diff suppressed because it is too large
Load Diff
61
statgen/src/CMakeLists.txt
Normal file
61
statgen/src/CMakeLists.txt
Normal file
@ -0,0 +1,61 @@
|
||||
set ("${PROJECT}_VERSION_MAJOR" 1)
|
||||
set ("${PROJECT}_VERSION_MINOR" 0)
|
||||
set ("${PROJECT}_VERSION_PATCH" 1)
|
||||
set ("${PROJECT}_VERSION" ${${PROJECT}_VERSION_MAJOR}.${${PROJECT}_VERSION_MINOR}.${${PROJECT}_VERSION_PATCH})
|
||||
|
||||
message (STATUS ${${PROJECT}_VERSION})
|
||||
|
||||
## set files
|
||||
# main files
|
||||
set (MAIN_SOURCES main)
|
||||
# not public srcs
|
||||
set (PRIVATE_CLASSES)
|
||||
# headers only files
|
||||
SET (HEADERS_ONLY)
|
||||
# public srcs
|
||||
set (PUBLIC_CLASSES add_main
|
||||
coords
|
||||
graph
|
||||
int2char
|
||||
messages
|
||||
stat_print
|
||||
stat_select
|
||||
stat_sort
|
||||
summary_stat)
|
||||
# public headers
|
||||
set (PUBLIC_HEADERS)
|
||||
# shared libraries
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (ADDITIONAL_LIB m)
|
||||
else ()
|
||||
set (ADDITIONAL_LIB)
|
||||
endif()
|
||||
set (SOURCES)
|
||||
|
||||
# append list
|
||||
foreach (class ${PRIVATE_CLASSES})
|
||||
LIST (APPEND SOURCES ${class}.c)
|
||||
LIST (APPEND HEADERS ${class}.h)
|
||||
endforeach ()
|
||||
|
||||
foreach (class ${HEADERS_ONLY})
|
||||
LIST (APPEND HEADERS ${class}.h)
|
||||
endforeach ()
|
||||
|
||||
foreach (class ${PUBLIC_CLASSES})
|
||||
LIST (APPEND SOURCES ${class}.c)
|
||||
LIST (APPEND HEADERS ../include/${PROJECT}/${class}.h)
|
||||
LIST (APPEND PUBLIC_HEADERS ../include/${PROJECT}/${class}.h)
|
||||
endforeach ()
|
||||
|
||||
# link libraries and compile
|
||||
add_executable (${PROJECT} ${MAIN_SOURCES} ${SOURCES})
|
||||
target_link_libraries (${PROJECT} ${ADDITIONAL_LIB})
|
||||
|
||||
# install properties
|
||||
INSTALL (TARGETS ${PROJECT}
|
||||
DESTINATION bin)
|
||||
if (ADD_INCLUDE)
|
||||
INSTALL (FILES ${PUBLIC_HEADERS}
|
||||
DESTINATION include/${PROJECT})
|
||||
endif ()
|
@ -4,14 +4,14 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "add_main.h"
|
||||
#include "coords.h"
|
||||
#include "int2char.h"
|
||||
#include "messages.h"
|
||||
#include "stat_print.h"
|
||||
#include "stat_select.h"
|
||||
#include "stat_sort.h"
|
||||
#include "summary_stat.h"
|
||||
// #include "add_main.h"
|
||||
// #include "coords.h"
|
||||
// #include "int2char.h"
|
||||
// #include "messages.h"
|
||||
// #include "stat_print.h"
|
||||
// #include "stat_select.h"
|
||||
// #include "stat_sort.h"
|
||||
// #include "summary_stat.h"
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
@ -9,7 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "graph.h"
|
||||
// #include "graph.h"
|
||||
|
||||
|
||||
int printing_agl (const char *input, const char *output, const int *connect,
|
22
statgen/statgen.cmake
Normal file
22
statgen/statgen.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
# set directories
|
||||
set ("${PROJECT}_BINARY_DIR" bin)
|
||||
set ("${PROJECT}_SOURCE_DIR" src:include)
|
||||
set ("${PROJECT}_LIB_DIR" lib)
|
||||
|
||||
set (CMAKE_INCLUDE_PATH ${${PROJECT}_SOURCE_DIR})
|
||||
set (CMAKE_LIBRARY_PATH ${${PROJECT}_LIB_DIR})
|
||||
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/${${PROJECT}_BINARY_DIR})
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
if ( WITH_DEBUG_MODE )
|
||||
ADD_DEFINITIONS ( -DDEBUG_MODE=1 )
|
||||
endif ()
|
||||
|
||||
if ( CMAKE_COMPILER_IS_GNUCXX )
|
||||
set (ADD_CXX_FLAGS "-Wall -v")
|
||||
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
else ()
|
||||
message ("not yet")
|
||||
endif ()
|
Reference in New Issue
Block a user