Port to CMake
This commit is contained in:
parent
e326f2c4ea
commit
4d1f0160c1
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
*.o
|
*.o
|
||||||
couch
|
build/
|
||||||
|
37
CMakeLists.txt
Normal file
37
CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(Couch)
|
||||||
|
set(CMAKE_MODULE_PATH, ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR/cmake.})
|
||||||
|
|
||||||
|
## Find OPENGL packages
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
find_package(glfw3 3.3 REQUIRED)
|
||||||
|
|
||||||
|
## Find SWIG
|
||||||
|
find_package(SWIG REQUIRED)
|
||||||
|
|
||||||
|
## Find Lua
|
||||||
|
find_package(Lua REQUIRED)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE sources core/*.cpp core/*.h)
|
||||||
|
file(GLOB shaders shaders/*)
|
||||||
|
|
||||||
|
add_compile_definitions(LUA_SCRIPTING)
|
||||||
|
add_executable(couch ${sources})
|
||||||
|
include_directories(core)
|
||||||
|
target_link_libraries(couch glfw)
|
||||||
|
target_link_libraries(couch OpenGL::GL)
|
||||||
|
target_link_libraries(couch GLEW)
|
||||||
|
target_link_libraries(couch lua)
|
||||||
|
|
||||||
|
file(COPY shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
include(UseSWIG)
|
||||||
|
set_property(SOURCE scripting/couch.i PROPERTY CPLUSPLUS ON)
|
||||||
|
swig_add_library(couchlua
|
||||||
|
TYPE STATIC
|
||||||
|
LANGUAGE lua
|
||||||
|
SOURCES scripting/couch.i)
|
||||||
|
target_link_libraries(couch couchlua)
|
||||||
|
|
||||||
|
|
14
Makefile
14
Makefile
@ -1,14 +0,0 @@
|
|||||||
include common.mk
|
|
||||||
|
|
||||||
CORE_SRC = $(wildcard core/*.cpp)
|
|
||||||
CORE_OBJ = $(CORE_SRC:.cpp=.o)
|
|
||||||
|
|
||||||
all: couch
|
|
||||||
couch: $(CORE_OBJ) scripting/couch_wrap.o
|
|
||||||
$(CXX) $(LIBS) -o $@ $^
|
|
||||||
|
|
||||||
$(CORE_OBJ): %.o: %.cpp
|
|
||||||
$(MAKE) -C core $(notdir $@)
|
|
||||||
|
|
||||||
scripting/couch_wrap.o: scripting/couch.i
|
|
||||||
$(MAKE) -C scripting $(notdir $@)
|
|
@ -1,8 +0,0 @@
|
|||||||
include ../common.mk
|
|
||||||
|
|
||||||
CXXFLAGS := $(CXXFLAGS) -DLUA_SCRIPTING
|
|
||||||
|
|
||||||
SOURCES = $(wildcard *.cpp)
|
|
||||||
OBJS = $(SOURCES:.cpp=.o)
|
|
||||||
|
|
||||||
all: $(OBJS)
|
|
@ -1,12 +0,0 @@
|
|||||||
include ../common.mk
|
|
||||||
|
|
||||||
SWIG := swig
|
|
||||||
SWIG_OPTS := -lua
|
|
||||||
|
|
||||||
all: couch_wrap.o
|
|
||||||
|
|
||||||
couch_wrap.o: couch_wrap.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -I../core -c -o $@ $^
|
|
||||||
|
|
||||||
couch_wrap.cpp: couch.i
|
|
||||||
$(SWIG) -c++ $(SWIG_OPTS) -I../core -o $@ $^
|
|
Loading…
Reference in New Issue
Block a user