Updated cmake
This commit is contained in:
parent
f421d30f30
commit
f24478a514
@ -15,35 +15,41 @@
|
|||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
project(moFileReader)
|
project(moFileReader)
|
||||||
|
|
||||||
# Set Output Directories.
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../lib)
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../lib)
|
|
||||||
|
|
||||||
|
|
||||||
# The main include directory
|
# The main include directory
|
||||||
include_directories(BEFORE ../include)
|
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/include)
|
||||||
|
|
||||||
# executable build directory
|
|
||||||
add_subdirectory(bin)
|
|
||||||
|
|
||||||
# Let the user choose between static lib and dll
|
# Let the user choose between static lib and dll
|
||||||
# To use it, call cmake -DCOMPILE_DLL=ON
|
# To use it, call cmake -DCOMPILE_DLL=ON
|
||||||
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
|
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
|
||||||
|
|
||||||
# Dependency
|
|
||||||
link_directories(../lib)
|
|
||||||
|
|
||||||
if ( NOT COMPILE_DLL )
|
if ( NOT COMPILE_DLL )
|
||||||
|
|
||||||
# Static build
|
# Static build
|
||||||
add_library(moFileReader.static STATIC ../src/moFileReader.cpp ../src/mo.cpp)
|
add_library(moFileReader.static STATIC ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||||
|
|
||||||
else ( COMPILE_DLL )
|
else ( COMPILE_DLL )
|
||||||
|
|
||||||
# DLL
|
# DLL
|
||||||
add_definitions(-D_USRDLL -DMOFILE_EXPORTS)
|
add_definitions(-D_USRDLL -DMOFILE_EXPORTS)
|
||||||
add_library(moFileReader SHARED ../src/moFileReader.cpp ../src/mo.cpp)
|
add_library(moFileReader SHARED ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_executable(moReader ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||||
|
|
||||||
|
if ( NOT COMPILE_DLL )
|
||||||
|
|
||||||
|
add_definitions(-D_CONSOLE)
|
||||||
|
add_dependencies(moReader moFileReader.static)
|
||||||
|
target_link_libraries(moReader moFileReader.static)
|
||||||
|
|
||||||
|
else ( COMPILE_DLL )
|
||||||
|
|
||||||
|
add_definitions(-D_CONSOLE -DMOFILE_IMPORT)
|
||||||
|
add_dependencies(moReader moFileReader)
|
||||||
|
target_link_libraries(moReader moFileReader)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
@ -52,3 +58,5 @@ endif ()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
#-------------------------------------------------------
|
|
||||||
# moFileReader Main Build Script
|
|
||||||
#
|
|
||||||
# Defined Variables:
|
|
||||||
# - COMPILE_DLL
|
|
||||||
# - ON : Compiles the code as a shared Library
|
|
||||||
# - OFF : Compiles the code as a static Library
|
|
||||||
# - BUILD_DEBUG
|
|
||||||
# - ON : Compiles Debug-Information into the output
|
|
||||||
# - OFF : Optimizes the compilation with O2.
|
|
||||||
#
|
|
||||||
# Run cmake with -DVARNAME=ON/OFF to benefit from those
|
|
||||||
# possible settings.
|
|
||||||
#-------------------------------------------------------
|
|
||||||
cmake_minimum_required(VERSION 2.6)
|
|
||||||
project(moFileReader)
|
|
||||||
|
|
||||||
# Set Output Directories.
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../bin)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../lib)
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../lib)
|
|
||||||
|
|
||||||
|
|
||||||
# The main include directory
|
|
||||||
include_directories(BEFORE ../include)
|
|
||||||
|
|
||||||
# executable build directory
|
|
||||||
add_subdirectory(bin)
|
|
||||||
|
|
||||||
# Let the user choose between static lib and dll
|
|
||||||
# To use it, call cmake -DCOMPILE_DLL=ON
|
|
||||||
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
|
|
||||||
|
|
||||||
# Dependency
|
|
||||||
link_directories(../lib)
|
|
||||||
|
|
||||||
if ( NOT COMPILE_DLL )
|
|
||||||
|
|
||||||
# Static build
|
|
||||||
add_library(moFileReader.static STATIC ../src/moFileReader.cpp ../src/mo.cpp)
|
|
||||||
|
|
||||||
else ( COMPILE_DLL )
|
|
||||||
|
|
||||||
# DLL
|
|
||||||
add_definitions(-D_USRDLL -DMOFILE_EXPORTS)
|
|
||||||
add_library(moFileReader SHARED ../src/moFileReader.cpp ../src/mo.cpp)
|
|
||||||
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../bin)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ../../lib)
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../../lib)
|
|
||||||
|
|
||||||
add_executable(moReader ../../src/mo.cpp)
|
|
||||||
|
|
||||||
if ( NOT COMPILE_DLL )
|
|
||||||
|
|
||||||
add_definitions(-D_CONSOLE)
|
|
||||||
add_dependencies(moReader moFileReader.static)
|
|
||||||
target_link_libraries(moReader moFileReader.static)
|
|
||||||
|
|
||||||
else ( COMPILE_DLL )
|
|
||||||
|
|
||||||
add_definitions(-D_CONSOLE -DMOFILE_IMPORT)
|
|
||||||
add_dependencies(moReader moFileReader)
|
|
||||||
target_link_libraries(moReader moFileReader)
|
|
||||||
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -11,18 +11,17 @@ class MofilereaderConan(ConanFile):
|
|||||||
#options = {"shared": [True, False]}
|
#options = {"shared": [True, False]}
|
||||||
#default_options = "shared=False"
|
#default_options = "shared=False"
|
||||||
generators = "cmake"
|
generators = "cmake"
|
||||||
|
exports_sources = "include*", "src*", "CMakeLists.txt"
|
||||||
|
|
||||||
def source(self):
|
|
||||||
self.run("git clone https://bitbucket.org/scorcher24/mofilereader.git .")
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
cmake.configure(source_folder="build")
|
cmake.configure()
|
||||||
cmake.build()
|
cmake.build()
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.copy("*.h", dst="include", src="include")
|
self.copy("*.h", dst="include", src="include")
|
||||||
self.copy("*.lib", dst="lib", src=os.path.join("..", "lib"), keep_path=False)
|
self.copy("*.lib", dst="lib", keep_path=False)
|
||||||
self.copy("*.dll", dst="bin", keep_path=False)
|
self.copy("*.dll", dst="bin", keep_path=False)
|
||||||
self.copy("*.so", dst="lib", keep_path=False)
|
self.copy("*.so", dst="lib", keep_path=False)
|
||||||
self.copy("*.dylib", dst="lib", keep_path=False)
|
self.copy("*.dylib", dst="lib", keep_path=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user