make base as library

This commit is contained in:
Jean-Philippe Bruyère 2017-08-17 20:40:52 +02:00
parent ed1134d6d2
commit 977f0318b7
2 changed files with 14 additions and 8 deletions

View file

@ -82,12 +82,12 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-std=c++11)
file(GLOB SOURCE *.cpp base/*.cpp)
file(GLOB SOURCE *.cpp )
# Function for building single example
function(buildExample EXAMPLE_NAME)
# Main
file(GLOB SOURCE *.cpp base/*.cpp ${EXAMPLE_NAME}/*.cpp)
file(GLOB SOURCE *.cpp ${BASE_HEADERS} ${EXAMPLE_NAME}/*.cpp)
SET(MAIN_CPP ${EXAMPLE_NAME}/${EXAMPLE_NAME}.cpp)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE_NAME}/main.cpp)
SET(MAIN_CPP ${EXAMPLE_NAME}/main.cpp)
@ -103,10 +103,10 @@ function(buildExample EXAMPLE_NAME)
source_group("Shaders" FILES ${SHADERS})
if(WIN32)
add_executable(${EXAMPLE_NAME} WIN32 ${MAIN_CPP} ${SOURCE} ${SHADERS})
target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WINLIBS})
target_link_libraries(${EXAMPLE_NAME} base ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WINLIBS})
else(WIN32)
add_executable(${EXAMPLE_NAME} ${MAIN_CPP} ${SOURCE} ${SHADERS})
target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${EXAMPLE_NAME} base )
endif(WIN32)
endfunction(buildExample)
@ -125,11 +125,13 @@ ENDIF(MSVC)
IF(WIN32)
# Nothing here (yet)
ELSE(WIN32)
link_libraries(${XCB_LIBRARIES} ${Vulkan_LIBRARY})
link_libraries(${XCB_LIBRARIES} ${Vulkan_LIBRARY} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
add_subdirectory(base)
set(EXAMPLES
bloom
computecloth

4
base/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
file(GLOB BASE_SRC *.cpp)
file(GLOB BASE_HEADERS *.hpp)
add_library(base SHARED ${BASE_SRC})