Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partition code #3

Open
cdcseacave opened this issue May 16, 2017 · 0 comments
Open

partition code #3

cdcseacave opened this issue May 16, 2017 · 0 comments

Comments

@cdcseacave
Copy link

Great project! I only have a small suggestion regarding the project structure. Since it can be used as a library too, it would be helpful to separate the app from the library code. This will not only make the code more clear, but it will make writing the CMake scripts much easier too. Bellow is a sample for the library CMake script:

# Find required packages
FIND_PACKAGE(<package>)
if(<package>_FOUND)
	include_directories(${<package>_INCLUDE_DIRS})
	add_definitions(${<package>_DEFINITIONS})
	link_directories(${<package>_LIBRARY_DIRS})
endif()

# List sources files
FILE(GLOB LIBRARY_FILES_C "*.cpp")
FILE(GLOB LIBRARY_FILES_H "*.h" "*.inl")

# Create library
add_library(libcorto "Libs" "" "${cxx_default}" ${LIBRARY_FILES_C} ${LIBRARY_FILES_H})

# Link its dependencies
TARGET_LINK_LIBRARIES(libcorto ${<package>_LIBS})

# Install
SET_TARGET_PROPERTIES(libcorto PROPERTIES
	PUBLIC_HEADER "${LIBRARY_FILES_H}")
INSTALL(TARGETS libcorto
	EXPORT cortoTargets
	RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT bin
	LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT shlib
	ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT lib
	PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/corto" COMPONENT dev)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant